Skip to content

Commit c2aa54a

Browse files
committed
Check for Ctrl-C during sleeps
1 parent 2b4d12a commit c2aa54a

File tree

1 file changed

+10
-1
lines changed
  • ports/esp32s2/supervisor

1 file changed

+10
-1
lines changed

ports/esp32s2/supervisor/port.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,16 @@ void port_sleep_until_interrupt(void) {
203203
if (sleep_time_duration == 0) {
204204
return;
205205
}
206-
vTaskDelayUntil(&sleep_time_set, sleep_time_duration);
206+
// Need to run in a loop in order to check if CTRL-C was received
207+
TickType_t start_ticks = 0;
208+
while (sleep_time_duration > start_ticks ) {
209+
vTaskDelayUntil(&sleep_time_set, 1);
210+
if ( mp_hal_is_interrupted() ) {
211+
mp_handle_pending();
212+
}
213+
start_ticks = start_ticks + 1;
214+
}
215+
207216
}
208217

209218

0 commit comments

Comments
 (0)