Skip to content

Commit 371f166

Browse files
committed
canio: Run background tasks while waiting for message reception
Closes: #5004
1 parent 6ea1369 commit 371f166

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ports/esp32s2/common-hal/canio/Listener.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ mp_obj_t common_hal_canio_listener_receive(canio_listener_obj_t *self) {
151151
if (supervisor_ticks_ms64() > deadline) {
152152
return NULL;
153153
}
154+
RUN_BACKGROUND_TASKS;
155+
// Allow user to break out of a timeout with a KeyboardInterrupt.
156+
if (mp_hal_is_interrupted()) {
157+
return NULL;
158+
}
154159
} while (!common_hal_canio_listener_in_waiting(self));
155160
}
156161

0 commit comments

Comments
 (0)