What is the difference between M420 S and M420 S1?
I have been reading through the Marlin website about ABL (Auto Bed Leveling) and I see what appears to be conflicting information.
At https://marlinfw.org/docs/features/auto_bed_leveling.html it states that running
G28
(Auto Home) will turn off ABL and that to reactivate it you need to insert the codeM420 S1
.However at https://marlinfw.org/docs/gcode/G029-mbl.html it states:
G28
disables bed leveling. Follow withM420 S
to turn leveling on, or
useRESTORE_LEVELING_AFTER_G28
to automatically keep leveling on after
G28
The latter is referring mostly to manual bed leveling, but in this section is referring to ABL.
So what is the difference between the
S
and theS1
options?TL;DR
Short answer: "There is no difference!".
Long answer
G-code is parsed line by line. The parser in the firmware reads the command and the options (also called parameters) following it, comments are discarded.
Therefore, option
S
should be followed by a Boolean value0
for False or1
for True. Without a value it is undefined and should be reported as incorrect or treated as false (in my opinion). But, the developers have chosen differently. If a Boolean value is expected and the value is not given, the parameter is parsed astrue
. This has analogy with other software options or switches like e.g. used by Linux commands.This means that for Marlin the G-code
M420 S
is exactly the same asM420 S1
.I've checked this with another command (this is not depending on the G-code command as there is a single parser processiong the G-codes and the following parameters);
M211
whereM211 S
is exactly the same asM211 S1
.
License under CC-BY-SA with attribution
Content dated before 7/24/2021 11:53 AM