flash_can: add retries to verification

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-04-25 17:17:19 -04:00
parent f754ae2746
commit f0d7bb7f9c
No known key found for this signature in database
GPG Key ID: 7027245FBBDDF59A

View File

@ -158,11 +158,16 @@ class CanFlasher:
if resp == i: if resp == i:
# command should ack with the requested block as # command should ack with the requested block as
# parameter # parameter
buf = await self.node.readexactly( try:
self.block_size, timeout=10. buf = await self.node.readexactly(
) self.block_size, timeout=5.
if len(buf) == self.block_size: )
break except asyncio.TimeoutError:
if tries:
output_line("\nRead Timeout, Retrying...")
else:
if len(buf) == self.block_size:
break
tries -= 1 tries -= 1
await asyncio.sleep(.1) await asyncio.sleep(.1)
else: else: