aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-10-15 18:24:15 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-10-15 18:24:15 -0400
commit46355f903eb8d13448633045346051bc68c1279b (patch)
tree2320b72db5fa114c1e7d2d654352fed2180402ec /klippy/toolhead.py
parent21597f9b0749eeb0e291bf1b9de1fed06037bfcf (diff)
downloadkutter-46355f903eb8d13448633045346051bc68c1279b.tar.gz
kutter-46355f903eb8d13448633045346051bc68c1279b.tar.xz
kutter-46355f903eb8d13448633045346051bc68c1279b.zip
toolhead: Don't clear sync_print_time on a get_next_move_time() call
Only clear the internal sync_print_time flag if the code performs a regular "lazy" flush of the look-ahead queue. This helps build the look-ahead queue even when running internal scripts. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r--klippy/toolhead.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index ad1141f0..dff6e3fa 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -264,15 +264,16 @@ class ToolHead:
flush_to_time = self.print_time - self.move_flush_time
for m in self.all_mcus:
m.flush_moves(flush_to_time)
- def get_next_move_time(self):
- if not self.sync_print_time:
- return self.print_time
- self.sync_print_time = False
+ def _calc_print_time(self):
est_print_time = self.mcu.estimated_print_time(self.reactor.monotonic())
if est_print_time + self.buffer_time_start > self.print_time:
self.print_time = est_print_time + self.buffer_time_start
self.last_print_start_time = self.print_time
- self.reactor.update_timer(self.flush_timer, self.reactor.NOW)
+ def get_next_move_time(self):
+ if self.sync_print_time:
+ self.sync_print_time = False
+ self.reactor.update_timer(self.flush_timer, self.reactor.NOW)
+ self._calc_print_time()
return self.print_time
def _flush_lookahead(self, must_sync=False):
sync_print_time = self.sync_print_time
@@ -287,11 +288,13 @@ class ToolHead:
m.flush_moves(self.print_time)
def get_last_move_time(self):
self._flush_lookahead()
- return self.get_next_move_time()
+ if self.sync_print_time:
+ self._calc_print_time()
+ return self.print_time
def reset_print_time(self, min_print_time=0.):
self._flush_lookahead(must_sync=True)
- self.print_time = max(min_print_time, self.mcu.estimated_print_time(
- self.reactor.monotonic()))
+ est_print_time = self.mcu.estimated_print_time(self.reactor.monotonic())
+ self.print_time = max(min_print_time, est_print_time)
def _check_stall(self):
eventtime = self.reactor.monotonic()
if self.sync_print_time: