summaryrefslogtreecommitdiff
path: root/supervisor
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-08-27 11:42:31 -0700
committerScott Shawcroft <scott@tannewt.org>2020-08-27 11:42:31 -0700
commit767ca5c3dc80206be1c80d9a07cb18264d3ce961 (patch)
tree8af3e239fce9d778edcd1c986af700d1a3e53337 /supervisor
parent46dc133d04bb6c38faea820576978827edd4337d (diff)
parent24fb08dbd9a16e83aded3f0874bc96fcd0462fea (diff)
Merge remote-tracking branch 'adafruit/main' into native_wifi
Diffstat (limited to 'supervisor')
-rw-r--r--supervisor/shared/micropython.c10
-rw-r--r--supervisor/shared/tick.c13
2 files changed, 12 insertions, 11 deletions
diff --git a/supervisor/shared/micropython.c b/supervisor/shared/micropython.c
index 245db11d4..bbc4807f9 100644
--- a/supervisor/shared/micropython.c
+++ b/supervisor/shared/micropython.c
@@ -29,14 +29,24 @@
#include "supervisor/serial.h"
#include "lib/oofatfs/ff.h"
#include "py/mpconfig.h"
+#include "py/mpstate.h"
+#include "py/runtime.h"
#include "supervisor/shared/status_leds.h"
+#if CIRCUITPY_WATCHDOG
+#include "shared-bindings/watchdog/__init__.h"
+#define WATCHDOG_EXCEPTION_CHECK() (MP_STATE_VM(mp_pending_exception) == &mp_watchdog_timeout_exception)
+#else
+#define WATCHDOG_EXCEPTION_CHECK() 0
+#endif
+
int mp_hal_stdin_rx_chr(void) {
for (;;) {
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
+ mp_handle_pending();
if (serial_bytes_available()) {
toggle_rx_led();
return serial_read();
diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c
index 4af59f78e..f26e1e79d 100644
--- a/supervisor/shared/tick.c
+++ b/supervisor/shared/tick.c
@@ -27,6 +27,7 @@
#include "supervisor/shared/tick.h"
#include "py/mpstate.h"
+#include "py/runtime.h"
#include "supervisor/linker.h"
#include "supervisor/filesystem.h"
#include "supervisor/background_callback.h"
@@ -149,17 +150,7 @@ void mp_hal_delay_ms(mp_uint_t delay) {
while (remaining > 0) {
RUN_BACKGROUND_TASKS;
// 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 sleeping immediately
- break;
- }
+ mp_handle_pending();
remaining = end_tick - port_get_raw_ticks(NULL);
// We break a bit early so we don't risk setting the alarm before the time when we call
// sleep.