aboutsummaryrefslogtreecommitdiff
path: root/supervisor/shared/micropython.c
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-08-23 09:03:34 -0500
committerJeff Epler <jepler@gmail.com>2020-08-23 09:12:01 -0500
commit1033e89561d6535f32aa4cfd3541ffd9683a1123 (patch)
tree969e22aae8d60ac59ff27718f5a7d37b7c114c5e /supervisor/shared/micropython.c
parentf8a9e11ff4f42620bbe6e678f009bdadcb4ac542 (diff)
supervisor: use mp_handle_pending to check for exceptions
Diffstat (limited to 'supervisor/shared/micropython.c')
-rw-r--r--supervisor/shared/micropython.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/supervisor/shared/micropython.c b/supervisor/shared/micropython.c
index cd9485f8c..bbc4807f9 100644
--- a/supervisor/shared/micropython.c
+++ b/supervisor/shared/micropython.c
@@ -30,6 +30,7 @@
#include "lib/oofatfs/ff.h"
#include "py/mpconfig.h"
#include "py/mpstate.h"
+#include "py/runtime.h"
#include "supervisor/shared/status_leds.h"
@@ -45,16 +46,7 @@ int mp_hal_stdin_rx_chr(void) {
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
- // Check to see if we've been CTRL-Ced by autoreload or the user.
- 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_STATE_VM(mp_kbd_exception));
- }
- if (MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)) || WATCHDOG_EXCEPTION_CHECK()) {
- // stop reading immediately
- return EOF;
- }
+ mp_handle_pending();
if (serial_bytes_available()) {
toggle_rx_led();
return serial_read();