Flush read buffer on decode error
This commit is contained in:
parent
9fc8db577a
commit
b168b5120f
1 changed files with 2 additions and 0 deletions
|
@ -359,6 +359,7 @@ if __name__ == "__main__":
|
||||||
except struct.error as e:
|
except struct.error as e:
|
||||||
log(e)
|
log(e)
|
||||||
log("0x0100 Unpack error:", len(res), res)
|
log("0x0100 Unpack error:", len(res), res)
|
||||||
|
log("Flushed from read buffer; ", dev.read(timeout=0.5))
|
||||||
if per_current_hist(now):
|
if per_current_hist(now):
|
||||||
res = readMemory(dev, 0x010B, 21)
|
res = readMemory(dev, 0x010B, 21)
|
||||||
if res:
|
if res:
|
||||||
|
@ -368,6 +369,7 @@ if __name__ == "__main__":
|
||||||
except struct.error as e:
|
except struct.error as e:
|
||||||
log(e)
|
log(e)
|
||||||
log("0x010B Unpack error:", len(res), res)
|
log("0x010B Unpack error:", len(res), res)
|
||||||
|
log("Flushed from read buffer; ", dev.read(timeout=0.5))
|
||||||
# print(".")
|
# print(".")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue