4
$\begingroup$

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 code M420 S1.

However at https://marlinfw.org/docs/gcode/G029-mbl.html it states:

G28 disables bed leveling. Follow with M420 S to turn leveling on, or use RESTORE_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 the S1 options?

$\endgroup$
4
$\begingroup$

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 value 0 for False or 1 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 as true. 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 as M420 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 where M211 S is exactly the same as M211 S1.

| improve this answer | |
$\endgroup$

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.