diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index d72e699198..4a7e703924 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -244,6 +244,11 @@ uint16_t max_display_update_time = 0; #include "../feature/bedlevel/mbl/mesh_bed_leveling.h" #endif + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + static float new_z_fade_height; + void _lcd_set_z_fade_height() { set_z_fade_height(new_z_fade_height); } + #endif + //////////////////////////////////////////// //////////// Menu System Actions /////////// //////////////////////////////////////////// @@ -991,6 +996,13 @@ void kill_screen(const char* lcd_msg) { * */ + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + void _lcd_goto_tune_menu() { + lcd_goto_screen(lcd_tune_menu); + new_z_fade_height = planner.z_fade_height; + } + #endif + void lcd_main_menu() { START_MENU(); MENU_BACK(MSG_WATCH); @@ -1018,7 +1030,13 @@ void kill_screen(const char* lcd_msg) { #endif if (planner.movesplanned() || IS_SD_PRINTING) { - MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu); + MENU_ITEM(submenu, MSG_TUNE, + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + _lcd_goto_tune_menu + #else + lcd_tune_menu + #endif + ); } else { MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu); @@ -1311,7 +1329,9 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING) MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1); #endif - + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height); + #endif // // Nozzle: // Nozzle [1-4]: @@ -1939,11 +1959,6 @@ void kill_screen(const char* lcd_msg) { static bool new_level_state; void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(new_level_state); } - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - static float new_z_fade_height; - void _lcd_set_z_fade_height() { set_z_fade_height(new_z_fade_height); } - #endif - /** * Step 1: Bed Level entry-point * @@ -2004,17 +2019,24 @@ void kill_screen(const char* lcd_msg) { END_MENU(); } - void _lcd_goto_bed_leveling() { - lcd_goto_screen(lcd_bed_leveling); - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + void _lcd_goto_bed_leveling() { + lcd_goto_screen(lcd_bed_leveling); new_z_fade_height = planner.z_fade_height; - #endif - } + } + #endif #elif ENABLED(AUTO_BED_LEVELING_UBL) void _lcd_ubl_level_bed(); + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + void _lcd_goto_ubl_level_bed() { + lcd_goto_screen(_lcd_ubl_level_bed); + new_z_fade_height = planner.z_fade_height; + } + #endif + static int16_t ubl_storage_slot = 0, custom_hotend_temp = 190, side_points = 3, @@ -2532,6 +2554,9 @@ void kill_screen(const char* lcd_msg) { MENU_ITEM(submenu, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map); MENU_ITEM(submenu, MSG_UBL_TOOLS, _lcd_ubl_tools_menu); MENU_ITEM(gcode, MSG_UBL_INFO_UBL, PSTR("G29 W")); + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height); + #endif END_MENU(); } @@ -2573,7 +2598,13 @@ void kill_screen(const char* lcd_msg) { // Level Bed // #if ENABLED(AUTO_BED_LEVELING_UBL) - MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, _lcd_ubl_level_bed); + MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + _lcd_goto_ubl_level_bed + #else + _lcd_ubl_level_bed + #endif + ); #elif ENABLED(LCD_BED_LEVELING) #if ENABLED(PROBE_MANUALLY) if (!g29_in_progress)