From 0b45a8ead76c696d08b9f153777497cc6b0a2c34 Mon Sep 17 00:00:00 2001 From: p-i-engineer Date: Thu, 22 Dec 2022 17:55:51 -0800 Subject: [PATCH] add preheat_before_bed_leveling to lcd menu --- Marlin/src/lcd/menu/menu_bed_leveling.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index 54c3e14169..6f8f546119 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -228,6 +228,7 @@ void do_level_hint(){ LCD_MESSAGEPGM(MSG_LEVEL_STATE); } void lcd_G29() { + #if ENABLED(PREHEAT_BEFORE_LEVELING) const celsius_t hotendPreheat = (LEVELING_NOZZLE_TEMP-2) > thermalManager.degTargetHotend(0) ? LEVELING_NOZZLE_TEMP : 0; const celsius_t bedPreheat = (LEVELING_BED_TEMP-2) > thermalManager.degTargetBed() ? LEVELING_BED_TEMP : 0; if (hotendPreheat || bedPreheat) { @@ -243,14 +244,23 @@ void lcd_G29() { queue.inject_P(all_axes_trusted() ? PSTR("G29") : PSTR("G29N")); ui.return_to_status(); } -} + #else + queue.inject_P(all_axes_trusted() ? PSTR("G29") : PSTR("G29N")); + ui.return_to_status(); + #endif + } + +#if ENABLED(PREHEAT_BEFORE_LEVELING) void do_home_hint(){ thermalManager.setTargetHotend(LEVELING_NOZZLE_TEMP, 0); thermalManager.setTargetBed(LEVELING_BED_TEMP); ui.return_to_status(); -} + } +#endif + void lcd_G28(){ + #if ENABLED(PREHEAT_BEFORE_LEVELING) const celsius_t hotendPreheat = (LEVELING_NOZZLE_TEMP-2) > thermalManager.temp_hotend[0].celsius ? LEVELING_NOZZLE_TEMP : 0; const celsius_t bedPreheat = (LEVELING_BED_TEMP-2) > thermalManager.temp_bed.celsius ? LEVELING_BED_TEMP : 0; if (hotendPreheat || bedPreheat) { @@ -267,9 +277,16 @@ void lcd_G28(){ thermalManager.setTargetBed(LEVELING_BED_TEMP); queue.inject_P(PSTR("G28\nG1 F240 Z0")); ui.return_to_status(); - } + } + +#else + queue.inject_P(PSTR("G28\nG1 F240 Z0")); + ui.return_to_status(); + +#endif } + /** * Step 1: Bed Level entry-point *