supervisor: tick: check for watchdog exception if enabled
Check to see if the current exception is a Watchdog exception, if it's enabled. This ensures we break out of the current sleep() if a watchdog timeout hits. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
bd086a102e
commit
15530a69c7
|
@ -86,6 +86,13 @@ void PLACE_IN_ITCM(supervisor_run_background_tasks_if_tick)() {
|
|||
run_background_tasks();
|
||||
}
|
||||
|
||||
#ifdef CIRCUITPY_WATCHDOG
|
||||
extern mp_obj_exception_t mp_watchdog_timeout_exception;
|
||||
#define WATCHDOG_EXCEPTION_CHECK() (MP_STATE_VM(mp_pending_exception) == &mp_watchdog_timeout_exception)
|
||||
#else
|
||||
#define WATCHDOG_EXCEPTION_CHECK() 0
|
||||
#endif
|
||||
|
||||
void mp_hal_delay_ms(mp_uint_t delay) {
|
||||
uint64_t start_tick = port_get_raw_ticks(NULL);
|
||||
// Adjust the delay to ticks vs ms.
|
||||
|
@ -97,7 +104,7 @@ void mp_hal_delay_ms(mp_uint_t delay) {
|
|||
// Check to see if we've been CTRL-Ced by autoreload or the user.
|
||||
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)) ||
|
||||
MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)) ||
|
||||
MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_watchdog_exception))) {
|
||||
WATCHDOG_EXCEPTION_CHECK()) {
|
||||
break;
|
||||
}
|
||||
remaining = end_tick - port_get_raw_ticks(NULL);
|
||||
|
|
Loading…
Reference in New Issue