From c29e9b1a9b60154c00d71ccbf974f151d6fd04b5 Mon Sep 17 00:00:00 2001 From: david mueller Date: Tue, 16 Dec 2025 14:09:22 +0100 Subject: [PATCH] Set motion mode to FREE when volatile joints have been unhomed Joints set to volatile are automatically unhomed when task state switches to OFF or ESTOP If a joint is unhomed motion state needs to be set to free Fixes https://github.com/LinuxCNC/linuxcnc/issues/3658 --- src/emc/motion/control.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/emc/motion/control.c b/src/emc/motion/control.c index 1d40506906b..ba0f3c56300 100644 --- a/src/emc/motion/control.c +++ b/src/emc/motion/control.c @@ -866,6 +866,15 @@ static void set_operating_mode(void) emcmot_joint_t *joint; double positions[EMCMOT_MAX_JOINTS]; + /* joints set to volatile are unhomed when task state switches to OFF or ESTOP + in this case we need to switch to 'free' mode */ + if (!get_allhomed() && (GET_MOTION_TELEOP_FLAG() || GET_MOTION_COORD_FLAG()) ) { + emcmotInternal->teleoperating = 0; + SET_MOTION_TELEOP_FLAG(0); + emcmotInternal->coordinating = 0; + SET_MOTION_COORD_FLAG(0); + } + /* check for disabling */ if (!emcmotInternal->enabling && GET_MOTION_ENABLE_FLAG()) { /* clear out the motion emcmotInternal->coord_tp and interpolators */ @@ -2184,4 +2193,4 @@ static void update_status(void) old_motion_flag = emcmotStatus->motionFlag; } #endif -} \ No newline at end of file +}