gcode: fix ROTATION_ENABLE 2nd-axis offset double-applied on rotated G54 XY moves

In the both-rotation-axes branch, bit_false(r_around.mask, bit(idx)) used the stale
outer loop variable idx instead of idx_0. When idx != idx_0, idx_1 (the second
rotation-plane axis) came out wrong, so in the final offset loop that axis was not
recognized as a rotation axis and its WCS offset was applied a second time. Result:
a rotated G54 move with both X and Y present targeted (work + 2x offset) on the second
axis -> false soft-limit (Alarm:2). Reproduced on hardware; only a nonzero WCS rotation
+ a full-plane G54 move triggers it. Fix: clear bit(idx_0).

Upstream grblHAL bug - PR-worthy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
stevenrwood
2026-07-13 10:58:59 -07:00
co-authored by Claude Opus 4.8
parent 09f8ba597a
commit 209228086f
+1 -1
View File
@@ -3068,7 +3068,7 @@ status_code_t gc_execute_block (char *block)
axis_words.mask |= r_around.mask;
} else {
idx_0 = ffs(r_around.mask) - 1;
bit_false(r_around.mask, bit(idx));
bit_false(r_around.mask, bit(idx_0)); // clear the FIRST rotation axis to find the second (was bit(idx) - a stale loop var, which mis-set idx_1 -> the second axis's WCS offset got applied twice -> false soft-limit on rotated G54 XY moves)
idx_1 = ffs(r_around.mask) - 1;
}