Improved wdt code

This commit is contained in:
Kai Lauterbach 2023-01-09 12:07:01 +01:00
parent a05af95d51
commit 0f6934f4a1
1 changed files with 6 additions and 2 deletions

View File

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