From cd15c8c0dffa80ca589961474b4f4079af293ab9 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 22 Dec 2020 14:01:24 +0100 Subject: [PATCH] Fix G28 leveling state, UBL compile (#20499) --- Marlin/src/gcode/calibrate/G28.cpp | 7 ++++--- Marlin/src/inc/Conditionals_LCD.h | 1 + Marlin/src/inc/SanityCheck.h | 2 -- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index d262e453ef44..1440db2ea89e 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -233,8 +233,8 @@ void GcodeSuite::G28() { // Disable the leveling matrix before homing #if HAS_LEVELING - const bool leveling_restore_state = ENABLED(ENABLE_LEVELING_AFTER_G28) || TERN0(RESTORE_LEVELING_AFTER_G28, planner.leveling_active); - TERN_(PROBE_MANUALLY, g29_in_progress = false); // Cancel the active G29 session + IF_ENABLED(RESTORE_LEVELING_AFTER_G28, const bool leveling_restore_state = planner.leveling_active); + IF_ENABLED(PROBE_MANUALLY, g29_in_progress = false); // Cancel the active G29 session set_bed_leveling_enabled(false); #endif @@ -431,7 +431,8 @@ void GcodeSuite::G28() { do_blocking_move_to_z(delta_clip_start_height); #endif - TERN_(RESTORE_LEVELING_AFTER_G28, set_bed_leveling_enabled(leveling_restore_state)); + IF_ENABLED(RESTORE_LEVELING_AFTER_G28, set_bed_leveling_enabled(leveling_restore_state)); + IF_ENABLED(ENABLE_LEVELING_AFTER_G28, set_bed_leveling_enabled(true)); restore_feedrate_and_scaling(); diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 1c515881be57..5aa8bc344f75 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -802,6 +802,7 @@ #endif #if !HAS_LEVELING #undef RESTORE_LEVELING_AFTER_G28 + #undef ENABLE_LEVELING_AFTER_G28 #endif #ifdef GRID_MAX_POINTS_X diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 31c3698d36ac..7bf78d70822f 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1429,8 +1429,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "AUTO_BED_LEVELING_UBL requires EEPROM_SETTINGS. Please update your configuration." #elif !WITHIN(GRID_MAX_POINTS_X, 3, 15) || !WITHIN(GRID_MAX_POINTS_Y, 3, 15) #error "GRID_MAX_POINTS_[XY] must be a whole number between 3 and 15." - #elif !defined(RESTORE_LEVELING_AFTER_G28) && !defined(ENABLE_LEVELING_AFTER_G28) - #error "AUTO_BED_LEVELING_UBL used to enable RESTORE_LEVELING_AFTER_G28. To keep this behavior enable RESTORE_LEVELING_AFTER_G28. Otherwise define it as 'false'." #endif #elif HAS_ABL_NOT_UBL