Welcome! Log In Create A New Profile

Advanced

custom gcode for marlin

Posted by jf pion 
custom gcode for marlin
November 20, 2012 11:21AM
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 05:32PM
jf pion Wrote:
-------------------------------------------------------
> 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

You did not have a speed set.

Also you will want it to home before moving up and to the center like. It is also a good idea to have the hotend up to temp before homing so it does not crash into the bed. This code will find the first layer temp set in the config and put it at the beginning.

M109 S[first_layer_temperature] ; preheat hotend before homing
G28 ; Home all axis
G1 Z10 F3000 ; Lift Z before moving to center
G1 X100 Y100 ; Move to center (assumed 100 x 100)
G1 Z0 ; Lower Z before starting to print


FFF Settings Calculator Gcode post processors Geometric Object Deposition Tool Blog
Tantillus.org Mini Printable Lathe How NOT to install a Pololu driver
Re: custom gcode for marlin
November 20, 2012 05:35PM
Before you home, you don't have absolute co-ordinates. At the very least, you can't trust them till you perform a home.

I think you need to change to relative co-ordinates first, then move up 10mm, then go back to absolute and home all axes.

eg:

G91 ; use relative co-ordinates
G1 Z10 F3000 ; positionne à 10 de haut
G28 ; home all axes

Note: There could be an issue here. If your print stops near the top of the machine (with less than 10mm to spare between top of the extruder and the top of your machine) and then you execute a new job, the first move will cause your Z axis to crash your extruder into the top of your machine (as it always goes up 10mm, no matter what). As long as you're aware of this, you can simply Home the axes yourself before a print.

You mention that you're trying to avoid the glass bed fixation. I assume you mean that you're trying to avoid whatever it is you are using to hold the glass bed in place? If so, any chance of a picture, as this might suggest a better way to handle the issue that has less drawbacks.

Edit: Sublime suggests a much nicer fix, and also mentions correctly that Z needs a Feed value set. I've edited the above G-Code to fix that, but left the rest the same.

Edited 1 time(s). Last edit at 11/20/2012 05:37PM by Cefiar.
Re: custom gcode for marlin
November 20, 2012 05:39PM
This should have nothing to do with G90 or G91. I personally have never used them and you should never need them.


FFF Settings Calculator Gcode post processors Geometric Object Deposition Tool Blog
Tantillus.org Mini Printable Lathe How NOT to install a Pololu driver
Re: custom gcode for marlin
November 21, 2012 03:58AM
Sublime Wrote:

>
> You did not have a speed set.
>
> Also you will want it to home before moving up and
> to the center like. It is also a good idea to have
> the hotend up to temp before homing so it does not
> crash into the bed. This code will find the first
> layer temp set in the config and put it at the
> beginning.
>
> M109 S ; preheat hotend before homing
> G28 ; Home all axis
> G1 Z10 F3000 ; Lift Z before moving to center
> G1 X100 Y100 ; Move to center (assumed 100 x 100)
> G1 Z0 ; Lower Z before starting to print

I'm using pronterface so there is no pb if the nozzle is in hight posistion a simple click on the home position will do the trick (first x then y then z to 0)
more my nozzle is just 0.5mm on the side of the hotbed so no risk to crash in it if cold and make a cleaning at the print start

but when i finish a print I pull the hot bed to the front to clear the acces to the printed part and so the nozzle is just in front of the fixation of the hot bed
if I print very flat part it is not high enough to avoid the crash when moving to x0
that's why i want to move the z up 10 mm

I tried
M190 S110 ; wait for bed temperature to be reached
M104 S240 ; set temperature
M109 S240 ; wait for temperature to be reached
G90
G92 Z0
G1 Z10.000 F7800.000 ; positionne à 10 de haut
G28 ; home all axes
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

but no change there is no move before the homing

i will try to put the G21 before the move i want, may be marlin want to know if it must move in mm or inches (which make sens but is not documented in the wiki)

i will keep you informed
Re: custom gcode for marlin
November 21, 2012 08:42AM
ok nothing is working

i tried the simple thing (the only lines of gcode)


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

I get the z homing

no movement up

x/y/z homing

what do I wrong ?
Re: custom gcode for marlin
November 21, 2012 09:36AM
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
Re: custom gcode for marlin
November 21, 2012 04:02PM
look like i step on a bug

[github.com]
Sorry, only registered users may post in this forum.

Click here to login