<p>A second <code>G28</code> should not be necessary as it can be replaced by a <code>G0</code> or <code>G1</code> command, but in the end it should work when <code>RESTORE_LEVELING_AFTER_G28</code> has been set in firmware weren't it for a bug present in the <a href="https://github.com/MarlinFirmware/Marlin/issues/20990" rel="nofollow noreferrer">Marlin 2.0.7.2 and 2.0.x bug-fix release</a>.</p>

CC BY-SA 4.0
2021-02-16T23:38:33.467Z
2021-02-16T23:38:33.467Z
0scar
<p>I am working on a <a href="https://3dprinting.stackexchange.com/questions/15576/marlin-firmware-unload-filament-with-g-code">filament unload script</a>.
My current problem is that the script always does an auto bed leveling.</p>
<p>I have two scripts to test this issue:</p>
<p><code>LevelBed.gcode</code>:</p>
<pre><code>G28             ; Auto home
G29             ; Level bed
M500            ; Save to EEPROM
</code></pre>
<p><code>Move.gcode</code>:</p>
<pre><code>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
</code></pre>
<p><code>Move.gcode</code> does bed leveling (<code>LevelBed.gcode</code> was executed before).</p>
<p>How is it possible to do a movement from G-code without doing automatic bed leveling?</p>
<hr />
<p>My intention with <code>Move.gcode</code>:</p>
<ul>
<li>Do an auto home</li>
<li>Do a move to <code>(100, 100, 100)</code></li>
</ul>
<p>The problem:</p>
<ul>
<li>Bed leveling happens between the <code>Auto Home</code> and the <code>Move</code>. (It probes the bed at 9 points)</li>
</ul>
<hr />
<p>I think <code>G28</code> 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.</p>
<p><code>ColdExtrude.gcode</code></p>
<pre><code>G21           ; Metric values
M83           ; Extruder relative mode
M302 S5       ; Allow extrusion above 5C
G1 E-10 F200  ; Pull back filament a bit
M400
</code></pre>
<p>So I cannot eliminate doing an Auto Bed Leveling sequence after <code>G28</code>, but maybe I even won't need to do it :)</p>
<hr />
<p>This question remains relevant. I'll need a good print startup code for the <code>Cura</code> slicer.
It should do something like:</p>
<ul>
<li>Heat the bed</li>
<li>Auto Home</li>
<li>Auto Bed Level</li>
<li>Auto Home again</li>
<li>Lift up the hot-end a bit and heat it up</li>
<li>Draw a prime line</li>
</ul>
<p>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.</p>
<hr />
<p>I have recently noticed that the my load/unload scripts based on <code>ColdExtrude.gcode</code> 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 <code>G28</code> in my filament load/unload scripts, which involves an implicit Auto Bed Leveling sequence, which is time wasting.</p>
<p>So my question is still active:</p>
<p>How to do extrusion from <code>.gcode</code> without implicit execution of an Auto Bed Leveling sequence?</p>

CC BY-SA 4.0
2021-02-09T19:30:45.900Z
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](https://marlinfw.org/docs/gcode/G028.html)).
0scar
CC BY-SA 4.0
2021-02-09T19:39:04.600Z
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.
Endre
CC BY-SA 4.0
2021-02-10T13:05:41.890Z
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`?
0scar
CC BY-SA 4.0
2021-02-10T16:37:53.947Z
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.
Endre
CC BY-SA 4.0
2021-02-10T17:03:41.763Z
Please delete the question if it is not relevant anymore.
0scar
CC BY-SA 4.0
2021-02-10T22:50:19.823Z
@0scar, I think it is actually good question. It's the leftover, if you check [the previous one](/q/15576). I plan to try making similar setup the next weekend, and possibly reproduce this. @Endre would you mind [attaching your configuration files](https://meta.stackexchange.com/questions/47689/how-can-i-attach-a-file-to-a-post)? Btw. will it do ABL when you execute `G28 X Y`? Or if you execute `G28 Z` separately after then?
octopus8
CC BY-SA 4.0
2021-02-11T05:55:12.240Z
Why a second auto home, while a `G0 X0 Y0  Z10` would suffice. Homing is an action that should be performed once.
0scar
CC BY-SA 4.0
2021-02-11T08:15:36.957Z
Right. `G0` or `G1` move is sufficient instead of `G28`. What I have experienced that my `load/unload` scripts without `G28` are not functioning well sometimes. Sometimes they just start an auto-bed-level, without knowing where the origin is :(. As I see it is too risky to even do just a feeder gear rotation without `G28`, which involves a bed-level sequence which is sometimes time wasting.
Endre
CC BY-SA 4.0
2022-03-14T17:02:47.007Z
Maybe the board doesn't store the changes, that was pretty common for SKR boards and older Marlin firmware versions, that has been fixed now that the changes can be stored on the SD card of the board. What printer and which firmware is being used?
0scar
<marlin><g-code><bed-leveling>
Marlin firmware: move without auto bed leveling
Endre
# Marlin firmware: move without auto bed leveling

(Asked by: username_0 on 2021-02-09)

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:
LevelBed.gcode:
G28             ; Auto home
G29             ; Level bed
M500            ; Save to EEPROM

Move.gcode:
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.
ColdExtrude.gcode
G21           ; Metric values
M83           ; Extruder relative mode
M302 S5       ; Allow extrusion above 5C
G1 E-10 F200  ; Pull back filament a bit
M400

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?

**Tags:** marlin, g-code, bed-leveling
> **Comments:**
> **username_1**: 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](https://marlinfw.org/docs/gcode/G028.html)).  
> **username_0**: 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.  
> **username_1**: 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`?  
> **username_0**: 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.  
> **username_1**: Please delete the question if it is not relevant anymore.  
> **username_2**: @0scar, I think it is actually good question. It's the leftover, if you check [the previous one](/q/15576). I plan to try making similar setup the next weekend, and possibly reproduce this. @Endre would you mind [attaching your configuration files](https://meta.stackexchange.com/questions/47689/how-can-i-attach-a-file-to-a-post)? Btw. will it do ABL when you execute `G28 X Y`? Or if you execute `G28 Z` separately after then?  
> **username_1**: Why a second auto home, while a `G0 X0 Y0  Z10` would suffice. Homing is an action that should be performed once.  
> **username_0**: Right. `G0` or `G1` move is sufficient instead of `G28`. What I have experienced that my `load/unload` scripts without `G28` are not functioning well sometimes. Sometimes they just start an auto-bed-level, without knowing where the origin is :(. As I see it is too risky to even do just a feeder gear rotation without `G28`, which involves a bed-level sequence which is sometimes time wasting.  
> **username_1**: Maybe the board doesn't store the changes, that was pretty common for SKR boards and older Marlin firmware versions, that has been fixed now that the changes can be stored on the SD card of the board. What printer and which firmware is being used?  

---

## 1 answers

### Answer by username_1 on 2021-02-16. Score: 0

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 2.0.7.2 and 2.0.x bug-fix release](https://github.com/MarlinFirmware/Marlin/issues/20990).


---

