Improve LCD leveling value edits

This commit is contained in:
Scott Lahteine 2017-10-13 21:35:25 -05:00
parent b07a2aa23c
commit ece14af556

View File

@ -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"));