From ad6ab5a78c207cb663dfb82255798c4cfad51b5f Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 13 Feb 2024 16:01:28 +1100 Subject: [PATCH] lora-sync: 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 +- micropython/lora/lora-sync/manifest.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/micropython/lora/lora-sync/lora/sync_modem.py b/micropython/lora/lora-sync/lora/sync_modem.py index 27c2f19..585ae2c 100644 --- a/micropython/lora/lora-sync/lora/sync_modem.py +++ b/micropython/lora/lora-sync/lora/sync_modem.py @@ -42,8 +42,8 @@ class SyncModem: 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): diff --git a/micropython/lora/lora-sync/manifest.py b/micropython/lora/lora-sync/manifest.py index 57b9d21..1936a50 100644 --- a/micropython/lora/lora-sync/manifest.py +++ b/micropython/lora/lora-sync/manifest.py @@ -1,3 +1,3 @@ -metadata(version="0.1.0") +metadata(version="0.1.1") require("lora") package("lora")