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):
ymax = max(ymax, line.current_y)
# Compute duration
if line.command in ["G1", "G0", "G4"]:
if line.command == "G4":
moveduration = P(line)
if moveduration:
moveduration /= 1000.0
totalduration += moveduration
else:
if line.command == "G0" or line.command == "G1":
x = line.x if line.x is not None else lastx
y = line.y if line.y is not None else lasty
z = line.z if line.z is not None else lastz
......@@ -558,6 +552,11 @@ class GCode(object):
lastz = z
laste = e
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"
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