Browse Source

Merge pull request #4834 from thinkyhead/rc_code_bool

Standardize code_value_bool
Scott Lahteine 8 years ago
parent
commit
fef959c31a
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      Marlin/Marlin_main.cpp

+ 2
- 2
Marlin/Marlin_main.cpp View File

@@ -1127,7 +1127,7 @@ inline uint16_t code_value_ushort() { return (uint16_t)strtoul(seen_pointer + 1,
1127 1127
 
1128 1128
 inline uint8_t code_value_byte() { return (uint8_t)(constrain(strtol(seen_pointer + 1, NULL, 10), 0, 255)); }
1129 1129
 
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; }
1131 1131
 
1132 1132
 #if ENABLED(INCH_MODE_SUPPORT)
1133 1133
   inline void set_input_linear_units(LinearUnit units) {
@@ -5939,7 +5939,7 @@ void quickstop_stepper() {
5939 5939
   /**
5940 5940
    * M420: Enable/Disable Mesh Bed Leveling
5941 5941
    */
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()); }
5943 5943
 
5944 5944
   /**
5945 5945
    * M421: Set a single Mesh Bed Leveling Z coordinate

Loading…
Cancel
Save