Skip to content

Commit 068aa28

Browse files
robert-hhdpgeorge
authored andcommitted
rp2/machine_uart: Fix event wait in uart.flush() and uart.read().
Do not wait in the worst case up to the timeout. Fixes issue #13377. Signed-off-by: robert-hh <robert@hammelrath.com>
1 parent d5f3fcd commit 068aa28

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ports/rp2/machine_uart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
483483
return i;
484484
}
485485
}
486-
mp_event_wait_ms(timeout - elapsed);
486+
mp_event_handle_nowait();
487487
}
488488
*dest++ = ringbuf_get(&(self->read_buffer));
489489
start = mp_hal_ticks_ms(); // Inter-character timeout
@@ -559,7 +559,7 @@ STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uint
559559
if (now >= timeout) {
560560
break;
561561
}
562-
mp_event_wait_ms((timeout - now) / 1000);
562+
mp_event_handle_nowait();
563563
}
564564
*errcode = MP_ETIMEDOUT;
565565
ret = MP_STREAM_ERROR;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy