motion_queuing: Introduce flush_all_steps() helper

Move the "full flush" code from advance_flush_time() to a new
flush_all_steps() method.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2025-09-02 13:23:02 -04:00
parent 5426943501
commit 8a833175a5
2 changed files with 6 additions and 7 deletions

View File

@ -150,11 +150,7 @@ class PrinterMotionQueuing:
self.can_pause = False
def setup_lookahead_flush_callback(self, check_flush_lookahead_cb):
self.check_flush_lookahead_cb = check_flush_lookahead_cb
def advance_flush_time(self, target_time=None, lazy_target=False):
if target_time is None:
# This is a full flush
target_time = self.need_step_gen_time
self.need_calc_kin_flush_delay = True
def advance_flush_time(self, target_time, lazy_target=False):
want_flush_time = want_step_gen_time = target_time
if lazy_target:
# Account for step gen scan windows and optimize step compression
@ -179,6 +175,9 @@ class PrinterMotionQueuing:
self.last_step_gen_time = step_gen_time
if flush_time >= want_flush_time:
break
def flush_all_steps(self):
self.need_calc_kin_flush_delay = True
self.advance_flush_time(self.need_step_gen_time)
def calc_step_gen_restart(self, est_print_time):
if self.need_calc_kin_flush_delay:
self._calc_kin_flush_delay()
@ -236,7 +235,7 @@ class PrinterMotionQueuing:
self.advance_flush_time(flush_time, lazy_target=True)
# Restore background flushing
self.reactor.update_timer(self.flush_timer, self.reactor.NOW)
self.advance_flush_time()
self.advance_flush_time(self.need_step_gen_time)
def load_config(config):
return PrinterMotionQueuing(config)

View File

@ -303,7 +303,7 @@ class ToolHead:
self.check_stall_time = 0.
def flush_step_generation(self):
self._flush_lookahead()
self.motion_queuing.advance_flush_time()
self.motion_queuing.flush_all_steps()
def get_last_move_time(self):
if self.special_queuing_state:
self._flush_lookahead()