homing: Don't raise a TimeoutError from home_wait()

Change home_wait() to return if the homing operation completed
succesfully or not.  This simplifies the callers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2020-02-19 12:07:30 -05:00
parent fbbbbc85cf
commit 804f95ebe4
5 changed files with 9 additions and 19 deletions

View File

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

View File

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

View File

@@ -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():