homing: Check for failures during multi-endstop homing
If any endstop reports a failure, then stop homing on all endstops. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
983951443c
commit
bc29ee1c6d
|
@ -13,8 +13,13 @@ ENDSTOP_SAMPLE_COUNT = 4
|
||||||
def multi_complete(printer, completions):
|
def multi_complete(printer, completions):
|
||||||
if len(completions) == 1:
|
if len(completions) == 1:
|
||||||
return completions[0]
|
return completions[0]
|
||||||
cb = (lambda e: all([c.wait() for c in completions]))
|
# Build completion that waits for all completions
|
||||||
return printer.get_reactor().register_callback(cb)
|
reactor = printer.get_reactor()
|
||||||
|
cp = reactor.register_callback(lambda e: [c.wait() for c in completions])
|
||||||
|
# If any completion indicates an error, then exit main completion early
|
||||||
|
for c in completions:
|
||||||
|
reactor.register_callback(lambda e: cp.complete(1) if c.wait() else 0)
|
||||||
|
return cp
|
||||||
|
|
||||||
# Implementation of homing/probing moves
|
# Implementation of homing/probing moves
|
||||||
class HomingMove:
|
class HomingMove:
|
||||||
|
|
|
@ -84,7 +84,9 @@ class MCU_trsync:
|
||||||
tc = self._trigger_completion
|
tc = self._trigger_completion
|
||||||
if tc is not None:
|
if tc is not None:
|
||||||
self._trigger_completion = None
|
self._trigger_completion = None
|
||||||
self._reactor.async_complete(tc, True)
|
reason = params['trigger_reason']
|
||||||
|
is_failure = (reason == self.REASON_COMMS_TIMEOUT)
|
||||||
|
self._reactor.async_complete(tc, is_failure)
|
||||||
elif self._home_end_clock is not None:
|
elif self._home_end_clock is not None:
|
||||||
clock = self._mcu.clock32_to_clock64(params['clock'])
|
clock = self._mcu.clock32_to_clock64(params['clock'])
|
||||||
if clock >= self._home_end_clock:
|
if clock >= self._home_end_clock:
|
||||||
|
|
Loading…
Reference in New Issue