diff --git a/klippy/cartesian.py b/klippy/cartesian.py index d1747e6e..ee27f7b3 100644 --- a/klippy/cartesian.py +++ b/klippy/cartesian.py @@ -43,18 +43,19 @@ class CartKinematics: rpos = s.position_endstop + s.homing_retract_dist r2pos = rpos + s.homing_retract_dist # Initial homing + homing_speed = s.get_homing_speed() homepos = [None, None, None, None] homepos[axis] = s.position_endstop coord = [None, None, None, None] coord[axis] = pos - homing_state.home(list(coord), homepos, [s], s.homing_speed) + homing_state.home(list(coord), homepos, [s], homing_speed) # Retract coord[axis] = rpos - homing_state.retract(list(coord), s.homing_speed) + homing_state.retract(list(coord), homing_speed) # Home again coord[axis] = r2pos homing_state.home( - list(coord), homepos, [s], s.homing_speed/2.0, second_home=True) + list(coord), homepos, [s], homing_speed/2.0, second_home=True) # Set final homed position coord[axis] = s.position_endstop + s.get_homed_offset() homing_state.set_homed_position(coord) diff --git a/klippy/corexy.py b/klippy/corexy.py index 1fdfa817..2069d16b 100644 --- a/klippy/corexy.py +++ b/klippy/corexy.py @@ -46,18 +46,19 @@ class CoreXYKinematics: rpos = s.position_endstop + s.homing_retract_dist r2pos = rpos + s.homing_retract_dist # Initial homing + homing_speed = s.get_homing_speed() homepos = [None, None, None, None] homepos[axis] = s.position_endstop coord = [None, None, None, None] coord[axis] = pos - homing_state.home(list(coord), homepos, [s], s.homing_speed) + homing_state.home(list(coord), homepos, [s], homing_speed) # Retract coord[axis] = rpos - homing_state.retract(list(coord), s.homing_speed) + homing_state.retract(list(coord), homing_speed) # Home again coord[axis] = r2pos homing_state.home( - list(coord), homepos, [s], s.homing_speed/2.0, second_home=True) + list(coord), homepos, [s], homing_speed/2.0, second_home=True) if axis == 2: # Support endstop phase detection on Z axis coord[axis] = s.position_endstop + s.get_homed_offset() diff --git a/klippy/delta.py b/klippy/delta.py index 8d8ecf04..fc796cd4 100644 --- a/klippy/delta.py +++ b/klippy/delta.py @@ -107,17 +107,18 @@ class DeltaKinematics: s = self.steppers[0] # Assume homing speed same for all steppers self.need_home = False # Initial homing + homing_speed = s.get_homing_speed() homepos = [0., 0., self.max_z, None] coord = list(homepos) coord[2] = -1.5 * math.sqrt(self.arm_length2-self.max_xy2) - homing_state.home(list(coord), homepos, self.steppers, s.homing_speed) + homing_state.home(list(coord), homepos, self.steppers, homing_speed) # Retract coord[2] = homepos[2] - s.homing_retract_dist - homing_state.retract(list(coord), s.homing_speed) + homing_state.retract(list(coord), homing_speed) # Home again coord[2] -= s.homing_retract_dist homing_state.home(list(coord), homepos, self.steppers - , s.homing_speed/2.0, second_home=True) + , homing_speed/2.0, second_home=True) # Set final homed position spos = self._cartesian_to_actuator(homepos) spos = [spos[i] + self.steppers[i].position_endstop - self.max_z diff --git a/klippy/stepper.py b/klippy/stepper.py index 9a0233ec..ece63029 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -104,6 +104,12 @@ class PrinterHomingStepper(PrinterStepper): mcu_time = self.mcu_endstop.get_mcu().print_to_mcu_time(print_time) self.mcu_endstop.query_endstop(mcu_time) return self.mcu_endstop + def get_homing_speed(self): + # Round the configured homing speed so that it is an even + # number of ticks per step. + dist_ticks = self.mcu_stepper.get_mcu().get_mcu_freq() * self.step_dist + ticks_per_step = round(dist_ticks / self.homing_speed) + return dist_ticks / ticks_per_step def get_homed_offset(self): if not self.homing_stepper_phases or self.need_motor_enable: return 0