[BUG] [marlin-bugfix-2.0] G54 + G92 X0 Y0 Inadvertently Resets ...

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:

/** * CNC Coordinate Systems * * Enables G53 and G54-G59.3 commands to select coordinate systems * and G92.1 to reset the workspace to native machine space. * #define CNC_COORDINATE_SYSTEMS

Enter the following Gcode commands:

<power cycle device> G21 ; millimeters G90 ; absolute coords G53 ; machine coordinate system M114 ; get position X:0.00 Y:0.00 Z:0.00 E:0.00 Count X:0 Y:0 Z:0 G54 ; switch to (1st) work coordinate system G0 X10 Y10 ; move X:10.00 Y:10.00 Z:0.00 E:0.00 Count X:2000 Y:2000 Z:0 G92 X0 Y0 ; set current position as new origin (similar to G10 L20 P1 X0 Y0) M114 ; get position X:0.00 Y:0.00 Z:0.00 E:0.00 Count X:2000 Y:2000 Z:0 G53 ; switch back to machine coordinates M114 ; get position X:0.00 Y:0.00 Z:0.00 E:0.00 Count X:2000 Y:2000 Z:0

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:

<power cycle device> G21 ; millimeters G90 ; absolute coords G53 ; machine coordinate system M114 ; get position X:0.00 Y:0.00 Z:0.00 E:0.00 Count X:0 Y:0 Z:0 G55 ; switch to (2nd) work coordinate system G0 X10 Y10 ; move X:10.00 Y:10.00 Z:0.00 E:0.00 Count X:2000 Y:2000 Z:0 G92 X0 Y0 ; set current position as new origin (similar to G10 L20 P2 X0 Y0) M114 ; get position X:0.00 Y:0.00 Z:0.00 E:0.00 Count X:2000 Y:2000 Z:0 G53 ; switch back to machine coordinates M114 ; get position X:10.00 Y:10.00 Z:0.00 E:0.00 Count X:2000 Y:2000 Z:0

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.

Từ khóa » G54 X0 Y0