aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--klippy/extras/bltouch.py6
-rw-r--r--klippy/extras/homing.py9
-rw-r--r--klippy/extras/probe_eddy_current.py5
-rw-r--r--klippy/mcu.py18
4 files changed, 24 insertions, 14 deletions
diff --git a/klippy/extras/bltouch.py b/klippy/extras/bltouch.py
index 49385428..b01cdb9e 100644
--- a/klippy/extras/bltouch.py
+++ b/klippy/extras/bltouch.py
@@ -116,7 +116,11 @@ class BLTouchEndstopWrapper:
self.mcu_endstop.home_start(self.action_end_time, ENDSTOP_SAMPLE_TIME,
ENDSTOP_SAMPLE_COUNT, ENDSTOP_REST_TIME,
triggered=triggered)
- trigger_time = self.mcu_endstop.home_wait(self.action_end_time + 0.100)
+ try:
+ trigger_time = self.mcu_endstop.home_wait(
+ self.action_end_time + 0.100)
+ except self.printer.command_error as e:
+ return False
return trigger_time > 0.
def raise_probe(self):
self.sync_mcu_print_time()
diff --git a/klippy/extras/homing.py b/klippy/extras/homing.py
index 634ad81b..06b52f1e 100644
--- a/klippy/extras/homing.py
+++ b/klippy/extras/homing.py
@@ -98,11 +98,14 @@ class HomingMove:
trigger_times = {}
move_end_print_time = self.toolhead.get_last_move_time()
for mcu_endstop, name in self.endstops:
- trigger_time = mcu_endstop.home_wait(move_end_print_time)
+ try:
+ trigger_time = mcu_endstop.home_wait(move_end_print_time)
+ except self.printer.command_error as e:
+ if error is None:
+ error = "Error during homing %s: %s" % (name, str(e))
+ continue
if trigger_time > 0.:
trigger_times[name] = trigger_time
- elif trigger_time < 0. and error is None:
- error = "Communication timeout during homing %s" % (name,)
elif check_triggered and error is None:
error = "No trigger on %s after full movement" % (name,)
# Determine stepper halt positions
diff --git a/klippy/extras/probe_eddy_current.py b/klippy/extras/probe_eddy_current.py
index 8b9d705b..636c800d 100644
--- a/klippy/extras/probe_eddy_current.py
+++ b/klippy/extras/probe_eddy_current.py
@@ -243,8 +243,9 @@ class EddyEndstopWrapper:
trigger_time = self._sensor_helper.clear_home()
self._stop_measurements(is_home=True)
res = self._dispatch.stop()
- if res == mcu.MCU_trsync.REASON_COMMS_TIMEOUT:
- return -1.
+ if res >= mcu.MCU_trsync.REASON_COMMS_TIMEOUT:
+ raise self._printer.command_error(
+ "Communication timeout during homing")
if res != mcu.MCU_trsync.REASON_ENDSTOP_HIT:
return 0.
if self._mcu.is_fileoutput():
diff --git a/klippy/mcu.py b/klippy/mcu.py
index 2a01c5a7..d7a679ac 100644
--- a/klippy/mcu.py
+++ b/klippy/mcu.py
@@ -104,9 +104,9 @@ class CommandWrapper:
class MCU_trsync:
REASON_ENDSTOP_HIT = 1
- REASON_COMMS_TIMEOUT = 2
- REASON_HOST_REQUEST = 3
- REASON_PAST_END_TIME = 4
+ REASON_HOST_REQUEST = 2
+ REASON_PAST_END_TIME = 3
+ REASON_COMMS_TIMEOUT = 4
def __init__(self, mcu, trdispatch):
self._mcu = mcu
self._trdispatch = trdispatch
@@ -180,7 +180,7 @@ class MCU_trsync:
if tc is not None:
self._trigger_completion = None
reason = params['trigger_reason']
- is_failure = (reason == self.REASON_COMMS_TIMEOUT)
+ is_failure = (reason >= self.REASON_COMMS_TIMEOUT)
self._reactor.async_complete(tc, is_failure)
elif self._home_end_clock is not None:
clock = self._mcu.clock32_to_clock64(params['clock'])
@@ -279,8 +279,9 @@ class TriggerDispatch:
ffi_main, ffi_lib = chelper.get_ffi()
ffi_lib.trdispatch_stop(self._trdispatch)
res = [trsync.stop() for trsync in self._trsyncs]
- if any([r == MCU_trsync.REASON_COMMS_TIMEOUT for r in res]):
- return MCU_trsync.REASON_COMMS_TIMEOUT
+ err_res = [r for r in res if r >= MCU_trsync.REASON_COMMS_TIMEOUT]
+ if err_res:
+ return err_res[0]
return res[0]
class MCU_endstop:
@@ -334,8 +335,9 @@ class MCU_endstop:
self._dispatch.wait_end(home_end_time)
self._home_cmd.send([self._oid, 0, 0, 0, 0, 0, 0, 0])
res = self._dispatch.stop()
- if res == MCU_trsync.REASON_COMMS_TIMEOUT:
- return -1.
+ if res >= MCU_trsync.REASON_COMMS_TIMEOUT:
+ cmderr = self._mcu.get_printer().command_error
+ raise cmderr("Communication timeout during homing")
if res != MCU_trsync.REASON_ENDSTOP_HIT:
return 0.
if self._mcu.is_fileoutput():