From 8d9ca6f2dd96e5b1c71999fb8497487fcb091493 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 6 Dec 2017 09:59:00 -0500 Subject: homing: Directly interact with the kinematic class when homing Move the homing logic out of toolhead.py and into homing.py. This simplifies the toolhead logic and centralizes the homing code. Signed-off-by: Kevin O'Connor --- klippy/homing.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'klippy/homing.py') diff --git a/klippy/homing.py b/klippy/homing.py index db99fea9..8ee78530 100644 --- a/klippy/homing.py +++ b/klippy/homing.py @@ -10,9 +10,9 @@ ENDSTOP_SAMPLE_TIME = .000015 ENDSTOP_SAMPLE_COUNT = 4 class Homing: - def __init__(self, toolhead, changed_axes): + def __init__(self, toolhead): self.toolhead = toolhead - self.changed_axes = changed_axes + self.changed_axes = [] self.verify_retract = True def set_no_verify_retract(self): self.verify_retract = False @@ -79,6 +79,13 @@ class Homing: if s.get_mcu_position() == pos: raise EndstopError( "Endstop %s still triggered after retract" % (name,)) + def home_axes(self, axes): + self.changed_axes = axes + try: + self.toolhead.get_kinematics().home(self) + except EndstopError: + self.toolhead.motor_off() + raise def query_endstops(print_time, query_flags, steppers): if query_flags == "get_mcu_position": -- cgit v1.2.3-70-g09d2