From 230ae6a14385b8385dc66c2b3831e29ad3ce89f3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 23 May 2018 16:20:06 -0500 Subject: [PATCH] Default G30 to engage / disengage --- Marlin/src/gcode/parser.h | 2 +- Marlin/src/gcode/probe/G30.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index 378435c0f2..5c942b70b7 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -309,7 +309,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) { return seenval(c) ? value_bool() : seen(c); } + FORCE_INLINE static bool boolval(const char c, const bool dval=false) { return seenval(c) ? value_bool() : (seen(c) ? true : 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 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 8a3590e5ab..0c8472e05c 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) - * E Engage the probe for each probe + * E Engage the probe for each probe (default 1) */ 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 ProbePtRaise raise_after = parser.boolval('E') ? PROBE_PT_STOW : PROBE_PT_NONE; + const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE; const float measured_z = probe_pt(xpos, ypos, raise_after, 1); if (!isnan(measured_z)) {