Commit ee16eeba authored by Guillaume Seguin's avatar Guillaume Seguin

Buffer GCode duration

parent 1d6157c7
...@@ -137,6 +137,7 @@ class GCode(object): ...@@ -137,6 +137,7 @@ class GCode(object):
# current abs X in machine current coordinate system: current_x - offset_x # current abs X in machine current coordinate system: current_x - offset_x
filament_length = None filament_length = None
duration = None
xmin = None xmin = None
xmax = None xmax = None
ymin = None ymin = None
...@@ -464,6 +465,8 @@ class GCode(object): ...@@ -464,6 +465,8 @@ class GCode(object):
self.height = self.zmax - self.zmin self.height = self.zmax - self.zmin
def estimate_duration(self): def estimate_duration(self):
if self.duration is not None:
return self.duration
lastx = lasty = lastz = laste = lastf = 0.0 lastx = lasty = lastz = laste = lastf = 0.0
lastdx = 0 lastdx = 0
lastdy = 0 lastdy = 0
...@@ -552,6 +555,7 @@ class GCode(object): ...@@ -552,6 +555,7 @@ class GCode(object):
layerbeginduration = totalduration layerbeginduration = totalduration
totaltime = datetime.timedelta(seconds = int(totalduration)) totaltime = datetime.timedelta(seconds = int(totalduration))
self.duration = totaltime
return "%d layers, %s" % (len(self.layers), str(totaltime)) return "%d layers, %s" % (len(self.layers), str(totaltime))
def main(): def main():
......
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