From d18d40e1d623305f42171385aedd57003bdc0dba Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Nov 2017 16:27:21 -0600 Subject: [PATCH] M290 report on change, P0 to leave Probe Z Offset alone --- Marlin/src/gcode/motion/M290.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index a0fcb504bf..2b62f5d569 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -33,6 +33,15 @@ #include "../../core/serial.h" #endif + +#if ENABLED(BABYSTEP_ZPROBE_OFFSET) + FORCE_INLINE void mod_zprobe_zoffset(const float &offs) { + zprobe_zoffset += offs; + SERIAL_ECHO_START(); + SERIAL_ECHOLNPAIR(MSG_PROBE_Z_OFFSET ": ", zprobe_zoffset); + } +#endif + /** * M290: Babystepping */ @@ -43,7 +52,7 @@ void GcodeSuite::M290() { const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2); thermalManager.babystep_axis((AxisEnum)a, offs * planner.axis_steps_per_mm[a]); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - if (a == Z_AXIS) zprobe_zoffset += offs; + if (a == Z_AXIS && parser.boolval('P', true)) mod_zprobe_zoffset(offs); #endif } #else @@ -51,14 +60,10 @@ void GcodeSuite::M290() { const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2); thermalManager.babystep_axis(Z_AXIS, offs * planner.axis_steps_per_mm[Z_AXIS]); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - zprobe_zoffset += offs; + if (parser.boolval('P', true)) mod_zprobe_zoffset(offs); #endif } #endif - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(MSG_PROBE_Z_OFFSET ": ", zprobe_zoffset); - #endif } #endif // BABYSTEPPING