From bc29ee1c6d1fbd99a9d0c6db6b4419bbc8f8a7c3 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 2 Apr 2021 13:42:25 -0400 Subject: 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 --- klippy/extras/homing.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'klippy/extras/homing.py') diff --git a/klippy/extras/homing.py b/klippy/extras/homing.py index f6dead84..1d7e1948 100644 --- a/klippy/extras/homing.py +++ b/klippy/extras/homing.py @@ -13,8 +13,13 @@ ENDSTOP_SAMPLE_COUNT = 4 def multi_complete(printer, completions): if len(completions) == 1: return completions[0] - cb = (lambda e: all([c.wait() for c in completions])) - return printer.get_reactor().register_callback(cb) + # Build completion that waits for all completions + 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 class HomingMove: -- cgit v1.2.3-70-g09d2