From 5c34ec2f9b3554e82b5efab42d3e5ac25112651c Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 13 Feb 2024 16:01:28 +1100 Subject: [PATCH] sync_modem: Fix race with fast or failed send(). If send completes before the first call to poll_send(), the driver could get stuck in _sync_wait(). This had much less impact before rp2 port went tickless, as _sync_wait(will_irq=True) calls machine.idle() which may not wake very frequently on a tickless port. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton --- micropython/lora/lora-sync/lora/sync_modem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micropython/lora/lora-sync/lora/sync_modem.py b/micropython/lora/lora-sync/lora/sync_modem.py index 27c2f19d1..585ae2cb4 100644 --- a/micropython/lora/lora-sync/lora/sync_modem.py +++ b/micropython/lora/lora-sync/lora/sync_modem.py @@ -42,8 +42,8 @@ def send(self, packet, tx_at_ms=None): tx = True while tx is True: - tx = self.poll_send() self._sync_wait(will_irq) + tx = self.poll_send() return tx def recv(self, timeout_ms=None, rx_length=0xFF, rx_packet=None):