Skip to content

Commit fef959c

Browse files
authored
Merge pull request #4834 from thinkyhead/rc_code_bool
Standardize code_value_bool
2 parents 07ac9a1 + 661fe09 commit fef959c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Marlin/Marlin_main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ inline uint16_t code_value_ushort() { return (uint16_t)strtoul(seen_pointer + 1,
11271127

11281128
inline uint8_t code_value_byte() { return (uint8_t)(constrain(strtol(seen_pointer + 1, NULL, 10), 0, 255)); }
11291129

1130-
inline bool code_value_bool() { return code_value_byte() > 0; }
1130+
inline bool code_value_bool() { return !code_has_value() || code_value_byte() > 0; }
11311131

11321132
#if ENABLED(INCH_MODE_SUPPORT)
11331133
inline void set_input_linear_units(LinearUnit units) {
@@ -5939,7 +5939,7 @@ void quickstop_stepper() {
59395939
/**
59405940
* M420: Enable/Disable Mesh Bed Leveling
59415941
*/
5942-
inline void gcode_M420() { if (code_seen('S') && code_has_value()) mbl.set_has_mesh(code_value_bool()); }
5942+
inline void gcode_M420() { if (code_seen('S')) mbl.set_has_mesh(code_value_bool()); }
59435943

59445944
/**
59455945
* M421: Set a single Mesh Bed Leveling Z coordinate

0 commit comments

Comments
 (0)