From 4b37c0c82eb5d871cfe6d96ffe459f85ed154f8d Mon Sep 17 00:00:00 2001 From: "Kwabena W. Agyeman" Date: Fri, 22 Dec 2023 13:19:19 -0800 Subject: [PATCH] ports/mimxrt: Service TinyUSB while waiting for sensor frames. --- src/omv/ports/mimxrt/sensor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/omv/ports/mimxrt/sensor.c b/src/omv/ports/mimxrt/sensor.c index 7657c5082..5c9d3d9f6 100644 --- a/src/omv/ports/mimxrt/sensor.c +++ b/src/omv/ports/mimxrt/sensor.c @@ -335,7 +335,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) { vbuffer_t *buffer = framebuffer_get_head(FB_NO_FLAGS); // Wait for the DMA to finish the transfer. for (mp_uint_t ticks = mp_hal_ticks_ms(); buffer == NULL;) { - buffer = framebuffer_get_head(FB_NO_FLAGS); + MICROPY_EVENT_POLL_HOOK if ((mp_hal_ticks_ms() - ticks) > 3000) { sensor_abort(); @@ -347,6 +347,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) { return SENSOR_ERROR_CAPTURE_TIMEOUT; } + buffer = framebuffer_get_head(FB_NO_FLAGS); } // We're done receiving data.