From d5509cada061dacabd98874d92448144444bd55e Mon Sep 17 00:00:00 2001 From: Luca Toniolo <10792599+grandixximo@users.noreply.github.com> Date: Sat, 19 Sep 2026 22:26:59 +0800 Subject: [PATCH] homing: stop the correct joints when aborting a homing sequence HOME_ABORT loops over all joints to stop their free planners, but it indexed through the local 'joint' pointer, which already points at joints[joint_num]. An abort raised from joint N stopped joints N..N+ all_joints-1 instead of 0..all_joints-1: lower-numbered homing joints kept running with their homing state already cleared, and with more than EMCMOT_MAX_JOINTS/2 joints the write runs off the end of the joints array entirely. On a gantry this shows up when the higher-numbered joint of the pair aborts (stuck home switch, switch bounce, limit hit): the partner joint's planner is never stopped, and it faults with a following error naming the partner, not the joint that caused the abort. Refs #4572 --- src/emc/motion/homing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emc/motion/homing.c b/src/emc/motion/homing.c index 662cd2f3591..3d1c7ec0747 100644 --- a/src/emc/motion/homing.c +++ b/src/emc/motion/homing.c @@ -1388,7 +1388,7 @@ static int base_1joint_state_machine(int joint_num) H[i].homing = 0; H[i].homed = 0; H[i].joint_in_sequence = 0; - joint[i].free_tp.enable = 0; + joints[i].free_tp.enable = 0; H[i].home_state = HOME_IDLE; H[i].index_enable = 0; }