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
This commit is contained in:
parent
e381f593ff
commit
0b52359190
@ -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)) ||
|
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_reload_exception)) ||
|
||||||
WATCHDOG_EXCEPTION_CHECK()) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
remaining = end_tick - port_get_raw_ticks(NULL);
|
remaining = end_tick - port_get_raw_ticks(NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user