Skip to content

Commit

Permalink
Add custom WDT timeout for ESP8266
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeth committed Dec 19, 2024
1 parent f87a208 commit b594a3b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Wippersnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,11 @@ void Wippersnapper::runNetFSM() {
/**************************************************************************/
void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor,
uint8_t seconds_until_reboot) {
uint8_t wdt_timeout_ms = 5000; // future platform-specific differences
#ifdef ARDUINO_ARCH_ESP8266
uint8_t wdt_timeout_ms = 3200;
#else
uint8_t wdt_timeout_ms = 5000;
#endif
int seconds_until_wdt_enable =
seconds_until_reboot - (int)(wdt_timeout_ms / 1000);

Expand All @@ -2523,7 +2527,7 @@ void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor,
#endif
if (i < seconds_until_wdt_enable) {
yield();
WS.feedWDT(); // feed the WDT for the first 20 seconds
WS.feedWDT(); // feed the WDT for the first X-5 seconds
} else if (i == seconds_until_reboot) {
WS.enableWDT(wdt_timeout_ms);
}
Expand Down

0 comments on commit b594a3b

Please sign in to comment.