Welcome! Log In Create A New Profile

Advanced

custom gcode for marlin

Posted by jf pion 
custom gcode for marlin
November 20, 2012 01:22PM
hello
I try to understand how it's working and i still have issue

I want at the begining of the print the head goes up 10 mm to avoid the glass bed fixation before homing
so I add

G90
G1 Z10 ; positionne à 10 de haut
G28 ; home all axes

at the start gcode in slicer 9.6 dev

I got

M190 S110 ; wait for bed temperature to be reached
M104 S240 ; set temperature
G90
G1 Z10 ; positionne à 10 de haut
G28 ; home all axes
M109 S240 ; wait for temperature to be reached
G90 ; use absolute coordinates
G21 ; set units to millimeters
G92 E0
M82 ; use absolute distances for extrusion
G1 F1800.000 E-2.00000
G1 Z0.800 F7800.000
G92 E0
G1 X78.600 Y91.250
G1 Z0.300
G1 F1800.000 E2.00000
G1 X78.860 Y90.770 F900.000 E2.01140

at the begining of the gcode file which look fine
but there is no Z move before the homing

what's wrong ? i must miss something obvious but what

thank you
Re: custom gcode for marlin
November 20, 2012 08:26PM
Marlin restricts movement until it knows where things are. When you first power up, you can only move AWAY from each axis home position until you actually home that axis. So if your height is above 10, and you just powered up, the "G1 Z10" command will be ignored until you home the z axis.

Perhaps you can achieve what you want with G91 - relative coordinates, G1 Z10 - to move up 10 from wherever you are, and then G90 - back to absolute coordinates.
Re: custom gcode for marlin
November 21, 2012 04:05AM
I will try thank you

I will try also to add G21 before the move, may be marlin want to know the unit it must move before moving

and it don't work always not only on power up, is marlin memorising the last position after a print ?
I think it does

thank you
Re: custom gcode for marlin
November 21, 2012 08:38AM
i try this simple gcode:

G28 Z0
G1 F1800.000 Z10.000 ; positionne à 10 de haut
G28 ; home all axes

there is the Z homing
no movement of z to up
x/y/z homing

so what's wrong ?
Re: custom gcode for marlin
November 21, 2012 09:34AM
got it !!!

in this marlin issue list :[github.com]
i found the M400 command ( not even mentionned in the wiki)

M400 wait for the buffer to clear

and it's working, look like the G28 command is not buffered but the movements G1 are

so it was skipped

with
G28 Z0
G1 F1800.000 Z10.000 ; positionne à 10 de haut
M400
G28 ; home all axes

I will be sure there won't be any crash on the hot bed and no crash on the glass fixation

good to know

and by the way it will be a good idea to add the M400 at the end of the gcode

M104 S0 ; turn off temperature
M140 S0 ; turn off hotbed
G92 Z0
G0 Z1 ; monte de 1mm
M400
G28 X0 ; home X axis
M84 ; disable motors

to avoid marlin to skip the last buffered segment of the print
Sorry, only registered users may post in this forum.

Click here to login