enable watchdog

This commit is contained in:
Wolfgang Hottgenroth 2020-12-27 12:31:51 +01:00
parent 71e024c48a
commit 98fa27256b

View File

@ -1,6 +1,7 @@
#include <mqttComm.h> #include <mqttComm.h>
#include <logger.h> #include <logger.h>
#include <main.h> #include <main.h>
#include <iwdg.h>
#include <pubsubc.h> #include <pubsubc.h>
#include <platformAdaption.h> #include <platformAdaption.h>
@ -45,6 +46,7 @@ void watchdogHandler(void *handle) {
// typedef void (*callback_t)(char*, uint8_t*, uint16_t); // typedef void (*callback_t)(char*, uint8_t*, uint16_t);
static void mqttCallback(char *topic, uint8_t *payload, uint16_t payloadLength) { static void mqttCallback(char *topic, uint8_t *payload, uint16_t payloadLength) {
if (0 == strcmp(topic, config->watchdogTopic)) { if (0 == strcmp(topic, config->watchdogTopic)) {
HAL_IWDG_Refresh(&hiwdg);
watchdogCounter++; watchdogCounter++;
} else { } else {
coloredMsg(LOG_GREEN, false, "mqcb: %s : %.*s", topic, payloadLength, payload); coloredMsg(LOG_GREEN, false, "mqcb: %s : %.*s", topic, payloadLength, payload);
@ -122,7 +124,7 @@ void mqttCommHandler(void *handle) {
coloredMsg(LOG_GREEN, false, "mqch, subscribe watchdog"); coloredMsg(LOG_GREEN, false, "mqch, subscribe watchdog");
res = subscribe(&mqttClient, config->watchdogTopic, MQTTQOS0); res = subscribe(&mqttClient, config->watchdogTopic, MQTTQOS0);
coloredMsg(LOG_GREEN, false, "mqch, subscribe returned %d", res); coloredMsg(LOG_GREEN, false, "mqch, subscribe returned %d", res);
schAdd(watchdogHandler, NULL, 60000, 60000); schAdd(watchdogHandler, NULL, 15000, 15000);
coloredMsg(LOG_GREEN, false, "mqch, watchdogHandler scheduled"); coloredMsg(LOG_GREEN, false, "mqch, watchdogHandler scheduled");
state = 4; state = 4;
break; break;