From ece14af5565ea7b72b6082af1415d94da4efdd3f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 13 Oct 2017 21:35:25 -0500 Subject: [PATCH] Improve LCD leveling value edits --- Marlin/ultralcd.cpp | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 98c339ddc..d598db67a 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1909,11 +1909,12 @@ void kill_screen(const char* lcd_msg) { enqueue_and_echo_commands_P(PSTR("G28")); } - static bool _level_state; - void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(_level_state); } + static bool new_level_state; + void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(new_level_state); } #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - void _lcd_set_z_fade_height() { set_z_fade_height(planner.z_fade_height); } + static float new_z_fade_height; + void _lcd_set_z_fade_height() { set_z_fade_height(new_z_fade_height); } #endif /** @@ -1936,13 +1937,11 @@ void kill_screen(const char* lcd_msg) { if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); - else if (leveling_is_valid()) { - _level_state = planner.leveling_active; - MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &_level_state, _lcd_toggle_bed_leveling); - } + else if (leveling_is_valid()) + MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_Z_FADE_HEIGHT, &planner.z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height); #endif // @@ -1973,6 +1972,16 @@ void kill_screen(const char* lcd_msg) { END_MENU(); } + void _lcd_goto_bed_leveling() { + currentScreen = lcd_bed_leveling; + #if ENABLED(LCD_BED_LEVELING) + new_level_state = planner.leveling_active; + #endif + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + new_z_fade_height = planner.z_fade_height; + #endif + } + #elif ENABLED(AUTO_BED_LEVELING_UBL) void _lcd_ubl_level_bed(); @@ -2541,7 +2550,13 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(PROBE_MANUALLY) if (!g29_in_progress) #endif - MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling); + MENU_ITEM(submenu, MSG_BED_LEVELING, + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + _lcd_goto_bed_leveling + #else + lcd_bed_leveling + #endif + ); #else #if PLANNER_LEVELING MENU_ITEM(gcode, MSG_BED_LEVELING, PSTR("G28\nG29"));