I am working on a filament unload script. My current problem is that the script always does an auto bed leveling.

I have two scripts to test this issue:


G28             ; Auto home
G29             ; Level bed
M500            ; Save to EEPROM


M501            ; Restore from EEPROM (try to eliminate bed leveling)
G21             ; Metric values
G90             ; Absolute positioning
G28             ; Auto home
M420 S1         ; Enable bed leveling
G1 X100 Y100 Z100 F1000 ; Move
M400            ; Finish moves

Move.gcode does bed leveling (LevelBed.gcode was executed before).

How is it possible to do a movement from G-code without doing automatic bed leveling?

My intention with Move.gcode:

  • Do an auto home
  • Do a move to (100, 100, 100)

The problem:

  • Bed leveling happens between the Auto Home and the Move. (It probes the bed at 9 points)

I think G28 Auto Home is not required for filament load/unload scripts. My donor scripts for this purpose just contained them. I made an example script to just rotate the feeder gear and it seems to be working.


G21           ; Metric values
M83           ; Extruder relative mode
M302 S5       ; Allow extrusion above 5C
G1 E-10 F200  ; Pull back filament a bit

So I cannot eliminate doing an Auto Bed Leveling sequence after G28, but maybe I even won't need to do it :)

This question remains relevant. I'll need a good print startup code for the Cura slicer. It should do something like:

  • Heat the bed
  • Auto Home
  • Auto Bed Level
  • Auto Home again
  • Lift up the hot-end a bit and heat it up
  • Draw a prime line

I am afraid if this problem is not solved, an other Auto Bed Level sequence will be executed between the 2nd Auto Home and the hot-end lift up.

I have recently noticed that the my load/unload scripts based on ColdExtrude.gcode are not always working. Sometimes the printer starts Auto Bed Leveling without knowing the origin position and badly hits the X/Y movement limits. So I have to do G28 in my filament load/unload scripts, which involves an implicit Auto Bed Leveling sequence, which is time wasting.

So my question is still active:

How to do extrusion from .gcode without implicit execution of an Auto Bed Leveling sequence?

  • 1
    $\begingroup$ Could you please explain what you want to happen in what order? Probing the bed to determine the level is always done by the G29, so when you call it it will probe the bed, note that a G28 after G29 disables bed leveling. "Follow with M420 S to turn leveling on, or use RESTORE_LEVELING_AFTER_G28 to automatically keep leveling on after G28" (reference). $\endgroup$ – 0scar Feb 9 at 19:30
  • $\begingroup$ What I would like to do is an Auto Home, than a Move. The problem is that a bed leveling is happening in between (the bed is probed at 9 points), I don't want this bed leveling and I don't know how to turn it off. I guess RESTORE_LEVELING_AFTER_G28 is a C macro, I'd like to avoid FW recompilation and re-flashing. $\endgroup$ – Endre Feb 9 at 19:39
  • $\begingroup$ If so, that can only be caused by M420 then. But, I've looked into the sources of Marlin 2, but don't see that a level probing is instructed. Have you tried M420 S without the 1? $\endgroup$ – 0scar Feb 10 at 13:05
  • $\begingroup$ Hi @Oscar, thanks for your help. It also doesn't work as I expect with M420 S. But as I see I even don't have to solve this problem now to move forward. $\endgroup$ – Endre Feb 10 at 16:37
  • $\begingroup$ Please delete the question if it is not relevant anymore. $\endgroup$ – 0scar Feb 10 at 17:03

A second G28 should not be necessary as it can be replaced by a G0 or G1 command, but in the end it should work when RESTORE_LEVELING_AFTER_G28 has been set in firmware weren't it for a bug present in the Marlin and 2.0.x bug-fix release.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.