aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/stepper.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-08-29 17:37:14 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-08-29 18:00:17 -0400
commit002dc0dfaf42feae0e7955c035ef0bbd19cf0a19 (patch)
tree37a66798f739d415325232502d56609775309618 /klippy/stepper.py
parent68d6788413ea8408d3c0290f4e6aa9974733a324 (diff)
downloadkutter-002dc0dfaf42feae0e7955c035ef0bbd19cf0a19.tar.gz
kutter-002dc0dfaf42feae0e7955c035ef0bbd19cf0a19.tar.xz
kutter-002dc0dfaf42feae0e7955c035ef0bbd19cf0a19.zip
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>
Diffstat (limited to 'klippy/stepper.py')
-rw-r--r--klippy/stepper.py6
1 files changed, 6 insertions, 0 deletions
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