diff --git a/klippy/cartesian.py b/klippy/cartesian.py index de9d4fa4..860ce9fd 100644 --- a/klippy/cartesian.py +++ b/klippy/cartesian.py @@ -28,7 +28,8 @@ class CartKinematics: max_xy_accel = min(s.max_accel for s in self.steppers[:2]) return max_xy_speed, max_xy_accel def get_homed_position(self): - return [s.get_homed_position() for s in self.steppers] + return [s.position_endstop + s.get_homed_offset()*s.step_dist + for s in self.steppers] def home(self, toolhead, axes): # Each axis is homed independently and in order homing_state = homing.Homing(toolhead, axes) diff --git a/klippy/stepper.py b/klippy/stepper.py index 310a0711..8881c99f 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -85,21 +85,21 @@ class PrinterStepper: return None self.mcu_endstop.query_endstop() return self.mcu_endstop - def get_homed_position(self): + def get_homed_offset(self): if not self.homing_stepper_phases: - return self.position_endstop + return 0 pos = self.mcu_endstop.get_last_position() pos %= self.homing_stepper_phases if self.homing_endstop_phase is None: logging.info("Setting %s endstop phase to %d" % ( self.config.section, pos)) self.homing_endstop_phase = pos - return self.position_endstop + return 0 delta = (pos - self.homing_endstop_phase) % self.homing_stepper_phases if delta >= self.homing_stepper_phases - self.homing_endstop_accuracy: delta -= self.homing_stepper_phases elif delta > self.homing_endstop_accuracy: logging.error("Endstop %s incorrect phase (got %d vs %d)" % ( self.config.section, pos, self.homing_endstop_phase)) - return self.position_endstop - return self.position_endstop + delta * self.step_dist + return 0 + return delta