mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
ports/stm32: Improve script execution and exceptions handling.
This commit is contained in:
parent
a9e52acdf1
commit
2d46e31e8a
@ -607,25 +607,35 @@ soft_reset:
|
|||||||
if (usbdbg_script_ready()) {
|
if (usbdbg_script_ready()) {
|
||||||
nlr_buf_t nlr;
|
nlr_buf_t nlr;
|
||||||
if (nlr_push(&nlr) == 0) {
|
if (nlr_push(&nlr) == 0) {
|
||||||
|
// Enable IDE interrupts
|
||||||
|
usbdbg_set_irq_enabled(true);
|
||||||
|
#if OMV_ENABLE_WIFIDBG && MICROPY_PY_WINC1500
|
||||||
|
wifidbg_set_irq_enabled(openmv_config.wifidbg);
|
||||||
|
#endif
|
||||||
|
// 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
|
// Enable IDE interrupt
|
||||||
usbdbg_set_irq_enabled(true);
|
usbdbg_set_irq_enabled(true);
|
||||||
#if OMV_ENABLE_WIFIDBG && MICROPY_PY_WINC1500
|
#if OMV_ENABLE_WIFIDBG && MICROPY_PY_WINC1500
|
||||||
wifidbg_set_irq_enabled(openmv_config.wifidbg);
|
wifidbg_set_irq_enabled(openmv_config.wifidbg);
|
||||||
#endif
|
#endif
|
||||||
|
// Wait for the current command to finish.
|
||||||
// Execute the script.
|
usbdbg_wait_for_command(1000);
|
||||||
pyexec_str(usbdbg_get_script(), true);
|
// Disable IDE interrupts
|
||||||
|
usbdbg_set_irq_enabled(false);
|
||||||
nlr_pop();
|
nlr_pop();
|
||||||
} else {
|
|
||||||
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (openmv_config.wifidbg == true);
|
|
||||||
|
|
||||||
nlr_buf_t nlr;
|
} while (openmv_config.wifidbg == true);
|
||||||
if (nlr_push(&nlr) == 0) {
|
|
||||||
usbdbg_wait_for_command(1000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// soft reset
|
// soft reset
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user