stepper: Adjust homing_speed so that it's an even number of ticks per step

Adjust the configured homing speed so that it always results in a
speed that is an even number of mcu ticks per step.  This ensures that
the code can always get good step compression during homing, which is
important as the entire homing operation must be able to fit within
the mcu's move queue.  This fixes some "move queue empty" mcu shutdown
errors that could occur when the Z step distance was an unusual size.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-08-29 17:37:14 -04:00
parent 68d6788413
commit 002dc0dfaf
4 changed files with 18 additions and 9 deletions

View file

@ -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