Commit 79d59e80 authored by Guillaume Seguin's avatar Guillaume Seguin

Make gcode parser more resilient to malformed lines

parent 7872fa46
...@@ -63,6 +63,11 @@ def P(line): ...@@ -63,6 +63,11 @@ def P(line):
def split(line): def split(line):
split_raw = gcode_exp.findall(line.raw.lower()) split_raw = gcode_exp.findall(line.raw.lower())
if not split_raw:
line.command = line.raw
line.is_move = False
print "Warning: raw line \"%s\" could not be parsed" % line.raw
return line.raw
command = split_raw[0] if split_raw[0][0] != "n" else split_raw[1] command = split_raw[0] if split_raw[0][0] != "n" else split_raw[1]
line.command = command[0].upper() + command[1] line.command = command[0].upper() + command[1]
line.is_move = line.command in move_gcodes line.is_move = line.command in move_gcodes
......
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