Improve LCD leveling edits

This commit is contained in:
Scott Lahteine 2017-10-13 21:39:10 -05:00
parent 3e3911fb81
commit 8dd08425fd

View file

@ -1906,11 +1906,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
/**
@ -1934,13 +1935,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);
MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling);
}
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
//set_z_fade_height(planner.z_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
//
@ -1971,6 +1970,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"));