Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[BUG] [marlin-bugfix-2.0] G54 + G92 X0 Y0 inadvertently resets origin in G53 machine coordinate system as well. #14743
Thank you for all your hard work developing and maintaining the Marlin codebase!
You can run this on any Marlin gcode parser to replicate:
[CNC_Coordinate_Systems] needs to be enabled in [configuration_adv.h] to enable G53-G59 coordinate systems:
Enter the following Gcode commands:
Setting an origin in G54 inadvertently also sets it as origin in G53. G53 should not be affected and should display absolute machine coordinates at all times i.e. X:10.00 Y:10.00 at this point.
If we repeat this using G55 we get the following:
Note how Machine Coordinates are not affected by zeroing X and Y in G55 using G92 X0 Y0 and continue to display the true absolute machine coordinates at all times.
I believe there is a bit of confusion here. G53 is not a workspace itself, it is a modifier. It tells the printer to move in accordance to the selected workspace ie G54 - 59.3 : http://marlinfw.org/docs/gcode/G054-059.html
G53 can be used like so:
Yes, G53 is a modifier i.e. G53 G0 X100 Y100.
Use native space
My use of G53 is exactly this: to return to the native space i.e. machine coordinate system. I simply use a G53 command to be absolutely certain of my current position in machine coordinates before I switch to G54 or G55 in the two examples provided.
The point is that in the two examples provided, setting an origin in G55 using G92 X0 Y0 does not affect G53 machine coordinates (correct behavior) whereas setting an origin in G54 using G92 X0 Y0 does affect G53 machine coordinates (incorrect behavior).
As a result, it is impossible to use work position coordinates (G54) in CNC.js or other CNC Marlin interfaces:
If you try to zero X and Y (G92 X0 Y0) in work position coordinates (G54), the machine coordinates DRO will instantly change to "0.00" and "0.00" as well (!)
The two Gcode examples provided show exactly where it goes wrong. You can easily reproduce the error by running the commands provided.
Executing G92 X0 Y0 in a work coordinate system (G54-G59) should NEVER affect native space / machine coordinates / G93.
I stand corrected. G53 as a modifier should move relative to native space and when called by itself should switch back to native space.