mirror of
https://github.com/andreili/katapult.git
synced 2025-08-24 03:44:06 +02:00
flash_can: attempt to reset the mcu if an error is encountered
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
c5163674ed
commit
95e8a707ca
@ -165,6 +165,11 @@ class CanFlasher:
|
|||||||
)
|
)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
if tries:
|
if tries:
|
||||||
|
# clear the read buffer
|
||||||
|
try:
|
||||||
|
await self.node.read(2048, timeout=.1)
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
pass
|
||||||
output_line("\nRead Timeout, Retrying...")
|
output_line("\nRead Timeout, Retrying...")
|
||||||
else:
|
else:
|
||||||
if len(buf) == self.block_size:
|
if len(buf) == self.block_size:
|
||||||
@ -383,10 +388,15 @@ class CanSocket:
|
|||||||
node = self._set_node_id(uuid)
|
node = self._set_node_id(uuid)
|
||||||
flasher = CanFlasher(node, fw_path)
|
flasher = CanFlasher(node, fw_path)
|
||||||
await asyncio.sleep(.5)
|
await asyncio.sleep(.5)
|
||||||
await flasher.connect_btl()
|
try:
|
||||||
await flasher.send_file()
|
await flasher.connect_btl()
|
||||||
await flasher.verify_file()
|
await flasher.send_file()
|
||||||
await flasher.finish()
|
await flasher.verify_file()
|
||||||
|
finally:
|
||||||
|
# always attempt to send the complete command. If
|
||||||
|
# there is an error it will exit the bootloader
|
||||||
|
# unless comms were broken
|
||||||
|
await flasher.finish()
|
||||||
|
|
||||||
async def run_query(self, intf: str):
|
async def run_query(self, intf: str):
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user