Skip to content

Commit f87a208

Browse files
committed
Swap WDT timeout to milliseconds in haltError to match Arch differerences
1 parent 04dbf36 commit f87a208

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/Wippersnapper.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,15 +2494,19 @@ void Wippersnapper::runNetFSM() {
24942494
@brief Prints an error to the serial and halts the hardware until
24952495
the WDT bites.
24962496
@param error
2497-
The desired error to print to serial.
2497+
The error to print to serial.
24982498
@param ledStatusColor
2499-
The desired color to blink.
2499+
The color to blink.
2500+
@param seconds_until_reboot
2501+
The amount of time to wait before rebooting.
25002502
*/
25012503
/**************************************************************************/
25022504
void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor,
25032505
uint8_t seconds_until_reboot) {
2504-
uint8_t wdt_timeout = 5; // future platform-specific differences
2505-
int seconds_until_wdt_enable = seconds_until_reboot - wdt_timeout;
2506+
uint8_t wdt_timeout_ms = 5000; // future platform-specific differences
2507+
int seconds_until_wdt_enable =
2508+
seconds_until_reboot - (int)(wdt_timeout_ms / 1000);
2509+
25062510
for (int i = 0;; i++) {
25072511
WS_DEBUG_PRINT("ERROR [WDT RESET IN ");
25082512
WS_DEBUG_PRINT(seconds_until_reboot - i);
@@ -2521,7 +2525,7 @@ void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor,
25212525
yield();
25222526
WS.feedWDT(); // feed the WDT for the first 20 seconds
25232527
} else if (i == seconds_until_reboot) {
2524-
WS.enableWDT(wdt_timeout * 1000);
2528+
WS.enableWDT(wdt_timeout_ms);
25252529
}
25262530
}
25272531
}

0 commit comments

Comments
 (0)