Commit 44e8f055 authored by Guillaume Seguin's avatar Guillaume Seguin

Don't fail miserably when parsing host commands in GCodeAnalyzer

parent 016cb3e2
...@@ -70,9 +70,14 @@ class GCodeAnalyzer(): ...@@ -70,9 +70,14 @@ class GCodeAnalyzer():
gline = gcoder.Line(gcode) gline = gcoder.Line(gcode)
split_raw = gcoder.split(gline) split_raw = gcoder.split(gline)
if gline.command.startswith(";@"): return # code is a host command if gline.command.startswith(";@"): return # code is a host command
gcoder.parse_coordinates(gline, split_raw, self.imperial) try:
code_g = int(gline.command[1:]) if gline.command.startswith("G") else None code_g = int(gline.command[1:]) if gline.command.startswith("G") else None
code_m = int(gline.command[1:]) if gline.command.startswith("M") else None code_m = int(gline.command[1:]) if gline.command.startswith("M") else None
except ValueError:
# If we fail to parse the code number, this is probably not a
# standard G-Code but rather a host command, so return immediately
return
gcoder.parse_coordinates(gline, split_raw, self.imperial)
#get movement codes #get movement codes
if gline.is_move: if gline.is_move:
......
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