Skip to content

Commit

Permalink
sync_modem: Fix race with fast or failed send().
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
projectgus committed Feb 13, 2024
1 parent bb285ae commit 5c34ec2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion micropython/lora/lora-sync/lora/sync_modem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 5c34ec2

Please sign in to comment.