mirror of
https://github.com/Klipper3d/klipper.git
synced 2026-02-07 08:41:02 -07:00
manual_stepper: Support STOP_ON_ENDSTOP=probe
Support moving a manual_stepper until a trigger event, without resetting the final position. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
4fb3b24c8d
commit
0dccc7e02d
3 changed files with 18 additions and 14 deletions
|
|
@ -1007,15 +1007,16 @@ MOVE=<pos> STOP_ON_ENDSTOP=<check_type>`: If STOP_ON_ENDSTOP is
|
|||
specified then the move will end early if an endstop event occurs. The
|
||||
`STOP_ON_ENDSTOP` parameter may be set to one of the following values:
|
||||
|
||||
* `probe`: The movement will stop when the endstop reports triggered.
|
||||
* `home`: The movement will stop when the endstop reports triggered
|
||||
and the final position of the manual_stepper will be set such that
|
||||
the trigger position matches the position specified in the `MOVE`
|
||||
parameter.
|
||||
* `inverted_home`: As above, however, the movement will stop when the
|
||||
endstop reports it is in a non-triggered state.
|
||||
* `try_home`, `try_inverted_home`: As above, but no error will be
|
||||
reported if the movement fully completes without an endstop event
|
||||
stopping the move early.
|
||||
* `inverted_probe`, `inverted_home`: As above, however, the movement
|
||||
will stop when the endstop reports it is in a non-triggered state.
|
||||
* `try_probe`, `try_inverted_probe`, `try_home`, `try_inverted_home`:
|
||||
As above, but no error will be reported if the movement fully
|
||||
completes without an endstop event stopping the move early.
|
||||
|
||||
`MANUAL_STEPPER STEPPER=config_name GCODE_AXIS=[A-Z]
|
||||
[LIMIT_VELOCITY=<velocity>] [LIMIT_ACCEL=<accel>]
|
||||
|
|
|
|||
|
|
@ -249,16 +249,18 @@ class PrinterHoming:
|
|||
gcode = self.printer.lookup_object('gcode')
|
||||
gcode.register_command('G28', self.cmd_G28)
|
||||
def manual_home(self, toolhead, endstops, pos, speed,
|
||||
triggered, check_triggered):
|
||||
probe_pos, triggered, check_triggered):
|
||||
hmove = HomingMove(self.printer, endstops, toolhead)
|
||||
try:
|
||||
hmove.homing_move(pos, speed, triggered=triggered,
|
||||
check_triggered=check_triggered)
|
||||
epos = hmove.homing_move(pos, speed, probe_pos=probe_pos,
|
||||
triggered=triggered,
|
||||
check_triggered=check_triggered)
|
||||
except self.printer.command_error:
|
||||
if self.printer.is_shutdown():
|
||||
raise self.printer.command_error(
|
||||
"Homing failed due to printer shutdown")
|
||||
raise
|
||||
return epos
|
||||
def probing_move(self, mcu_probe, pos, speed):
|
||||
endstops = [(mcu_probe, "probe")]
|
||||
hmove = HomingMove(self.printer, endstops)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ class ManualStepper:
|
|||
self.motion_queuing.note_mcu_movequeue_activity(self.next_cmd_time)
|
||||
if sync:
|
||||
self.sync_print_time()
|
||||
def do_homing_move(self, movepos, speed, accel, triggered, check_trigger):
|
||||
def do_homing_move(self, movepos, speed, accel,
|
||||
probe_pos, triggered, check_trigger):
|
||||
if not self.can_home:
|
||||
raise self.printer.command_error(
|
||||
"No endstop for this manual stepper")
|
||||
|
|
@ -87,7 +88,8 @@ class ManualStepper:
|
|||
endstops = self.rail.get_endstops()
|
||||
phoming = self.printer.lookup_object('homing')
|
||||
phoming.manual_home(self, endstops, pos, speed,
|
||||
triggered, check_trigger)
|
||||
probe_pos, triggered, check_trigger)
|
||||
self.sync_print_time()
|
||||
cmd_MANUAL_STEPPER_help = "Command a manually configured stepper"
|
||||
def cmd_MANUAL_STEPPER(self, gcmd):
|
||||
if gcmd.get('GCODE_AXIS', None) is not None:
|
||||
|
|
@ -115,14 +117,15 @@ class ManualStepper:
|
|||
homing_move = homing_move[is_try*4:]
|
||||
is_inverted = homing_move.startswith('inverted_')
|
||||
homing_move = homing_move[is_inverted*9:]
|
||||
if homing_move != "home":
|
||||
if homing_move not in ["probe", "home"]:
|
||||
raise gcmd.error("Unknown STOP_ON_ENDSTOP request")
|
||||
is_probe = (homing_move == "probe")
|
||||
movepos = gcmd.get_float('MOVE')
|
||||
if ((self.pos_min is not None and movepos < self.pos_min)
|
||||
or (self.pos_max is not None and movepos > self.pos_max)):
|
||||
raise gcmd.error("Move out of range")
|
||||
self.do_homing_move(movepos, speed, accel,
|
||||
not is_inverted, not is_try)
|
||||
is_probe, not is_inverted, not is_try)
|
||||
elif gcmd.get_float('MOVE', None) is not None:
|
||||
movepos = gcmd.get_float('MOVE')
|
||||
if ((self.pos_min is not None and movepos < self.pos_min)
|
||||
|
|
@ -220,8 +223,6 @@ class ManualStepper:
|
|||
drip_completion)
|
||||
# Clear trapq of any remaining parts of movement
|
||||
self.motion_queuing.wipe_trapq(self.trapq)
|
||||
self.rail.set_position([self.commanded_pos, 0., 0.])
|
||||
self.sync_print_time()
|
||||
def get_kinematics(self):
|
||||
return self
|
||||
def get_steppers(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue