diff --git a/klippy/extras/force_move.py b/klippy/extras/force_move.py index 1c837e9d..63e1c293 100644 --- a/klippy/extras/force_move.py +++ b/klippy/extras/force_move.py @@ -56,10 +56,8 @@ class ForceMove: if not was_enable: stepper.motor_enable(print_time, 1) toolhead.dwell(STALL_TIME) - was_ignore = stepper.set_ignore_move(False) - return was_enable, was_ignore - def restore_enable(self, stepper, was_enable, was_ignore): - stepper.set_ignore_move(was_ignore) + return was_enable + def restore_enable(self, stepper, was_enable): if not was_enable: toolhead = self.printer.lookup_object('toolhead') toolhead.dwell(STALL_TIME) @@ -89,14 +87,14 @@ class ForceMove: def cmd_STEPPER_BUZZ(self, params): stepper = self._lookup_stepper(params) logging.info("Stepper buzz %s", stepper.get_name()) - was_enable, was_ignore = self.force_enable(stepper) + was_enable = self.force_enable(stepper) toolhead = self.printer.lookup_object('toolhead') for i in range(10): self.manual_move(stepper, 1., BUZZ_VELOCITY) toolhead.dwell(.050) self.manual_move(stepper, -1., BUZZ_VELOCITY) toolhead.dwell(.450) - self.restore_enable(stepper, was_enable, was_ignore) + self.restore_enable(stepper, was_enable) cmd_FORCE_MOVE_help = "Manually move a stepper; invalidates kinematics" def cmd_FORCE_MOVE(self, params): stepper = self._lookup_stepper(params) @@ -105,9 +103,8 @@ class ForceMove: accel = self.gcode.get_float('ACCEL', params, 0., minval=0.) logging.info("FORCE_MOVE %s distance=%.3f velocity=%.3f accel=%.3f", stepper.get_name(), distance, speed, accel) - was_enable, was_ignore = self.force_enable(stepper) + self.force_enable(stepper) self.manual_move(stepper, distance, speed, accel) - self.restore_enable(stepper, True, was_ignore) cmd_SET_KINEMATIC_POSITION_help = "Force a low-level kinematic position" def cmd_SET_KINEMATIC_POSITION(self, params): toolhead = self.printer.lookup_object('toolhead') diff --git a/klippy/extras/z_tilt.py b/klippy/extras/z_tilt.py index ac28a7b1..6bccfe37 100644 --- a/klippy/extras/z_tilt.py +++ b/klippy/extras/z_tilt.py @@ -36,7 +36,7 @@ class ZAdjustHelper: gcode.respond_info(msg) # Disable Z stepper movements for s in self.z_steppers: - s.set_ignore_move(True) + s.set_trapq(None) # Move each z stepper (sorted from lowest to highest) until they match positions = [(-a, s) for a, s in zip(adjustments, self.z_steppers)] positions.sort() @@ -45,7 +45,7 @@ class ZAdjustHelper: for i in range(len(positions)-1): stepper_offset, stepper = positions[i] next_stepper_offset, next_stepper = positions[i+1] - stepper.set_ignore_move(False) + stepper.set_trapq(toolhead.get_trapq()) curpos[2] = z_low + next_stepper_offset try: toolhead.move(curpos, speed) @@ -53,11 +53,11 @@ class ZAdjustHelper: except: logging.exception("ZAdjustHelper adjust_steppers") for s in self.z_steppers: - s.set_ignore_move(False) + s.set_trapq(toolhead.get_trapq()) raise # Z should now be level - do final cleanup last_stepper_offset, last_stepper = positions[-1] - last_stepper.set_ignore_move(False) + last_stepper.set_trapq(toolhead.get_trapq()) curpos[2] += first_stepper_offset toolhead.set_position(curpos) gcode.reset_last_position() diff --git a/klippy/mcu.py b/klippy/mcu.py index ec490e65..e81e7eb4 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -26,10 +26,11 @@ class MCU_stepper: self._stepqueue = ffi_main.gc(self._ffi_lib.stepcompress_alloc(oid), self._ffi_lib.stepcompress_free) self._mcu.register_stepqueue(self._stepqueue) - self._stepper_kinematics = self._itersolve_gen_steps = None - self._itersolve_generate_steps = self._itersolve_check_active = None + self._stepper_kinematics = None + self._itersolve_gen_steps = self._ffi_lib.itersolve_gen_steps + self._itersolve_generate_steps = self._ffi_lib.itersolve_generate_steps + self._itersolve_check_active = self._ffi_lib.itersolve_check_active self._trapq = ffi_main.NULL - self.set_ignore_move(False) def get_mcu(self): return self._mcu def setup_dir_pin(self, pin_params): @@ -97,18 +98,6 @@ class MCU_stepper: self._ffi_lib.itersolve_set_stepcompress( sk, self._stepqueue, self._step_dist) return old_sk - def set_ignore_move(self, ignore_move): - fl = self._ffi_lib - was_ignore = self._itersolve_gen_steps is not fl.itersolve_gen_steps - if ignore_move: - self._itersolve_gen_steps = (lambda *args: 0) - self._itersolve_generate_steps = (lambda *args: 0) - self._itersolve_check_active = (lambda *args: 0.) - else: - self._itersolve_gen_steps = fl.itersolve_gen_steps - self._itersolve_generate_steps = fl.itersolve_generate_steps - self._itersolve_check_active = fl.itersolve_check_active - return was_ignore def note_homing_end(self, did_trigger=False): ret = self._ffi_lib.stepcompress_reset(self._stepqueue, 0) if ret: diff --git a/klippy/stepper.py b/klippy/stepper.py index f3721b45..00361697 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -81,7 +81,6 @@ class PrinterStepper: self.generate_steps = mcu_stepper.generate_steps self.set_trapq = mcu_stepper.set_trapq self.set_stepper_kinematics = mcu_stepper.set_stepper_kinematics - self.set_ignore_move = mcu_stepper.set_ignore_move self.calc_position_from_coord = mcu_stepper.calc_position_from_coord self.set_position = mcu_stepper.set_position self.get_commanded_position = mcu_stepper.get_commanded_position