diff --git a/klippy/extras/input_shaper.py b/klippy/extras/input_shaper.py index cb9027d98..c79cdcf2c 100644 --- a/klippy/extras/input_shaper.py +++ b/klippy/extras/input_shaper.py @@ -138,6 +138,7 @@ class InputShaper: if self.toolhead is None: # Klipper initialization is not yet completed return + self.toolhead.flush_step_generation() ffi_main, ffi_lib = chelper.get_ffi() kin = self.toolhead.get_kinematics() for s in kin.get_steppers(): @@ -146,8 +147,9 @@ class InputShaper: is_sk = self._get_input_shaper_stepper_kinematics(s) if is_sk is None: continue - self.toolhead.flush_step_generation() ffi_lib.input_shaper_update_sk(is_sk) + motion_queuing = self.printer.lookup_object("motion_queuing") + motion_queuing.check_step_generation_scan_windows() def _update_input_shaping(self, error=None): self.toolhead.flush_step_generation() ffi_main, ffi_lib = chelper.get_ffi() @@ -164,6 +166,8 @@ class InputShaper: continue if not shaper.set_shaper_kinematics(is_sk): failed_shapers.append(shaper) + motion_queuing = self.printer.lookup_object("motion_queuing") + motion_queuing.check_step_generation_scan_windows() if failed_shapers: error = error or self.printer.command_error raise error("Failed to configure shaper(s) %s with given parameters" diff --git a/klippy/extras/motion_queuing.py b/klippy/extras/motion_queuing.py index a61ba5cc0..99035f06f 100644 --- a/klippy/extras/motion_queuing.py +++ b/klippy/extras/motion_queuing.py @@ -50,7 +50,6 @@ class PrinterMotionQueuing: if self.mcu.is_fileoutput(): self.can_pause = False # Kinematic step generation scan window time tracking - self.need_calc_kin_flush_delay = True self.kin_flush_delay = SDS_CHECK_TIME # Register handlers printer.register_event_handler("klippy:shutdown", self._handle_shutdown) @@ -129,8 +128,7 @@ class PrinterMotionQueuing: # Kinematic step generation scan window time tracking def get_kin_flush_delay(self): return self.kin_flush_delay - def _calc_kin_flush_delay(self): - self.need_calc_kin_flush_delay = False + def check_step_generation_scan_windows(self): ffi_main, ffi_lib = chelper.get_ffi() kin_flush_delay = SDS_CHECK_TIME for mcu, sc in self.stepcompress: @@ -175,11 +173,8 @@ class PrinterMotionQueuing: 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() kin_time = max(est_print_time + MIN_KIN_TIME, self.last_step_gen_time) return kin_time + self.kin_flush_delay def _flush_handler(self, eventtime): diff --git a/klippy/kinematics/extruder.py b/klippy/kinematics/extruder.py index 4e6f14e41..9b1ec2d20 100644 --- a/klippy/kinematics/extruder.py +++ b/klippy/kinematics/extruder.py @@ -75,6 +75,8 @@ class ExtruderStepper: # Need full kinematic flush to change the smooth time toolhead.flush_step_generation() espa(self.sk_extruder, 0., pressure_advance, new_smooth_time) + motion_queuing = self.printer.lookup_object('motion_queuing') + motion_queuing.check_step_generation_scan_windows() else: toolhead.register_lookahead_callback( lambda print_time: espa(self.sk_extruder, print_time,