mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
ports/rp2: Improve script execution and exception handling.
This commit is contained in:
parent
edcdd634f9
commit
a9e52acdf1
@ -267,16 +267,24 @@ soft_reset:
|
|||||||
usbdbg_set_irq_enabled(true);
|
usbdbg_set_irq_enabled(true);
|
||||||
// Execute the script.
|
// Execute the script.
|
||||||
pyexec_str(usbdbg_get_script(), true);
|
pyexec_str(usbdbg_get_script(), true);
|
||||||
|
// Disable IDE interrupts
|
||||||
|
usbdbg_set_irq_enabled(false);
|
||||||
nlr_pop();
|
nlr_pop();
|
||||||
} else {
|
} else {
|
||||||
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
usbdbg_wait_for_command(1000);
|
|
||||||
|
|
||||||
usbdbg_set_irq_enabled(false);
|
|
||||||
|
|
||||||
mp_printf(MP_PYTHON_PRINTER, "MPY: soft reboot\n");
|
mp_printf(MP_PYTHON_PRINTER, "MPY: soft reboot\n");
|
||||||
#if MICROPY_PY_AUDIO
|
#if MICROPY_PY_AUDIO
|
||||||
py_audio_deinit();
|
py_audio_deinit();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user