Hello Guest it is May 15, 2021, 07:57:10 PM

Author Topic: G52 strange behaviour  (Read 1165 times)

0 Members and 1 Guest are viewing this topic.

G52 strange behaviour
« on: April 14, 2017, 07:46:03 PM »
If I go to MDI and enter G52X2Y2 the G92 work offset reflects that.  If I enter G52X0Y0, the G92 offsets go back to zero.  Here's the strange part.  When I run the code below, the G92 work offsets end up at X1 Y1 and the only way I can get it back to normal is to restart M4.  There is nothing in any of the other M codes causing this.  If I remove both instances of the G52, the problem goes away.

I also tried G92 with the same results.  Is there a setting somewhere in M4 telling it to go to X1Y1 at the end of a program?

Code: [Select]
G00 X9.44 Y4.97
M114 A0 B100
G01 X9.94 Y4.97
G02 I-4.97 J0
M115 A0
G00 X0 Y0

Re: G52 strange behaviour
« Reply #1 on: April 14, 2017, 08:17:50 PM »
I made a little progress.  The issue is with an M code.  M1105.  When I execute it from MDI it sets the work offsets to X1Y1, but when I run it from the editor it works fine.  I ran into this before where I changed an M code and even though the correct version always came up in the editor, M4 wouldn't let go of the original version.  I had to copy the code to a new M code that had never been used.  Probably have to do the same here, unless there is a way to let M4 know that it needs to let go of the old version.

I think way back when I first started messing with M4, I wrote some M codes to test the waters.  This was one of them.  I wrote one to apply an offset (M1105) and one to set the offset back to zero (M1106).  I've since re-wrote both of those M codes.  M110 works great, but M4 won't recognize the changes to M1105.
Re: G52 strange behaviour
« Reply #2 on: April 14, 2017, 11:06:31 PM »
Smurph (and others) have gone to some lengths to explain to me why you should name all your macros with a lower case m.

It turns out that Machs interpreter changes all uppercase letters to lowercase, therefore when Mach is searching for a macro it
will be looking for m.... not M.... as you coded. Windows is not case sensitive and will usually provide the right file but sometimes
it doesn't. Understanding how Mach searches for macros has saved me a number of snafus. Not sure that this is the problem
you describe but is a handy tip anyway...it will save you some headscratching down the line.

My wife left with my best friend...
     and I miss him!
Re: G52 strange behaviour
« Reply #3 on: April 15, 2017, 07:34:54 AM »
Interesting.  I'll try changing the Gcode to lower case "m".  The function names inside the macro code are all lower case.  Thanks.