aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/homing.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-05-14 11:18:31 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-05-14 11:40:35 -0400
commit6c3db80d89f32bd399f4cd757aa4671d7b3b5da1 (patch)
treee54d75e56ac64b9267b5813a3100085d04c7e7b7 /klippy/homing.py
parentbf3c41cd0685e57e73b29bde9f619e94bd44a051 (diff)
downloadkutter-6c3db80d89f32bd399f4cd757aa4671d7b3b5da1.tar.gz
kutter-6c3db80d89f32bd399f4cd757aa4671d7b3b5da1.tar.xz
kutter-6c3db80d89f32bd399f4cd757aa4671d7b3b5da1.zip
homing: Apply speed rounding after calling home_prepare()
The step speed rounding and the cpu delay must be run after running the endstop specific preparation code. Otherwise, a delay in the home_prepare() code could undo those calculations. Specifically, this could lead to errors on a multi-mcu setup when the Z is homed using a virtual_z_offset and there is a delay in the activate_gcode section. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/homing.py')
-rw-r--r--klippy/homing.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/klippy/homing.py b/klippy/homing.py
index 97879730..b3427854 100644
--- a/klippy/homing.py
+++ b/klippy/homing.py
@@ -40,10 +40,8 @@ class Homing:
dist_ticks = adjusted_freq * mcu_stepper.get_step_dist()
ticks_per_step = math.ceil(dist_ticks / speed)
return dist_ticks / ticks_per_step
- def homing_move(self, movepos, endstops, speed, probe_pos=False):
+ def _homing_move(self, movepos, endstops, speed, probe_pos=False):
# Start endstop checking
- for mcu_endstop, name in endstops:
- mcu_endstop.home_prepare()
print_time = self.toolhead.get_last_move_time()
for mcu_endstop, name in endstops:
min_step_dist = min([s.get_step_dist()
@@ -76,6 +74,10 @@ class Homing:
mcu_endstop.home_finalize()
if error is not None:
raise EndstopError(error)
+ def homing_move(self, movepos, endstops, speed, probe_pos=False):
+ for mcu_endstop, name in endstops:
+ mcu_endstop.home_prepare()
+ self._homing_move(movepos, endstops, speed, probe_pos)
def home(self, forcepos, movepos, endstops, speed, second_home=False):
if second_home and forcepos == movepos:
return
@@ -83,6 +85,9 @@ class Homing:
homing_axes = [axis for axis in range(3) if forcepos[axis] is not None]
self.toolhead.set_position(
self._fill_coord(forcepos), homing_axes=homing_axes)
+ # Notify endstops of upcoming home
+ for mcu_endstop, name in endstops:
+ mcu_endstop.home_prepare()
# Add a CPU delay when homing a large axis
if not second_home:
est_move_d = sum([abs(forcepos[i]-movepos[i])
@@ -96,7 +101,7 @@ class Homing:
start_mcu_pos = [(s, name, s.get_mcu_position())
for es, name in endstops for s in es.get_steppers()]
# Issue homing move
- self.homing_move(movepos, endstops, speed)
+ self._homing_move(movepos, endstops, speed)
# Verify retract led to some movement on second home
if second_home and self.verify_retract:
for s, name, pos in start_mcu_pos: