aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2025-04-06 11:14:13 -0400
committerKevin O'Connor <kevin@koconnor.net>2025-04-08 23:23:05 -0400
commitf3e89e25c5ff3ec9c5499c186af4c28b6a9ab1f4 (patch)
treed7fa417581853fd634d3efe83eeea16d44a23b83 /klippy/extras
parent655861cf121849b2fa74b7a07984c4c112b28c99 (diff)
downloadkutter-f3e89e25c5ff3ec9c5499c186af4c28b6a9ab1f4.tar.gz
kutter-f3e89e25c5ff3ec9c5499c186af4c28b6a9ab1f4.tar.xz
kutter-f3e89e25c5ff3ec9c5499c186af4c28b6a9ab1f4.zip
force_move: Support a SET_HOMED parameter to SET_KINEMATIC_POSITION
Commit 70838797 added support for clearing the homing state in SET_KINEMATIC_POSITION commands. However, it can be difficult to use that support as the default for SET_KINEMATIC_POSITION is to set all axes as homed. Add a new SET_HOMED parameter to allow one to explicitly request which axes to consider in a homed state. Also introduce a CLEAR_HOMED parameter and prefer that to the existing CLEAR parameter. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras')
-rw-r--r--klippy/extras/force_move.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/klippy/extras/force_move.py b/klippy/extras/force_move.py
index 24783c2c..ad27f95c 100644
--- a/klippy/extras/force_move.py
+++ b/klippy/extras/force_move.py
@@ -131,12 +131,19 @@ class ForceMove:
x = gcmd.get_float('X', curpos[0])
y = gcmd.get_float('Y', curpos[1])
z = gcmd.get_float('Z', curpos[2])
- clear = gcmd.get('CLEAR', '').lower()
- clear_axes = "".join([a for a in "xyz" if a in clear])
- logging.info("SET_KINEMATIC_POSITION pos=%.3f,%.3f,%.3f clear=%s",
- x, y, z, clear_axes)
- toolhead.set_position([x, y, z, curpos[3]], homing_axes="xyz")
- toolhead.get_kinematics().clear_homing_state(clear_axes)
+ set_homed = gcmd.get('SET_HOMED', 'xyz').lower()
+ set_homed_axes = "".join([a for a in "xyz" if a in set_homed])
+ if gcmd.get('CLEAR_HOMED', None) is None:
+ # "CLEAR" is an alias for "CLEAR_HOMED"; should deprecate
+ clear_homed = gcmd.get('CLEAR', '').lower()
+ else:
+ clear_homed = gcmd.get('CLEAR_HOMED', '')
+ clear_homed_axes = "".join([a for a in "xyz" if a in clear_homed])
+ logging.info("SET_KINEMATIC_POSITION pos=%.3f,%.3f,%.3f"
+ " set_homed=%s clear_homed=%s",
+ x, y, z, set_homed_axes, clear_homed_axes)
+ toolhead.set_position([x, y, z, curpos[3]], homing_axes=set_homed_axes)
+ toolhead.get_kinematics().clear_homing_state(clear_homed_axes)
def load_config(config):
return ForceMove(config)