printcore.py: review resend request line parsing.
The new algorithm mangles the request string as before, but then looks for the first valid number instead of a number in fixed places. This hopefully works for all firmwares. To avoid future regressions, a list of sample strings was started. Feel free to add more samples in.master
parent
d94bc0ca9e
commit
27f7e1de63
18
printcore.py
18
printcore.py
|
@ -147,13 +147,19 @@ class printcore():
|
||||||
pass
|
pass
|
||||||
#callback for errors
|
#callback for errors
|
||||||
pass
|
pass
|
||||||
|
# Teststrings for resend parsing # Firmware exp. result
|
||||||
|
# line="rs N2 Expected checksum 67" # Teacup 2
|
||||||
if line.lower().startswith("resend") or line.startswith("rs"):
|
if line.lower().startswith("resend") or line.startswith("rs"):
|
||||||
try:
|
line=line.replace("N:"," ").replace("N"," ").replace(":"," ")
|
||||||
toresend=int(line.replace("N:"," ").replace("N"," ").replace(":"," ").split()[-1])
|
linewords=line.split()
|
||||||
except:
|
while len(linewords) != 0:
|
||||||
if line.startswith("rs"):
|
try:
|
||||||
toresend=int(line.split()[1])
|
toresend=int(linewords.pop(0))
|
||||||
self.resendfrom=toresend
|
self.resendfrom=toresend
|
||||||
|
#print str(toresend)
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
pass
|
||||||
self.clear=True
|
self.clear=True
|
||||||
self.clear=True
|
self.clear=True
|
||||||
#callback for disconnect
|
#callback for disconnect
|
||||||
|
|
Loading…
Reference in New Issue