From 8a833175a534fcb33e5c78f8d8787a5d18c1274f Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 2 Sep 2025 13:23:02 -0400 Subject: [PATCH] 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 --- klippy/extras/motion_queuing.py | 11 +++++------ klippy/toolhead.py | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/klippy/extras/motion_queuing.py b/klippy/extras/motion_queuing.py index 0b0981f1..9d2ef513 100644 --- a/klippy/extras/motion_queuing.py +++ b/klippy/extras/motion_queuing.py @@ -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) diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 877e4f34..cf648695 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -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()