From 15f21be5ec83733706328dbf2b6870332056e3ff Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 19 Feb 2020 13:34:06 -0500 Subject: [PATCH] manual_stepper: Support ignoring errors on STOP_ON_ENDSTOP Signed-off-by: Kevin O'Connor --- docs/G-Codes.md | 15 ++++++++------- klippy/extras/manual_stepper.py | 7 ++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/G-Codes.md b/docs/G-Codes.md index cbc2544f..e5b6427b 100644 --- a/docs/G-Codes.md +++ b/docs/G-Codes.md @@ -254,17 +254,18 @@ The following command is available when a "manual_stepper" config section is enabled: - `MANUAL_STEPPER STEPPER=config_name [ENABLE=[0|1]] [SET_POSITION=] [SPEED=] [ACCEL=] - [MOVE= [STOP_ON_ENDSTOP=1]]`: This command will alter the state - of the stepper. Use the ENABLE parameter to enable/disable the - stepper. Use the SET_POSITION parameter to force the stepper to + [MOVE= [STOP_ON_ENDSTOP=[1|2|-1|-2]]`: This command will alter + the state of the stepper. Use the ENABLE parameter to enable/disable + the stepper. Use the SET_POSITION parameter to force the stepper to think it is at the given position. Use the MOVE parameter to request a movement to the given position. If SPEED and/or ACCEL is specified then the given values will be used instead of the defaults specified in the config file. If an ACCEL of zero is specified then no - acceleration will be preformed. If STOP_ON_ENDSTOP is specified then - the move will end early should the endstop report as triggered (use - STOP_ON_ENDSTOP=-1 to stop early should the endstop report not - triggered). + acceleration will be performed. If STOP_ON_ENDSTOP=1 is specified + then the move will end early should the endstop report as triggered + (use STOP_ON_ENDSTOP=2 to complete the move without error even if + the endstop does not trigger, use -1 or -2 to stop when the endstop + reports not triggered). ## Probe diff --git a/klippy/extras/manual_stepper.py b/klippy/extras/manual_stepper.py index ea3d63cf..87e6515d 100644 --- a/klippy/extras/manual_stepper.py +++ b/klippy/extras/manual_stepper.py @@ -74,7 +74,7 @@ class ManualStepper: toolhead = self.printer.lookup_object('toolhead') toolhead.note_kinematic_activity(self.next_cmd_time) self.sync_print_time() - def do_homing_move(self, movepos, speed, accel, triggered): + def do_homing_move(self, movepos, speed, accel, triggered, check_trigger): if not self.can_home: raise self.gcode.error("No endstop for this manual stepper") # Start endstop checking @@ -92,7 +92,7 @@ class ManualStepper: error = None for mcu_endstop, name in endstops: did_trigger = mcu_endstop.home_wait(self.next_cmd_time) - if not did_trigger and error is None: + if not did_trigger and check_trigger and error is None: error = "Failed to home %s: Timeout during homing" % (name,) self.sync_print_time() if error is not None: @@ -109,7 +109,8 @@ class ManualStepper: accel = self.gcode.get_float('ACCEL', params, self.accel, minval=0.) if homing_move: movepos = self.gcode.get_float('MOVE', params) - self.do_homing_move(movepos, speed, accel, homing_move > 0) + self.do_homing_move(movepos, speed, accel, + homing_move > 0, abs(homing_move) == 1) elif 'MOVE' in params: movepos = self.gcode.get_float('MOVE', params) self.do_move(movepos, speed, accel)