boolval revisited (#8016)

This commit is contained in:
Luc Van Daele 2017-10-18 21:03:17 +02:00 committed by Roxy-3D
parent 572cf0ec95
commit 3986a84f77
4 changed files with 5 additions and 5 deletions

View file

@ -161,7 +161,7 @@ void GcodeSuite::G33() {
return; return;
} }
const bool towers_set = parser.boolval('T', true), const bool towers_set = !parser.boolval('T'),
stow_after_each = parser.boolval('E'), stow_after_each = parser.boolval('E'),
_0p_calibration = probe_points == 0, _0p_calibration = probe_points == 0,
_1p_calibration = probe_points == 1, _1p_calibration = probe_points == 1,

View file

@ -51,7 +51,7 @@ void GcodeSuite::M502() {
* M503: print settings currently in memory * M503: print settings currently in memory
*/ */
void GcodeSuite::M503() { void GcodeSuite::M503() {
(void)settings.report(!parser.boolval('S', true)); (void)settings.report(parser.boolval('S'));
} }
#endif // !DISABLE_M503 #endif // !DISABLE_M503

View file

@ -294,7 +294,7 @@ public:
// Provide simple value accessors with default option // 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 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 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 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; } FORCE_INLINE static uint16_t ushortval(const char c, const uint16_t dval=0) { return seenval(c) ? value_ushort() : dval; }

View file

@ -36,7 +36,7 @@
* *
* X Probe X position (default current X) * X Probe X position (default current X)
* Y Probe Y position (default current Y) * Y Probe Y position (default current Y)
* S0 Leave the probe deployed * E Engage the probe for each probe
*/ */
void GcodeSuite::G30() { void GcodeSuite::G30() {
const float xpos = parser.linearval('X', current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER), 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(); 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)) { if (!isnan(measured_z)) {
SERIAL_PROTOCOLPAIR("Bed X: ", FIXFLOAT(xpos)); SERIAL_PROTOCOLPAIR("Bed X: ", FIXFLOAT(xpos));