diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-06-23 10:58:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-23 10:58:45 -0700 |
| commit | 741e1d98285fb29cbbc15a8cff188d54560747c7 (patch) | |
| tree | 13df09225a139778c701041c2ca50c3d16b8d5db /supervisor | |
| parent | f67b30737132b0172eac836034b938f71271fbb4 (diff) | |
| parent | b80abf1a90b515fff1503b75358e629fb248660c (diff) | |
Merge pull request #3043 from DavePutz/Issue-2865
Issue #2865 -Clean up after ctrl-c interrupt in sleep
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/tick.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 47395bd60..dd7dba8f3 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -102,9 +102,15 @@ void mp_hal_delay_ms(mp_uint_t delay) { while (remaining > 0) { RUN_BACKGROUND_TASKS; // 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)) || + if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception))) + { + // clear exception and generate stacktrace + MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL; + nlr_raise(&MP_STATE_VM(mp_kbd_exception)); + } + if( MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)) || WATCHDOG_EXCEPTION_CHECK()) { + // stop sleeping immediately break; } remaining = end_tick - port_get_raw_ticks(NULL); |
