diff options
| author | DavePutz <dwputz@gmail.com> | 2020-06-19 19:02:43 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-19 19:02:43 -0500 |
| commit | 0b52359190490ab4a821d3998ce053a6fb23f28c (patch) | |
| tree | 7adf1f5545278a185e2821d0c30d69a12cdd96d3 | |
| parent | e381f593ff2071d8f40c7cd049fbdb924b3c1faa (diff) | |
Generate stacktrace and reset exception for ctrl-c interrupt
Added code in mp_hal_delay_ms() to generate stacktrace and reset exception for ctrl-c interrupt
| -rw-r--r-- | supervisor/shared/tick.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 47395bd60..001db0f35 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -105,6 +105,12 @@ void mp_hal_delay_ms(mp_uint_t delay) { 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)) || WATCHDOG_EXCEPTION_CHECK()) { + 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_obj_new_exception(&mp_type_KeyboardInterrupt)); + } break; } remaining = end_tick - port_get_raw_ticks(NULL); |
