From 3986a84f77110643b5873a3bd8a748eb246e6f66 Mon Sep 17 00:00:00 2001
From: Luc Van Daele <lvd@sound-silence.com>
Date: Wed, 18 Oct 2017 21:03:17 +0200
Subject: [PATCH] boolval revisited (#8016)

---
 Marlin/src/gcode/calibrate/G33.cpp    | 2 +-
 Marlin/src/gcode/eeprom/M500-M503.cpp | 2 +-
 Marlin/src/gcode/parser.h             | 2 +-
 Marlin/src/gcode/probe/G30.cpp        | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp
index 0b3d753130..5746c3c4de 100644
--- a/Marlin/src/gcode/calibrate/G33.cpp
+++ b/Marlin/src/gcode/calibrate/G33.cpp
@@ -161,7 +161,7 @@ void GcodeSuite::G33() {
     return;
   }
 
-  const bool towers_set           = parser.boolval('T', true),
+  const bool towers_set           = !parser.boolval('T'),
              stow_after_each      = parser.boolval('E'),
              _0p_calibration      = probe_points == 0,
              _1p_calibration      = probe_points == 1,
diff --git a/Marlin/src/gcode/eeprom/M500-M503.cpp b/Marlin/src/gcode/eeprom/M500-M503.cpp
index 2809e34986..61f5aab4ae 100644
--- a/Marlin/src/gcode/eeprom/M500-M503.cpp
+++ b/Marlin/src/gcode/eeprom/M500-M503.cpp
@@ -51,7 +51,7 @@ void GcodeSuite::M502() {
    * M503: print settings currently in memory
    */
   void GcodeSuite::M503() {
-    (void)settings.report(!parser.boolval('S', true));
+    (void)settings.report(parser.boolval('S'));
   }
 
 #endif // !DISABLE_M503
diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h
index c829e66c98..e792c07a2e 100644
--- a/Marlin/src/gcode/parser.h
+++ b/Marlin/src/gcode/parser.h
@@ -294,7 +294,7 @@ public:
 
   // Provide simple value accessors with default option
   FORCE_INLINE static float    floatval(const char c, const float dval=0.0)   { return seenval(c) ? value_float()        : dval; }
-  FORCE_INLINE static bool     boolval(const char c, const bool dval=false)   { return seen(c)    ? value_bool()         : dval; }
+  FORCE_INLINE static bool     boolval(const char c)                          { return seenval(c) ? value_bool()      : seen(c); }
   FORCE_INLINE static uint8_t  byteval(const char c, const uint8_t dval=0)    { return seenval(c) ? value_byte()         : dval; }
   FORCE_INLINE static int16_t  intval(const char c, const int16_t dval=0)     { return seenval(c) ? value_int()          : dval; }
   FORCE_INLINE static uint16_t ushortval(const char c, const uint16_t dval=0) { return seenval(c) ? value_ushort()       : dval; }
diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp
index e84b520158..b50227913f 100644
--- a/Marlin/src/gcode/probe/G30.cpp
+++ b/Marlin/src/gcode/probe/G30.cpp
@@ -36,7 +36,7 @@
  *
  *   X   Probe X position (default current X)
  *   Y   Probe Y position (default current Y)
- *   S0  Leave the probe deployed
+ *   E   Engage the probe for each probe
  */
 void GcodeSuite::G30() {
   const float xpos = parser.linearval('X', current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER),
@@ -51,7 +51,7 @@ void GcodeSuite::G30() {
 
   setup_for_endstop_or_probe_move();
 
-  const float measured_z = probe_pt(xpos, ypos, parser.boolval('S', true), 1);
+  const float measured_z = probe_pt(xpos, ypos, parser.boolval('E'), 1);
 
   if (!isnan(measured_z)) {
     SERIAL_PROTOCOLPAIR("Bed X: ", FIXFLOAT(xpos));