From 31fe50ffa387ed4a45950c1043a3b214a9d554dd Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 20 Oct 2024 22:11:25 -0400 Subject: homing: Log a warning if probe alters stepper kinematic positions After a probe attempt the toolhead position needs to be recalculated to the position that the toolhead ultimately halted at. Check that the position setting wouldn't actually change the internal view of the stepper motor and log a warning if any skew is detected. Signed-off-by: Kevin O'Connor --- klippy/stepper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'klippy/stepper.py') diff --git a/klippy/stepper.py b/klippy/stepper.py index 9b692904..05e56cca 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -138,8 +138,10 @@ class MCU_stepper: def get_commanded_position(self): ffi_main, ffi_lib = chelper.get_ffi() return ffi_lib.itersolve_get_commanded_pos(self._stepper_kinematics) - def get_mcu_position(self): - mcu_pos_dist = self.get_commanded_position() + self._mcu_position_offset + def get_mcu_position(self, cmd_pos=None): + if cmd_pos is None: + cmd_pos = self.get_commanded_position() + mcu_pos_dist = cmd_pos + self._mcu_position_offset mcu_pos = mcu_pos_dist / self._step_dist if mcu_pos >= 0.: return int(mcu_pos + 0.5) -- cgit v1.2.3-70-g09d2