mirror of
https://github.com/andreili/katapult.git
synced 2025-08-24 03:44:06 +02:00
flash_can: reduce error output
Don't log read exceptions for each iteration, only log when the exception differs. Log timeout exceptions separately. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
d6d5c6cc9c
commit
ffd8ac60f7
@ -127,6 +127,7 @@ class CanFlasher:
|
|||||||
crc = crc16_ccitt(out_cmd[2:])
|
crc = crc16_ccitt(out_cmd[2:])
|
||||||
out_cmd.extend(struct.pack("<H", crc))
|
out_cmd.extend(struct.pack("<H", crc))
|
||||||
out_cmd.extend(CMD_TRAILER)
|
out_cmd.extend(CMD_TRAILER)
|
||||||
|
err = Exception()
|
||||||
while tries:
|
while tries:
|
||||||
data = bytearray()
|
data = bytearray()
|
||||||
recd_len = 0
|
recd_len = 0
|
||||||
@ -143,8 +144,14 @@ class CanFlasher:
|
|||||||
recd_len = data[3] * 4
|
recd_len = data[3] * 4
|
||||||
read_done = len(data) == recd_len + 8
|
read_done = len(data) == recd_len + 8
|
||||||
break
|
break
|
||||||
|
except asyncio.TimeoutError:
|
||||||
except Exception:
|
logging.info(
|
||||||
|
f"Response for command {cmdname} timed out, "
|
||||||
|
f"{tries - 1} tries remaining"
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
if type(e) != type(err) or str(e) != str(err):
|
||||||
|
err = e
|
||||||
logging.exception("Can Read Error")
|
logging.exception("Can Read Error")
|
||||||
else:
|
else:
|
||||||
trailer = data[-2:]
|
trailer = data[-2:]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user