mirror of https://github.com/Desuuuu/klipper.git
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>
This commit is contained in:
parent
21597f9b07
commit
46355f903e
|
@ -264,15 +264,16 @@ class ToolHead:
|
||||||
flush_to_time = self.print_time - self.move_flush_time
|
flush_to_time = self.print_time - self.move_flush_time
|
||||||
for m in self.all_mcus:
|
for m in self.all_mcus:
|
||||||
m.flush_moves(flush_to_time)
|
m.flush_moves(flush_to_time)
|
||||||
def get_next_move_time(self):
|
def _calc_print_time(self):
|
||||||
if not self.sync_print_time:
|
|
||||||
return self.print_time
|
|
||||||
self.sync_print_time = False
|
|
||||||
est_print_time = self.mcu.estimated_print_time(self.reactor.monotonic())
|
est_print_time = self.mcu.estimated_print_time(self.reactor.monotonic())
|
||||||
if est_print_time + self.buffer_time_start > self.print_time:
|
if est_print_time + self.buffer_time_start > self.print_time:
|
||||||
self.print_time = est_print_time + self.buffer_time_start
|
self.print_time = est_print_time + self.buffer_time_start
|
||||||
self.last_print_start_time = self.print_time
|
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
|
return self.print_time
|
||||||
def _flush_lookahead(self, must_sync=False):
|
def _flush_lookahead(self, must_sync=False):
|
||||||
sync_print_time = self.sync_print_time
|
sync_print_time = self.sync_print_time
|
||||||
|
@ -287,11 +288,13 @@ class ToolHead:
|
||||||
m.flush_moves(self.print_time)
|
m.flush_moves(self.print_time)
|
||||||
def get_last_move_time(self):
|
def get_last_move_time(self):
|
||||||
self._flush_lookahead()
|
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.):
|
def reset_print_time(self, min_print_time=0.):
|
||||||
self._flush_lookahead(must_sync=True)
|
self._flush_lookahead(must_sync=True)
|
||||||
self.print_time = max(min_print_time, self.mcu.estimated_print_time(
|
est_print_time = self.mcu.estimated_print_time(self.reactor.monotonic())
|
||||||
self.reactor.monotonic()))
|
self.print_time = max(min_print_time, est_print_time)
|
||||||
def _check_stall(self):
|
def _check_stall(self):
|
||||||
eventtime = self.reactor.monotonic()
|
eventtime = self.reactor.monotonic()
|
||||||
if self.sync_print_time:
|
if self.sync_print_time:
|
||||||
|
|
Loading…
Reference in New Issue