timeout on waiting ack

This commit is contained in:
Florent de Lamotte 2025-03-05 20:03:43 +01:00
parent 84aee617d5
commit 5c269bc662

View file

@ -516,9 +516,14 @@ class MeshCore:
""" Wait for a message """
await self.rx_sem.acquire()
async def wait_ack(self):
async def wait_ack(self, timeout=10):
""" Wait ack """
await self.ack_ev.wait()
try:
await asyncio.wait_for(self.ack_ev.wait(), timeout)
return True
except TimeoutError :
printerr("Timeout waiting ack")
return False
async def next_cmd(mc, cmds):
""" process next command """