Skip to content

Comments

Fix G43.x - G49 in active gcodes#3813

Closed
Sigma1912 wants to merge 1 commit intoLinuxCNC:masterfrom
Sigma1912:Fix_G43.x-G49_in_active-gcodes
Closed

Fix G43.x - G49 in active gcodes#3813
Sigma1912 wants to merge 1 commit intoLinuxCNC:masterfrom
Sigma1912:Fix_G43.x-G49_in_active-gcodes

Conversation

@Sigma1912
Copy link
Contributor

@Sigma1912 Sigma1912 commented Feb 19, 2026

Current behavior shows active gcode 'G49' if current tool offset values are all zero and 'G43' if not. This leads to incorrect information if we use G43 on a tool with all zero offsets and shows 'G43' for all g43.x commands.

With this change we show
'G43', 'G43.1', 'G43.2' after the respective command
'G49' after g49 command

Note that nothing is shown at startup unless it (eg 'G49') is found in RS274NGC_STARTUP_CODE.

@Sigma1912
Copy link
Contributor Author

Relates to #3792

@Sigma1912
Copy link
Contributor Author

Sigma1912 commented Feb 19, 2026

Note that there is similar code for state flags which is not modified in this PR:

state.flags[GM_FLAG_TOOL_OFFSETS_ON] =

g_codes[9] = tag.flags[GM_FLAG_TOOL_OFFSETS_ON] ? G_43 : G_49;

@Sigma1912 Sigma1912 marked this pull request as draft February 19, 2026 16:27
@Sigma1912 Sigma1912 force-pushed the Fix_G43.x-G49_in_active-gcodes branch 3 times, most recently from 8fe3aa5 to ad60626 Compare February 19, 2026 19:19
@Sigma1912 Sigma1912 closed this Feb 20, 2026
@Sigma1912 Sigma1912 reopened this Feb 20, 2026
@Sigma1912 Sigma1912 force-pushed the Fix_G43.x-G49_in_active-gcodes branch from ad60626 to d743703 Compare February 20, 2026 08:33
@Sigma1912 Sigma1912 marked this pull request as ready for review February 20, 2026 08:38
@Sigma1912 Sigma1912 force-pushed the Fix_G43.x-G49_in_active-gcodes branch from d743703 to e6d0e2f Compare February 20, 2026 08:48
Current behavior shows 'G49' if current tool offset values are all zero
and 'G43' if not. 'G43.1' and 'G43.2' are both shown as 'G43'.

With this change we show
'G43', 'G43.1', 'G43.2' after the respective command
'G49' after g49 command

Note that nothing is shown on startup unless it (eg 'G49') is found in RS274NGC_STARTUP_CODE.
@Sigma1912 Sigma1912 force-pushed the Fix_G43.x-G49_in_active-gcodes branch from e6d0e2f to 4b2e51c Compare February 20, 2026 18:04
@Sigma1912
Copy link
Contributor Author

@rmu75
I had to remove the 'G49' on startup as this gets also executed on Abort which would lead to 'G49' being shown even with tool offset applied.
This happens because (block == NULL) is True on startup AND on Abort.

If you can think of a better approach please let me know.

@rmu75
Copy link
Collaborator

rmu75 commented Feb 20, 2026

My initial idea was to add a flag to the offsets, i.e. a "fake" offset.

@Sigma1912
Copy link
Contributor Author

My initial idea was to add a flag to the offsets, i.e. a "fake" offset.

That was my initial idea as well but then I thought it would be nice to have 'active gcodes' reflect G43.1 and G43.2 as well.

Do you know of a way to tell if we have a Startup vs Abort event?

@rmu75
Copy link
Collaborator

rmu75 commented Feb 20, 2026

That code here https://github.com/Sigma1912/linuxcnc/blob/4b2e51c12bcf470fba63e9d9070295c9f66cb9ab/src/emc/rs274ngc/interp_write.cc#L133 suggests block should be set if it is an abort... if it is not, sorry, no idea.

@Sigma1912 Sigma1912 marked this pull request as draft February 20, 2026 18:48
@Sigma1912
Copy link
Contributor Author

Replaced by #3816

@Sigma1912 Sigma1912 closed this Feb 21, 2026
@github-project-automation github-project-automation bot moved this from Todo to Done in LinuxCNC 2.10 Release Feb 21, 2026
@Sigma1912 Sigma1912 deleted the Fix_G43.x-G49_in_active-gcodes branch February 21, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants