Commit 27f7e1de authored by Markus Hitter's avatar Markus Hitter

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.
parent d94bc0ca
......@@ -147,13 +147,19 @@ class printcore():
pass
#callback for errors
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"):
try:
toresend=int(line.replace("N:"," ").replace("N"," ").replace(":"," ").split()[-1])
except:
if line.startswith("rs"):
toresend=int(line.split()[1])
self.resendfrom=toresend
line=line.replace("N:"," ").replace("N"," ").replace(":"," ")
linewords=line.split()
while len(linewords) != 0:
try:
toresend=int(linewords.pop(0))
self.resendfrom=toresend
#print str(toresend)
break
except:
pass
self.clear=True
self.clear=True
#callback for disconnect
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment