From c6b652044d8e2bc59cde15c20a92f113b324bc03 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 30 Jun 2020 20:20:16 -0400 Subject: [PATCH] stepper: Make sure to reload trapq in set_stepper_kinematics() Signed-off-by: Kevin O'Connor --- klippy/extras/force_move.py | 3 ++- klippy/stepper.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/klippy/extras/force_move.py b/klippy/extras/force_move.py index 647b0b33..394da525 100644 --- a/klippy/extras/force_move.py +++ b/klippy/extras/force_move.py @@ -39,7 +39,6 @@ class ForceMove: self.trapq_free_moves = ffi_lib.trapq_free_moves self.stepper_kinematics = ffi_main.gc( ffi_lib.cartesian_stepper_alloc('x'), ffi_lib.free) - ffi_lib.itersolve_set_trapq(self.stepper_kinematics, self.trapq) # Register commands gcode = self.printer.lookup_object('gcode') gcode.register_command('STEPPER_BUZZ', self.cmd_STEPPER_BUZZ, @@ -80,6 +79,7 @@ class ForceMove: toolhead = self.printer.lookup_object('toolhead') toolhead.flush_step_generation() prev_sk = stepper.set_stepper_kinematics(self.stepper_kinematics) + prev_trapq = stepper.set_trapq(self.trapq) stepper.set_position((0., 0., 0.)) axis_r, accel_t, cruise_t, cruise_v = calc_move_time(dist, speed, accel) print_time = toolhead.get_last_move_time() @@ -88,6 +88,7 @@ class ForceMove: print_time = print_time + accel_t + cruise_t + accel_t stepper.generate_steps(print_time) self.trapq_free_moves(self.trapq, print_time + 99999.9) + stepper.set_trapq(prev_trapq) stepper.set_stepper_kinematics(prev_sk) toolhead.note_kinematic_activity(print_time) toolhead.dwell(accel_t + cruise_t + accel_t) diff --git a/klippy/stepper.py b/klippy/stepper.py index 4249dccb..ad3a6006 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -124,8 +124,9 @@ class MCU_stepper: old_sk = self._stepper_kinematics self._stepper_kinematics = sk if sk is not None: - self._ffi_lib.itersolve_set_stepcompress( - sk, self._stepqueue, self._step_dist) + self._ffi_lib.itersolve_set_stepcompress(sk, self._stepqueue, + self._step_dist) + self.set_trapq(self._trapq) return old_sk def note_homing_end(self, did_trigger=False): ret = self._ffi_lib.stepcompress_reset(self._stepqueue, 0)