Commit 23e7c661 authored by Guillaume Seguin's avatar Guillaume Seguin

Simplify nesting in gcode duration estimation code

parent 07cf32d6
...@@ -492,13 +492,7 @@ class GCode(object): ...@@ -492,13 +492,7 @@ class GCode(object):
ymax = max(ymax, line.current_y) ymax = max(ymax, line.current_y)
# Compute duration # Compute duration
if line.command in ["G1", "G0", "G4"]: if line.command == "G0" or line.command == "G1":
if line.command == "G4":
moveduration = P(line)
if moveduration:
moveduration /= 1000.0
totalduration += moveduration
else:
x = line.x if line.x is not None else lastx x = line.x if line.x is not None else lastx
y = line.y if line.y is not None else lasty y = line.y if line.y is not None else lasty
z = line.z if line.z is not None else lastz z = line.z if line.z is not None else lastz
...@@ -558,6 +552,11 @@ class GCode(object): ...@@ -558,6 +552,11 @@ class GCode(object):
lastz = z lastz = z
laste = e laste = e
lastf = f lastf = f
elif line.command == "G4":
moveduration = P(line)
if moveduration:
moveduration /= 1000.0
totalduration += moveduration
# FIXME : looks like this needs to be tested with "lift Z on move" # FIXME : looks like this needs to be tested with "lift Z on move"
if line.z is not None: if line.z is not None:
......
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