Skip to content

interp: add new ini setting 'DISABLE_AUTO_G54_ON_PROGSTOP'#4093

Open
Sigma1912 wants to merge 1 commit into
LinuxCNC:masterfrom
Sigma1912:feature_g54_on_program_stop
Open

interp: add new ini setting 'DISABLE_AUTO_G54_ON_PROGSTOP'#4093
Sigma1912 wants to merge 1 commit into
LinuxCNC:masterfrom
Sigma1912:feature_g54_on_program_stop

Conversation

@Sigma1912
Copy link
Copy Markdown
Contributor

As requested here:
https://forum.linuxcnc.org/38-general-linuxcnc-questions/58821-how-to-remove-automatic-g54-after-m2-m30#346816

Adds a new ini file setting to disable the automatic resetting of the current WCS to G54 on program stop (M2/M30/M99):

[RS274NGC]
DISABLE_AUTO_G54_ON_PROGSTOP = 1

Note:
DISABLE_AUTO_G54_ON_PROGSTOP defaults to '0' so this modification of M2,M30 and M99 behavior is opt-in and default behavior is unchanged.

Comment thread src/emc/rs274ngc/interp_internal.hh Outdated
Comment on lines 828 to 829
int disable_auto_g54_on_progstop;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a boolean value in a C++ program. Why are you adding it as int and initialize it with 0 (zero) instead of false (in interp_setup.cc)? Wouldn't it be more appropriate to use bool?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, changed.

(I was following the existing setting 'disable_g92_persistence')

Comment thread docs/src/config/ini-config.adoc Outdated
Comment on lines +638 to +639
* `DISABLE_AUTO_G54_ON_PROGSTOP = 0` (Default: 0) +
When set, M2,M30 and M99 will no longer automatically reset the active WCS to 'G54'.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a boolean value. You should note that it is a boolean value here.
(also the other boolean values should be marked as such, but one things at a time)

Also, you should also add it to the list of boolean values to check in src/emc/ini/linuxcnc_check_ini.py in the list of the check_bools() function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Changed to '(bool, Default: 0)'. Happy to change that to another format if preferred.

  • Added to the list in check_bools()

@zz912
Copy link
Copy Markdown
Contributor

zz912 commented May 31, 2026

Can I ask you add it in to pncconf?

here:


add:

        print("# When DISABLE_AUTO_G54_ON_PROGSTOP = 1'", file=file)
        print("# M2,M30 and M99 will no longer'", file=file)
        print("# automatically reset the active WCS to 'G54'", file=file)
        print("DISABLE_AUTO_G54_ON_PROGSTOP = 0", file=file)

@zz912
Copy link
Copy Markdown
Contributor

zz912 commented May 31, 2026

I tested main functionality of this PR in Gmoccapy. It works.

@Sigma1912 Sigma1912 force-pushed the feature_g54_on_program_stop branch 3 times, most recently from 5ca515e to 42c29ac Compare June 1, 2026 00:00
Adding this to the ini file will disable the automatic resetting of the current WCS to G54 on program stop (M2/M30/M99):

[RS274NGC]
DISABLE_AUTO_G54_ON_PROGSTOP = 1

Note:
DISABLE_AUTO_G54_ON_PROGSTOP defaults to '0' so this modification of M2,M30 and M99 behavior is opt-in and default behavior is unchanged.
@Sigma1912 Sigma1912 force-pushed the feature_g54_on_program_stop branch from 42c29ac to 93791ad Compare June 1, 2026 00:01
@Sigma1912
Copy link
Copy Markdown
Contributor Author

@zz912
Added as requested (I made the comment a bit more compact)

@Sigma1912 Sigma1912 changed the title add new ini setting 'DISABLE_AUTO_G54_ON_PROGSTOP' interp: add new ini setting 'DISABLE_AUTO_G54_ON_PROGSTOP' Jun 1, 2026
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.

3 participants