@@ -3736,12 +3736,6 @@ STATIC tp_err_t tpHandleAbort(TP_STRUCT * const tp, TC_STRUCT * const tc,
37363736 return TP_ERR_NO_ACTION ;
37373737 }
37383738
3739- // REMOVED: Workaround for late abort no longer needed.
3740- // The abort-before-mode-change fix in emctask.cc (switching order of
3741- // emcTaskAbort() and emcTrajSetMode()) ensures aborts arrive before
3742- // fresh segments are queued, eliminating the race condition this was
3743- // trying to detect.
3744-
37453739 //If the motion has stopped, then it's safe to reset the TP struct.
37463740 if ( MOTION_ID_VALID (tp -> spindle .waiting_for_index ) ||
37473741 MOTION_ID_VALID (tp -> spindle .waiting_for_atspeed ) ||
@@ -5115,6 +5109,10 @@ int tpRunCycle(TP_STRUCT * const tp, long period)
51155109 * This prevents trapezoidal→Ruckig switch mid-execution which causes
51165110 * position discontinuity in cycles 2-8 after motion start. */
51175111 if (!__atomic_load_n (& tc -> shared_9d .profile .valid , __ATOMIC_ACQUIRE ) && tc -> progress < TP_POS_EPSILON ) {
5112+ /* Abort bypass: don't block abort behind profile wait */
5113+ if (tp -> aborting ) {
5114+ goto past_gates ;
5115+ }
51185116 static int profile_wait_count = 0 ;
51195117 profile_wait_count ++ ;
51205118
@@ -5140,6 +5138,10 @@ int tpRunCycle(TP_STRUCT * const tp, long period)
51405138 * their v_exit=0 is always correct, no correction needed. */
51415139 if (tc -> progress < TP_POS_EPSILON && queue_len < 2 && nexttc == NULL
51425140 && tc -> term_cond != TC_TERM_COND_EXACT ) {
5141+ /* Abort bypass: don't block abort behind queue gate */
5142+ if (tp -> aborting ) {
5143+ goto past_gates ;
5144+ }
51435145 static int gate_seg_id = -1 ;
51445146 static int gate_wait_count = 0 ;
51455147 /* Reset counter for each new segment */
@@ -5155,6 +5157,7 @@ int tpRunCycle(TP_STRUCT * const tp, long period)
51555157 }
51565158 gate_wait_count = 0 ;
51575159 }
5160+ past_gates :
51585161 }
51595162
51605163 tc_debug_print ("-------------------\n" );
0 commit comments