Revert last change and fix another way the timing

parent 4584cef1
......@@ -724,9 +724,7 @@ class GCode(object):
self.duration = totaltime
def idxs(self, i):
if i in self.layer_idxs and i in self.line_idxs:
return self.layer_idxs[i], self.line_idxs[i]
return None, None
return self.layer_idxs[i], self.line_idxs[i]
def estimate_duration(self):
return self.layers_count, self.duration
......
......@@ -551,10 +551,7 @@ class printcore():
if self.preprintsendcb:
if self.queueindex + 1 < len(self.mainqueue):
(next_layer, next_line) = self.mainqueue.idxs(self.queueindex + 1)
try:
next_gline = self.mainqueue.all_layers[next_layer][next_line]
except:
next_gline = None
next_gline = self.mainqueue.all_layers[next_layer][next_line]
else:
next_gline = None
gline = self.preprintsendcb(gline, next_gline)
......
......@@ -172,9 +172,11 @@ class RemainingTimeEstimator(object):
return (0, 0)
if idx == self.last_idx:
return self.last_estimate
layer, line = self.gcode.idxs(idx)
if layer is None or line is None:
return (0, total)
try:
layer, line = self.gcode.idxs(idx)
except:
self.last_idx = idx
return (0, total)
layer_progress = (1 - (float(line + 1) / self.current_layer_lines))
remaining = layer_progress * self.current_layer_estimate + self.remaining_layers_estimate
estimate = self.drift * remaining
......
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