From 3b4c89e4b580792caa47d8eb2bcae0d971f152bf Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 9 Mar 2018 23:18:08 -0600 Subject: [PATCH] Move do_probe_raise closer to set_probe_deployed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …and limit the raise to Z_MAX_POS --- Marlin/src/module/probe.cpp | 40 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 0a4692a347..9d54d5c5ab 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -57,25 +57,6 @@ float zprobe_zoffset; // Initialized by settings.load() const int z_servo_angle[2] = Z_SERVO_ANGLES; #endif -/** - * Raise Z to a minimum height to make room for a probe to move - */ -inline void do_probe_raise(const float z_raise) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("do_probe_raise(", z_raise); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif - - float z_dest = z_raise; - if (zprobe_zoffset < 0) z_dest -= zprobe_zoffset; - - if (z_dest > current_position[Z_AXIS]) - do_blocking_move_to_z(z_dest); -} - #if ENABLED(Z_PROBE_SLED) #ifndef SLED_DOCKING_OFFSET @@ -353,6 +334,27 @@ inline void do_probe_raise(const float z_raise) { #endif // BLTOUCH +/** + * Raise Z to a minimum height to make room for a probe to move + */ +inline void do_probe_raise(const float z_raise) { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOPAIR("do_probe_raise(", z_raise); + SERIAL_CHAR(')'); + SERIAL_EOL(); + } + #endif + + float z_dest = z_raise; + if (zprobe_zoffset < 0) z_dest -= zprobe_zoffset; + + NOMORE(z_dest, Z_MAX_POS); + + if (z_dest > current_position[Z_AXIS]) + do_blocking_move_to_z(z_dest); +} + // returns false for ok and true for failure bool set_probe_deployed(const bool deploy) {