Improved wdt code

This commit is contained in:
Kai Lauterbach 2023-01-09 12:07:01 +01:00
parent a05af95d51
commit 0f6934f4a1

View file

@ -1,6 +1,7 @@
// Standard ESP8266 libs from project folder // Standard ESP8266 libs from project folder
#include <ESP8266mDNS.h> #include <ESP8266mDNS.h>
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#include <esp.h>
#include <WiFiClient.h> // WiFiClient #include <WiFiClient.h> // WiFiClient
@ -132,8 +133,11 @@ void setup() {
#else // not in battery mode #else // not in battery mode
#ifdef ENABLE_WATCHDOG #ifdef ENABLE_WATCHDOG
wdt_disable();
wdt_reset();
// Enable the internal watchdog // Enable the internal watchdog
ESP.wdtEnable(WATCHDOG_TIMEOUT_MS); wdt_enable(WATCHDOG_TIMEOUT_MS);
debug("Watchdog enabled");
#endif #endif
#endif #endif
} }
@ -358,7 +362,7 @@ void criticalBatCheck() {
void loop() { void loop() {
#ifdef ENABLE_WATCHDOG #ifdef ENABLE_WATCHDOG
ESP.wdtFeed(); WDT_FEED();
#endif #endif
#ifdef BATTERY_POWERED #ifdef BATTERY_POWERED