From 98fa27256b08d01ee66d1d86349df7157692e0b7 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Sun, 27 Dec 2020 12:31:51 +0100 Subject: [PATCH] enable watchdog --- cube/User/Src/mqttComm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cube/User/Src/mqttComm.c b/cube/User/Src/mqttComm.c index 9edcf16..2e9b26e 100644 --- a/cube/User/Src/mqttComm.c +++ b/cube/User/Src/mqttComm.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,7 @@ void watchdogHandler(void *handle) { // typedef void (*callback_t)(char*, uint8_t*, uint16_t); static void mqttCallback(char *topic, uint8_t *payload, uint16_t payloadLength) { if (0 == strcmp(topic, config->watchdogTopic)) { + HAL_IWDG_Refresh(&hiwdg); watchdogCounter++; } else { 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"); res = subscribe(&mqttClient, config->watchdogTopic, MQTTQOS0); 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"); state = 4; break;