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>
This commit is contained in:
Kevin O'Connor
2025-04-06 11:14:13 -04:00
parent 655861cf12
commit f3e89e25c5
2 changed files with 57 additions and 17 deletions

View File

@@ -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)