diff options
| author | DavePutz <dwputz@gmail.com> | 2021-01-04 15:47:06 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-04 15:47:06 -0600 |
| commit | 76e9f495c744153f10f40992a04256bf8770184b (patch) | |
| tree | 548142ea70d26eb69fd5d3560b2800f297f8098b /supervisor | |
| parent | 9c14593d623181e7b1eb5f5358869977befc1d74 (diff) | |
| parent | f6f1ef7dc26f9e253f09d48a8ec822a2f5e805fb (diff) | |
Merge pull request #37 from adafruit/main
update from adafruit main
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/tick.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index d37a585eb..e51c48c73 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -26,6 +26,7 @@ #include "supervisor/shared/tick.h" +#include "lib/utils/interrupt_char.h" #include "py/mpstate.h" #include "py/runtime.h" #include "supervisor/linker.h" @@ -145,10 +146,11 @@ void mp_hal_delay_ms(mp_uint_t delay) { delay = delay * 1024 / 1000; uint64_t end_tick = start_tick + delay; int64_t remaining = delay; - while (remaining > 0) { + + // Loop until we've waited long enough or we've been CTRL-Ced by autoreload + // or the user. + while (remaining > 0 && !mp_hal_is_interrupted()) { RUN_BACKGROUND_TASKS; - // Check to see if we've been CTRL-Ced by autoreload or the user. - 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. |
