Skip to content

Commit

Permalink
Swap WDT timeout to milliseconds in haltError to match Arch differere…
Browse files Browse the repository at this point in the history
…nces
  • Loading branch information
tyeth committed Dec 19, 2024
1 parent 04dbf36 commit f87a208
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Wippersnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2494,15 +2494,19 @@ void Wippersnapper::runNetFSM() {
@brief Prints an error to the serial and halts the hardware until
the WDT bites.
@param error
The desired error to print to serial.
The error to print to serial.
@param ledStatusColor
The desired color to blink.
The color to blink.
@param seconds_until_reboot
The amount of time to wait before rebooting.
*/
/**************************************************************************/
void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor,
uint8_t seconds_until_reboot) {
uint8_t wdt_timeout = 5; // future platform-specific differences
int seconds_until_wdt_enable = seconds_until_reboot - wdt_timeout;
uint8_t wdt_timeout_ms = 5000; // future platform-specific differences
int seconds_until_wdt_enable =
seconds_until_reboot - (int)(wdt_timeout_ms / 1000);

for (int i = 0;; i++) {
WS_DEBUG_PRINT("ERROR [WDT RESET IN ");
WS_DEBUG_PRINT(seconds_until_reboot - i);
Expand All @@ -2521,7 +2525,7 @@ void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor,
yield();
WS.feedWDT(); // feed the WDT for the first 20 seconds
} else if (i == seconds_until_reboot) {
WS.enableWDT(wdt_timeout * 1000);
WS.enableWDT(wdt_timeout_ms);
}
}
}
Expand Down

0 comments on commit f87a208

Please sign in to comment.