From 427bc64ba137907fbdbc103622ae88106a31a250 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 5 Nov 2018 02:19:55 -0600 Subject: [PATCH] G28 O respects HOME_AFTER_DEACTIVATE Addressing #11271 --- Marlin/src/gcode/calibrate/G28.cpp | 24 ++++++++++++++++-------- Marlin/src/inc/SanityCheck.h | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 6f6ea3393..8a40e2bd6 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -192,14 +192,22 @@ void GcodeSuite::G28(const bool always_home_all) { } #endif - if (all_axes_known() && parser.boolval('O')) { // home only if needed - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM("> homing not needed, skip"); - SERIAL_ECHOLNPGM("<<< G28"); - } - #endif - return; + if (parser.boolval('O')) { + if ( + #if ENABLED(HOME_AFTER_DEACTIVATE) + all_axes_known() // homing needed anytime steppers deactivate + #else + all_axes_homed() // homing needed only if never homed + #endif + ) { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOLNPGM("> homing not needed, skip"); + SERIAL_ECHOLNPGM("<<< G28"); + } + #endif + return; + } } // Wait for planner moves to finish! diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index db0139be0..826351791 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1157,7 +1157,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #if ENABLED(HOME_AFTER_DEACTIVATE) || ENABLED(Z_SAFE_HOMING) #error "DISABLE_[XYZ] is not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING." #endif -#endif // DISABLE_[XYZ] +#endif /** * Filament Width Sensor