Skip to content

interp: G43.1 and G43.2 axis words are offsets, never a move - #4675

Open
grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:g432-no-motion
Open

grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:g432-no-motion

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

A G43.2 line with axis words also moves in the modal motion mode. Reported by Sigma1912 on the axis_mm sim and on real hardware:

G0 X50 Y50
G10 L20 P0 X0 Y0 Z0
G53 X0 Y0 Z0
G43.2 X0 Y0    (moves to X0 Y0 of G54, machine 50,50)

enhance_block() turns axis words without a motion code into a move in the modal motion mode, and keeps G43.1 out of that. When G43.2 got axis words (2df2871, in 2.9.0), the check above it learned to accept them, but G43.2 was not kept out of the move. The documentation says G43.2 causes no motion.

Looking at the other tool offset codes, G43.1 and G43.2 had a second problem: a G-code in the same line that takes axis words of its own got the same words too. G1 G43.1 Z5 set the offset and fed to Z5, G92 G43.2 X1 set the tool offset and left a G92 offset of -2, and G28 G43.1 Z1 went through Z1 on the way home. The G43.1 documentation already lists motion on the same line as an error, but it was never checked.

With this change:

  • G43.1 and G43.2 with axis words never move.
  • Combining them with a motion code, or with another G-code that takes axis words (G10, G28, G30, G52, G92, G68.2, G68.4), is the error "Cannot use two g codes that both use axis values", as it already is for G10 and G92 with a motion code. G80 in the same line is still accepted.
  • G43 H, G43.4 H and G49 with axis words still move along them with the new offset, as before (G43 H1 Z5).
  • G10 L1, L10 and L11 never moved and are unchanged.

The G43.1 and G43.2 error lists in the G-code documentation name the rejected combinations.

tests/interp/g43-axis-words runs the interpreter only. It checks the reported sequence, that G43.1 and G43.2 move nothing under G0 or G1, that G43 H and G49 still move, and every rejected combination. It fails on master.

I found no program in the tree that combines these codes on one line.

@grandixximo

Copy link
Copy Markdown
Contributor Author

@andypugh this fixes two things. Both are in 2.9 as well:

  1. G43.2 with axis words also moves in the modal motion mode. After a G0, G43.2 X0 Y0 applies the offset and then goes to X0 Y0. The documentation says G43.2 causes no motion. Sigma1912 hit this on a real machine.
  2. G43.1 and G43.2 axis words were also used by another G-code in the same line: G1 G43.1 Z5 sets the offset and feeds to Z5. This PR turns that into an error, so programs that run today can be refused.

For 2.9, would you like a slimmer backport with only the first fix, a one-line change so G43.2 no longer moves? The second changes behaviour and seems a better fit for 2.10 only.

A line with axis words and no motion code moves in the modal motion mode,
except when G43.1 takes the axis words as offsets. Since G43.2 takes
axis words as well (2df2871), the check above lets them through for
G43.2 too, but the line still became a move: after G0, "G43.2 X0 Y0"
applied the offset and then went to X0 Y0. The documentation says G43.2
causes no motion.

A G-code in the same line that takes axis words of its own got them too:
"G1 G43.1 Z5" set the offset and fed to Z5, "G92 G43.2 X1" left a G92
offset of -2, "G28 G43.1 Z1" went through Z1 on the way home. The
documentation already calls motion on a G43.1 line an error.

G43.1 and G43.2 with axis words now leave the modal motion alone, and
a motion code or any other G-code that takes axis words in the same line
is "Cannot use two g codes that both use axis values", as for G10 and
G92. G80 in the line stays fine.

tests/interp/g43-axis-words: no move from G43.1 or G43.2 under G0 or
G1, G43 H and G49 with axis words still move with the new offset, and
every rejected combination.

Reported by Sigma1912.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant