ports/rp2: Improve script execution and exception handling.

This commit is contained in:
iabdalkader 2023-04-07 15:37:09 +02:00
parent edcdd634f9
commit a9e52acdf1

View File

@ -267,15 +267,23 @@ soft_reset:
usbdbg_set_irq_enabled(true);
// Execute the script.
pyexec_str(usbdbg_get_script(), true);
// Disable IDE interrupts
usbdbg_set_irq_enabled(false);
nlr_pop();
} else {
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
}
}
if (usbdbg_is_busy() && nlr_push(&nlr) == 0) {
// Enable IDE interrupt
usbdbg_set_irq_enabled(true);
// Wait for the current command to finish.
usbdbg_wait_for_command(1000);
// Disable IDE interrupts
usbdbg_set_irq_enabled(false);
nlr_pop();
}
}
mp_printf(MP_PYTHON_PRINTER, "MPY: soft reboot\n");
#if MICROPY_PY_AUDIO