How to remove automatic g54 after M2/M30 ?

  • zz912
  • zz912's Avatar Topic Author
  • Away
  • Platinum Member
  • Platinum Member
More
31 May 2026 09:01 #346795 by zz912
M2 and M30 commands have the following effects:
  • Origin offsets are set to the default (like G54).
linuxcnc.org/docs/devel/html/gcode/m-code.html#mcode:m2-m30

In LCNC 2.7 it fortunately did not work.
In LCNC 2.9 it UNfortunately works.

My friends used LCNC 2.7.  They used G54 for vise number 1 G55 for vise number 2 and so on. They dont use G5X in ngc files. They have many many ngc files. They were happy.

They started use Mesa cards 7i96s so they had to upgrade to LCNC 2.9. But in LCNC 2.9 automatic Ǵ54 UNfortunately works again. It is very dangerous for them. They works on vise number 2 with active G55, but after program end G54 is activated.

I need help. Where is "automatic Ǵ54 after M2/M30" in source code? I want delete it for us using.

Please Log in or Create an account to join the conversation.

More
31 May 2026 11:30 #346797 by rodw
Seems this G54 reset occurs in Interp::convert_stop()
in interp_convert.cc
github.com/LinuxCNC/linuxcnc/blob/master...erp_convert.cc#L5052
edit at your own risk :)

Note this is where Gcode is converted to blocks that are stored in a circular buffer and subsequently executed by motion.

Please Log in or Create an account to join the conversation.

More
31 May 2026 11:42 - 31 May 2026 11:44 #346798 by rodw
Pretty sure you would just comment out these two lines
github.com/LinuxCNC/linuxcnc/blob/master...erp_convert.cc#L5177
// settings->origin_index = 1;
// settings->parameters[5220] = 1.0;

1 = G54 so this is where the reset is happening
parameters like 5220 are described here linuxcnc.org/docs/html/gcode/overview.ht...:numbered-parameters
Last edit: 31 May 2026 11:44 by rodw.

Please Log in or Create an account to join the conversation.

More
31 May 2026 12:25 #346799 by rodw
Actually, A neat way of dealing with this could be adding a new parameter (5391?) and modify the code so that if it was set to true, the original 2.7 buggy behaivour was restored eg
if settings->parameters[5391] == 0.0{
    settings->origin_index = 1;
    settings->parameters[5220] = 1.0;
}

Be worth playing with that.

 

Please Log in or Create an account to join the conversation.

  • zz912
  • zz912's Avatar Topic Author
  • Away
  • Platinum Member
  • Platinum Member
More
31 May 2026 13:47 #346801 by zz912
Replied by zz912 on topic How to remove automatic g54 after M2/M30 ?
Thank you for help.

I preffer:
if (INI configuration "AUTOMATIC_G54") == TRUE
{ settings->origin_index = 1;
settings->parameters[5220] = 1.0; }

Default value AUTOMATIC_G54 = TRUE
 

Please Log in or Create an account to join the conversation.

Time to create page: 0.235 seconds
Powered by Kunena Forum