File tree Expand file tree Collapse file tree 2 files changed +4
-21
lines changed Expand file tree Collapse file tree 2 files changed +4
-21
lines changed Original file line number Diff line number Diff line change 30
30
#include "lib/oofatfs/ff.h"
31
31
#include "py/mpconfig.h"
32
32
#include "py/mpstate.h"
33
+ #include "py/runtime.h"
33
34
34
35
#include "supervisor/shared/status_leds.h"
35
36
@@ -45,16 +46,7 @@ int mp_hal_stdin_rx_chr(void) {
45
46
#ifdef MICROPY_VM_HOOK_LOOP
46
47
MICROPY_VM_HOOK_LOOP
47
48
#endif
48
- // Check to see if we've been CTRL-Ced by autoreload or the user.
49
- if (MP_STATE_VM (mp_pending_exception ) == MP_OBJ_FROM_PTR (& MP_STATE_VM (mp_kbd_exception ))) {
50
- // clear exception and generate stacktrace
51
- MP_STATE_VM (mp_pending_exception ) = MP_OBJ_NULL ;
52
- nlr_raise (& MP_STATE_VM (mp_kbd_exception ));
53
- }
54
- if (MP_STATE_VM (mp_pending_exception ) == MP_OBJ_FROM_PTR (& MP_STATE_VM (mp_reload_exception )) || WATCHDOG_EXCEPTION_CHECK ()) {
55
- // stop reading immediately
56
- return EOF ;
57
- }
49
+ mp_handle_pending ();
58
50
if (serial_bytes_available ()) {
59
51
toggle_rx_led ();
60
52
return serial_read ();
Original file line number Diff line number Diff line change 27
27
#include "supervisor/shared/tick.h"
28
28
29
29
#include "py/mpstate.h"
30
+ #include "py/runtime.h"
30
31
#include "supervisor/linker.h"
31
32
#include "supervisor/filesystem.h"
32
33
#include "supervisor/background_callback.h"
@@ -149,17 +150,7 @@ void mp_hal_delay_ms(mp_uint_t delay) {
149
150
while (remaining > 0 ) {
150
151
RUN_BACKGROUND_TASKS ;
151
152
// Check to see if we've been CTRL-Ced by autoreload or the user.
152
- if (MP_STATE_VM (mp_pending_exception ) == MP_OBJ_FROM_PTR (& MP_STATE_VM (mp_kbd_exception )))
153
- {
154
- // clear exception and generate stacktrace
155
- MP_STATE_VM (mp_pending_exception ) = MP_OBJ_NULL ;
156
- nlr_raise (& MP_STATE_VM (mp_kbd_exception ));
157
- }
158
- if ( MP_STATE_VM (mp_pending_exception ) == MP_OBJ_FROM_PTR (& MP_STATE_VM (mp_reload_exception )) ||
159
- WATCHDOG_EXCEPTION_CHECK ()) {
160
- // stop sleeping immediately
161
- break ;
162
- }
153
+ mp_handle_pending ();
163
154
remaining = end_tick - port_get_raw_ticks (NULL );
164
155
// We break a bit early so we don't risk setting the alarm before the time when we call
165
156
// sleep.
You can’t perform that action at this time.
0 commit comments