Marlin firmware: unload filament with G-code I have upgraded my ER-20 with a Bondtech dual gear feeder.
It is not or hardly possible to load/unload filament manually with this feeder, so some .gcode is needed to do it.
I wanted to implement something similar to the atomic cleaning method for unloading: https://ultimakernasupport.zendesk.com/hc/en-us/articles/115004187066-Atomic-Cleaning-Method
Here is my current .gcode:
G21 ; Metric values
G90 ; Absolute positioning
M82 ; Extruder absolute mode
G28 ; Auto home
M420 S1
G1 X100 Y100 Z100 F1000
; M92 E415 ; 415 steps/mm
M302 S105 ; Allow extrusion above 105C
M109 S218 ; Heat hotend to 218C
M400
G92 E0 ; Reset extruder positioning
M104 S160 ; Start the cool down
M117 Extrude prime blob
G1 E10 F100 ; Extrude a short before unload to avoid blob forming
M109 S160 ; Wait for 160C
M104 S110
G92 E0
G1 E0.2 F100 ; Pressurize the hotend
M117 Pressurize hotend
M109 S110 ; Heat hotend to 110C
G92 E0 ; Reset extruder positioning
M117 Pull out slow
G1 E-3 F200 ; Pull back a bit, slow
M117 Pull out fast
G1 E-430 F2000 ; Pull back 43cm with 2000mm/min
G92 E0 ; Reset extruder positioning
M400 ; Wait for command finish
M117 Remove the filament now
; M400 ; Wait for command finish
M302 S170 ; Allow extrusion above 170C
M104 S0

It doesn't work:

the auto bed leveling is always done, I don't know how to turn it off
when I see that the &quot;Extrude a short before unload to avoid blob forming&quot; event is happening, I also see the &quot;Pull out fast&quot; message on the display and the &quot;print&quot; process ends

Could anyone take a look at this code please? Or is there any .gcode validator for Marlin somewhere?
What I intend to do with this code:

heat up the hotend to 218 °C
extrude some material while a cool down to 160 °C is already started
when temp 160 °C is reached, start a cool-down process to 110 °C and push a little material to the feeder (pressurize)
when 110 °C is reached pull out some material from the hotend slow (maybe the feeder won't be enough strong to do it, but I have never reached this point to check)
then pull out the filament from the Bowden and feeder fast
There are three things to fix and one suggestion:

Change follwing lines of M109, using parameter R instead of S, because the latter is not waiting to cool down:
M109 R160 ; Wait for 160C
...
M109 R110 ; Heat hotend to 110C


The behavior of M420 will depend on type of bed leveling, saved mesh, etc. It is off topic to troubleshoot this. The printer operates 10 cm above the surface for this operation. G28 disables bed leveling. Why do you need to re-enable it? Just remove this line:
; M420 S1 - remove (or comment out)


Redefine maximum extrusion length in Configuration.h to allow for scripted long pull (G1 E-430), for example:
#define EXTRUDE_MAXLENGTH 450


Suggestion: Use relative mode for extrusion (M83) instead of absolute positioning (M82). It will simplify your code a lot. You just want to express the distance in E parameter. Then you will not have to reset position with G92 E0 every now and then (do it just once on the start). (I use this Extrusion mode also for slicing becuase it makes easier to re-start a print in case of failure).