@@ -418,6 +418,7 @@ static int homingWaitJoint = -1; // joint (-1 = all) we're waiting on
418418static bool homingWaiting = false ; // true while EMC_TASK_EXEC::WAITING_FOR_HOMING is active
419419static bool homingStarted = false ; // true once we've observed .homing go true at least once
420420static double homingIssueTime = 0.0 ; // etime() when issued, for the start-timeout below
421+ static unsigned int homingRunsAtIssue = 0 ; // motion's homing_runs before the home was issued
421422// Some motion-side guards (e.g. "must be in joint mode to home",
422423// motion.homing-inhibit, already-homing) reject with reportError() and a
423424// bare return, without setting commandStatus to a failure -- so a rejected
@@ -1744,6 +1745,7 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
17441745 homingWaitJoint = target_joint;
17451746 homingStarted = false ;
17461747 homingIssueTime = etime ();
1748+ homingRunsAtIssue = emcStatus->motion .homing_runs ;
17471749 homingWaiting = true ;
17481750 retval = emcJointHome (target_joint);
17491751 if (retval != 0 ) {
@@ -2926,6 +2928,13 @@ static int emcTaskExecute(void)
29262928 homingStarted = true ;
29272929 break ; // still running; no timeout once started (see HOMING_START_TIMEOUT comment)
29282930 }
2931+ // A short run (homing in place takes a few servo cycles) can start
2932+ // and end between two of task's status reads. On a re-home the
2933+ // joints read homed before and after it, so only motion's run
2934+ // counter shows that it happened.
2935+ if (emcStatus->motion .homing_runs != homingRunsAtIssue) {
2936+ homingStarted = true ;
2937+ }
29292938 if (!homingStarted) {
29302939 // Never observed homing go active: motion silently rejected
29312940 // it (a guard like "must be in joint mode", or
0 commit comments