Welcome! Log In Create A New Profile


Gcode problem: G60 and G61

Posted by MiriamtheCurrious 
Gcode problem: G60 and G61
May 22, 2022 01:55PM
I'm experimenting with hacking gcode for the purpose of making changing colors cleanly mid print and I've run into a strange problem. Essentially, I'm trying get the printer to lift the hot end, move to the side away from the print, pause for 2 min while I change the filament, then return to the place in the print it left off and continue the print. To do this I'm using the G60 and G61 commands to save the hotend position (G60) at the beginning of my code then return it to that position (G61). The problem is that while the X and Y axis return the correct positions with no problem the Z does not. I'm not sure if the problem is that the Z position isn't being saved or if the G60 isn't reading/acting on that information, and I don't know how to tell the difference. Here's one of the pieces of code I've tried:

;Color Change
G60 ;save position
G0 Z100 ;lift the hot end to 10mm from buildplate
G0 X5 Y5 ;move hotend away from print in the horizontal
M300 ;bleep
G4 S120 ;wait 2 mins
G28 ;autohome because sometimes I move the gantry while changing color
G0 Z100 ;lift to 10mm
G61 ;go back to saved position
;Resume print

I've been inserting this code into gcode generated by Cura at the point where I want the color change. It results in the printer trying to print a layer in the Z100mm height. If I insert another line to manually correct the Z position it works fine, but that requires more code editing.

G61, according to the Marlin Website: "Use this command to move to a saved position. To limit the move to only some axes, include one or more axis letters. Otherwise all axes will be included."
Based on that I tried adding the axis letters (XYZ), but still got the same result.

I'm running Marlin at the moment, which might be part of the problem, but Cura, which doesn't know which version of Marlin the Printer has and shows the same problem.

Does anyone have any idea why my code isn't working? Thanks
Re: Gcode problem: G60 and G61
May 22, 2022 07:09PM
g60/g61 save to position of the gcode as a label, It does not save the state of the machine

EDIT: My brain is clearly not working...

Edited 2 time(s). Last edit at 05/23/2022 04:00AM by Dust.
Re: Gcode problem: G60 and G61
May 23, 2022 03:39AM
Could you explain that in a bit more detail please? What do you mean by 'as a label'?
Re: Gcode problem: G60 and G61
May 23, 2022 04:00AM
Opps I was thinking of M808 (senility sucks)
Re: Gcode problem: G60 and G61
May 23, 2022 04:13AM
No worries, thanks for trying to help.
Re: Gcode problem: G60 and G61
May 23, 2022 04:26AM
Modern marlin 2 has a SAVED_POSITIONS_DEBUG so if you add "#define SAVED_POSITIONS_DEBUG" to your Configuration file you can watch the serial console for more information.
I don't know if this feature is in such an old version of marlin
Sorry, only registered users may post in this forum.

Click here to login