diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 2ed85a398..98fb0e60b 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -333,7 +333,6 @@ #if ENABLED(AUTO_BED_LEVELING_UBL) #include "ubl.h" extern bool defer_return_to_status; - extern bool ubl_lcd_map_control; unified_bed_leveling ubl; #define UBL_MESH_VALID !( ( ubl.z_values[0][0] == ubl.z_values[0][1] && ubl.z_values[0][1] == ubl.z_values[0][2] \ && ubl.z_values[1][0] == ubl.z_values[1][1] && ubl.z_values[1][1] == ubl.z_values[1][2] \ @@ -7742,11 +7741,9 @@ inline void gcode_M18_M84() { #endif } - #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) //only needed if have an LCD - ubl_lcd_map_control = false; - defer_return_to_status = false; + #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) // Only needed with an LCD + ubl_lcd_map_control = defer_return_to_status = false; #endif - } } @@ -12637,9 +12634,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { #if ENABLED(DISABLE_INACTIVE_E) disable_e_steppers(); #endif - #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) //only needed if have an LCD - ubl_lcd_map_control = false; - defer_return_to_status = false; + #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) // Only needed with an LCD + ubl_lcd_map_control = defer_return_to_status = false; #endif } diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index 84faa29df..e0b27cb9c 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -54,7 +54,6 @@ extern float probe_pt(const float &x, const float &y, bool, int); extern bool set_probe_deployed(bool); extern void set_bed_leveling_enabled(bool); - extern bool ubl_lcd_map_control; typedef void (*screenFunc_t)(); extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0); @@ -1569,7 +1568,8 @@ if (ubl_lcd_map_control) lcd_goto_screen(_lcd_ubl_output_map_lcd); - else lcd_return_to_status(); + else + lcd_return_to_status(); } #endif // NEWPANEL diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 3cd0dac5d..c9168db97 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -470,8 +470,14 @@ uint16_t max_display_update_time = 0; screen_history_depth = 0; } lcd_implementation_clear(); - #if ENABLED(LCD_PROGRESS_BAR) - // For LCD_PROGRESS_BAR re-initialize custom characters + // Re-initialize custom characters that may be re-used + #if DISABLED(DOGLCD) && ENABLED(AUTO_BED_LEVELING_UBL) + if (!ubl_lcd_map_control) lcd_set_custom_characters( + #if ENABLED(LCD_PROGRESS_BAR) + screen == lcd_status_screen + #endif + ); + #elif ENABLED(LCD_PROGRESS_BAR) lcd_set_custom_characters(screen == lcd_status_screen); #endif lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; @@ -547,15 +553,6 @@ uint16_t max_display_update_time = 0; void lcd_status_screen() { - #if DISABLED(DOGLCD) && ENABLED(AUTO_BED_LEVELING_UBL) - if(!ubl_lcd_map_control) - lcd_set_custom_characters( - #if ENABLED(LCD_PROGRESS_BAR) - const bool info_screen_charset = true - #endif - ); - #endif - #if ENABLED(ULTIPANEL) ENCODER_DIRECTION_NORMAL(); ENCODER_RATE_MULTIPLY(false); @@ -2151,6 +2148,7 @@ void kill_screen(const char* lcd_msg) { void _lcd_ubl_output_map_lcd(); void _lcd_ubl_map_homing() { + defer_return_to_status = true; if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL); lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW; if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) { @@ -2260,7 +2258,7 @@ void kill_screen(const char* lcd_msg) { * UBL Homing before LCD map */ void _lcd_ubl_output_map_lcd_cmd() { - ubl_lcd_map_control = true; // Used for returning to the map screen + ubl_lcd_map_control = true; // Return to the map screen (and don't restore the character set) if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) enqueue_and_echo_commands_P(PSTR("G28")); lcd_goto_screen(_lcd_ubl_map_homing); diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 2fb719bb8..909c13d40 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -188,6 +188,7 @@ void lcd_reset_status(); #if ENABLED(AUTO_BED_LEVELING_UBL) + extern bool ubl_lcd_map_control; void lcd_mesh_edit_setup(float initial); float lcd_mesh_edit(); void lcd_z_offset_edit_setup(float);