From 6f37ca3a1e8c18df1809b5aaf0af454b2e2daa56 Mon Sep 17 00:00:00 2001 From: Luca Toniolo <10792599+grandixximo@users.noreply.github.com> Date: Tue, 5 May 2026 21:33:53 +0800 Subject: [PATCH] task -unhome VOLATILE_HOME joints on any motion-disable edge Issue #3954: with VOLATILE_HOME=1, tripping a limit switch (or hitting amp-fault, following error, etc.) disables the drives but leaves all joints flagged as homed. Only ESTOP and machine-off paths cleared the homed flag; every other drive-disable cause silently kept it set. Detect the traj.enabled 1->0 edge in the task main loop and call emcJointUnhome(-2) so volatile_home joints are unhomed regardless of which fault path disabled motion. --- src/emc/task/emctaskmain.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/emc/task/emctaskmain.cc b/src/emc/task/emctaskmain.cc index 1d709157425..3bf13a702d1 100644 --- a/src/emc/task/emctaskmain.cc +++ b/src/emc/task/emctaskmain.cc @@ -3295,6 +3295,7 @@ int main(int argc, char *argv[]) } while (!done) { static int gave_soft_limit_message = 0; + static int prev_traj_enabled = 0; task_beat++; // Task's heartbeat check_ini_hal_items(emcStatus->motion.traj.joints); @@ -3314,6 +3315,14 @@ int main(int argc, char *argv[]) // update subordinate status emcMotionUpdate(&emcStatus->motion); + // On a motion enabled -> disabled edge (limit switch, amp fault, + // following error, etc.) unhome joints marked VOLATILE_HOME. The estop + // and machine-off paths already do their own unhome; this catches the + // remaining drive-disable causes that don't flip task state. + if (prev_traj_enabled && !emcStatus->motion.traj.enabled) { + emcJointUnhome(-2); // only those joints which are volatile_home + } + prev_traj_enabled = emcStatus->motion.traj.enabled; // synchronize subordinate states if (emcStatus->io.aux.estop) { if (emcStatus->motion.traj.enabled) {