From bf9fc8ac0e4220ae47b134a65f8d53ae561ee20e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 5 Mar 2018 02:07:52 -0600 Subject: [PATCH] M851 - report only without parameters --- Marlin/src/gcode/probe/M851.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Marlin/src/gcode/probe/M851.cpp b/Marlin/src/gcode/probe/M851.cpp index 3f252f3042..36f7162371 100644 --- a/Marlin/src/gcode/probe/M851.cpp +++ b/Marlin/src/gcode/probe/M851.cpp @@ -29,16 +29,18 @@ #include "../../module/probe.h" void GcodeSuite::M851() { - SERIAL_ECHO_START(); - SERIAL_ECHOPGM(MSG_PROBE_Z_OFFSET); - if (parser.seen('Z')) { + if (parser.seenval('Z')) { const float value = parser.value_linear_units(); - if (!WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - SERIAL_ECHOLNPGM(" " MSG_Z_MIN " " STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " " MSG_Z_MAX " " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX)); - return; + if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) + zprobe_zoffset = value; + else { + SERIAL_ERROR_START(); + SERIAL_ERRORLNPGM("?Z out of range (" STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " to " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX) ")"); } - zprobe_zoffset = value; + return; } + SERIAL_ECHO_START(); + SERIAL_ECHOPGM(MSG_PROBE_Z_OFFSET); SERIAL_ECHOLNPAIR(": ", zprobe_zoffset); }