diff --git a/klippy/extras/bltouch.py b/klippy/extras/bltouch.py index cf9146fc..d5b4becc 100644 --- a/klippy/extras/bltouch.py +++ b/klippy/extras/bltouch.py @@ -57,7 +57,6 @@ class BLTouchEndstopWrapper: self.get_steppers = self.mcu_endstop.get_steppers self.home_wait = self.mcu_endstop.home_wait self.query_endstop = self.mcu_endstop.query_endstop - self.TimeoutError = self.mcu_endstop.TimeoutError # Register BLTOUCH_DEBUG command self.gcode = self.printer.lookup_object('gcode') self.gcode.register_command("BLTOUCH_DEBUG", self.cmd_BLTOUCH_DEBUG, @@ -98,9 +97,8 @@ class BLTouchEndstopWrapper: self.mcu_endstop.home_start(check_start_time, ENDSTOP_SAMPLE_TIME, ENDSTOP_SAMPLE_COUNT, ENDSTOP_REST_TIME, triggered=triggered) - try: - self.mcu_endstop.home_wait(check_end_time) - except self.mcu_endstop.TimeoutError as e: + did_trigger = self.mcu_endstop.home_wait(check_end_time) + if not did_trigger: raise homing.EndstopError("BLTouch failed to %s" % (msg,)) def raise_probe(self): for retry in range(3): diff --git a/klippy/extras/manual_stepper.py b/klippy/extras/manual_stepper.py index ca6d0dd3..ea3d63cf 100644 --- a/klippy/extras/manual_stepper.py +++ b/klippy/extras/manual_stepper.py @@ -91,11 +91,9 @@ class ManualStepper: # Wait for endstops to trigger error = None for mcu_endstop, name in endstops: - try: - mcu_endstop.home_wait(self.next_cmd_time) - except mcu_endstop.TimeoutError as e: - if error is None: - error = "Failed to home %s: %s" % (name, str(e)) + did_trigger = mcu_endstop.home_wait(self.next_cmd_time) + if not did_trigger and error is None: + error = "Failed to home %s: Timeout during homing" % (name,) self.sync_print_time() if error is not None: raise homing.CommandError(error) diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py index 1297a7d2..f1cb21b7 100644 --- a/klippy/extras/probe.py +++ b/klippy/extras/probe.py @@ -295,7 +295,6 @@ class ProbeEndstopWrapper: self.home_start = self.mcu_endstop.home_start self.home_wait = self.mcu_endstop.home_wait self.query_endstop = self.mcu_endstop.query_endstop - self.TimeoutError = self.mcu_endstop.TimeoutError def _build_config(self): kin = self.printer.lookup_object('toolhead').get_kinematics() for stepper in kin.get_steppers(): diff --git a/klippy/homing.py b/klippy/homing.py index 6415b115..305c374f 100644 --- a/klippy/homing.py +++ b/klippy/homing.py @@ -71,11 +71,9 @@ class Homing: # Wait for endstops to trigger move_end_print_time = self.toolhead.get_last_move_time() for mcu_endstop, name in endstops: - try: - mcu_endstop.home_wait(move_end_print_time) - except mcu_endstop.TimeoutError as e: - if error is None: - error = "Failed to home %s: %s" % (name, str(e)) + did_trigger = mcu_endstop.home_wait(move_end_print_time) + if not did_trigger and error is None: + error = "Failed to home %s: Timeout during homing" % (name,) # Determine stepper halt positions self.toolhead.flush_step_generation() end_mcu_pos = [(s, name, spos, s.get_mcu_position()) diff --git a/klippy/mcu.py b/klippy/mcu.py index 6793fdff..09f5d232 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -10,8 +10,6 @@ class error(Exception): pass class MCU_endstop: - class TimeoutError(Exception): - pass RETRY_QUERY = 1.000 def __init__(self, mcu, pin_params): self._mcu = mcu @@ -106,8 +104,7 @@ class MCU_endstop: s.note_homing_end(did_trigger=did_trigger) if not self._trigger_completion.test(): self._trigger_completion.complete(False) - if not did_trigger: - raise self.TimeoutError("Timeout during endstop homing") + return did_trigger def query_endstop(self, print_time): clock = self._mcu.print_time_to_clock(print_time) if self._mcu.is_fileoutput():