From bc45fb6b131598403c8fdc5089697d98dc878299 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 21 Mar 2018 01:08:44 -0500 Subject: [PATCH] Tweak use of move_z_after_probing --- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 5 ++++- Marlin/src/gcode/bedlevel/abl/G29.cpp | 2 +- Marlin/src/gcode/calibrate/G28.cpp | 2 +- Marlin/src/gcode/probe/G30.cpp | 4 +++- Marlin/src/gcode/probe/M401_M402.cpp | 4 +++- Marlin/src/module/probe.cpp | 2 +- Marlin/src/module/probe.h | 4 +--- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index b6b9486be..7c398dcb7 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -757,7 +757,10 @@ } while (location.x_index >= 0 && --count); STOW_PROBE(); - move_z_after_probing(); + + #if Z_AFTER_PROBING + move_z_after_probing(); + #endif restore_ubl_active_state_and_leave(); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 33afac494..5f009fc72 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -949,7 +949,7 @@ void GcodeSuite::G29() { if (planner.leveling_active) SYNC_PLAN_POSITION_KINEMATIC(); - #if HAS_BED_PROBE + #if HAS_BED_PROBE && Z_AFTER_PROBING move_z_after_probing(); #endif diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index e15ddb5e5..c6231c598 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -310,7 +310,7 @@ void GcodeSuite::G28(const bool always_home_all) { HOMEAXIS(Z); #endif } // home_all || homeZ - #if HOMING_Z_WITH_PROBE + #if HOMING_Z_WITH_PROBE && Z_AFTER_PROBING move_z_after_probing(); #endif #endif // Z_HOME_DIR < 0 diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index ee668a83a..c1bb0a214 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -62,7 +62,9 @@ void GcodeSuite::G30() { clean_up_after_endstop_or_probe_move(); - if (raise_after == PROBE_PT_STOW) move_z_after_probing(); + #if Z_AFTER_PROBING + if (raise_after == PROBE_PT_STOW) move_z_after_probing(); + #endif report_current_position(); } diff --git a/Marlin/src/gcode/probe/M401_M402.cpp b/Marlin/src/gcode/probe/M401_M402.cpp index e058b90a8..9beef4730 100644 --- a/Marlin/src/gcode/probe/M401_M402.cpp +++ b/Marlin/src/gcode/probe/M401_M402.cpp @@ -41,7 +41,9 @@ void GcodeSuite::M401() { */ void GcodeSuite::M402() { STOW_PROBE(); - move_z_after_probing(); + #if Z_AFTER_PROBING + move_z_after_probing(); + #endif report_current_position(); } diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 0f3defbb2..18e13fe31 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -465,7 +465,7 @@ bool set_probe_deployed(const bool deploy) { return false; } -#ifdef Z_AFTER_PROBING +#if Z_AFTER_PROBING // After probing move to a preferred Z position void move_z_after_probing() { if (current_position[Z_AXIS] != Z_AFTER_PROBING) { diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index 919602e98..0a3892eca 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -32,10 +32,8 @@ #if HAS_BED_PROBE extern float zprobe_zoffset; bool set_probe_deployed(const bool deploy); - #ifdef Z_AFTER_PROBING + #if Z_AFTER_PROBING void move_z_after_probing(); - #else - inline void move_z_after_probing() {} #endif enum ProbePtRaise : unsigned char { PROBE_PT_NONE, // No raise or stow after run_z_probe