From 3583e2b4490e8fd6778d18003641c2fdd333e8a5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 30 Oct 2018 16:34:45 -0500 Subject: [PATCH] Followup to Menu Refactor (#12275) --- .../HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp | 6 +- .../HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp | 4 +- Marlin/src/HAL/HAL_LPC1768/spi_pins.h | 2 +- .../u8g/u8g_com_HAL_LPC1768_hw_spi.cpp | 4 +- .../u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp | 4 +- ...LPC1768_ssd_sw_i2c.cpp under construction | 4 +- .../u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp | 4 +- .../u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp | 4 +- .../u8g/u8g_com_HAL_LPC1768_sw_spi.cpp | 4 +- Marlin/src/HAL/HAL_STM32F7/HAL.cpp | 1 - Marlin/src/Marlin.cpp | 2 +- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 2 +- Marlin/src/feature/bedlevel/ubl/ubl.h | 2 +- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 2 +- Marlin/src/feature/pause.cpp | 38 ++++----- Marlin/src/gcode/bedlevel/G26.cpp | 26 +++--- Marlin/src/gcode/calibrate/G33.cpp | 4 +- Marlin/src/gcode/control/M17_M18_M84.cpp | 2 +- Marlin/src/gcode/control/M80_M81.cpp | 6 +- Marlin/src/gcode/feature/pause/M600.cpp | 4 +- Marlin/src/gcode/feature/pause/M701_M702.cpp | 10 +-- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/gcode/lcd/M0_M1.cpp | 6 +- Marlin/src/gcode/lcd/M145.cpp | 4 +- Marlin/src/gcode/parser.h | 4 +- Marlin/src/gcode/queue.cpp | 2 +- Marlin/src/gcode/queue.h | 2 +- Marlin/src/inc/Conditionals_post.h | 2 +- Marlin/src/inc/SanityCheck.h | 2 +- Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp | 11 ++- .../src/lcd/HD44780/ultralcd_common_HD44780.h | 48 +++++------ .../src/lcd/HD44780/ultralcd_impl_HD44780.cpp | 44 ++++------ Marlin/src/lcd/dogm/lcdprint_u8g.cpp | 4 +- .../u8g_dev_ssd1306_sh1106_128x64_I2C.cpp | 4 +- .../lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp | 4 +- .../lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp | 4 +- .../lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp | 63 +++++++------- Marlin/src/lcd/dogm/u8g_fontutf8.cpp | 4 +- Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp | 4 +- Marlin/src/lcd/menu/menu.cpp | 32 +++---- Marlin/src/lcd/menu/menu_configuration.cpp | 4 +- Marlin/src/lcd/ultralcd.cpp | 85 +++++++++---------- Marlin/src/lcd/ultralcd.h | 41 +++++---- Marlin/src/module/tool_change.cpp | 4 +- 45 files changed, 244 insertions(+), 273 deletions(-) diff --git a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp index 0dab3bb412..26c2ae8848 100644 --- a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp @@ -60,7 +60,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -156,6 +156,6 @@ uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD -#endif //__SAM3X8E__ +#endif //__SAM3X8E__ diff --git a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp index 243033e68b..968f63241c 100644 --- a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp @@ -57,7 +57,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include #include @@ -180,6 +180,6 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // ARDUINO_ARCH_SAM diff --git a/Marlin/src/HAL/HAL_LPC1768/spi_pins.h b/Marlin/src/HAL/HAL_LPC1768/spi_pins.h index 76c19c1176..2d2aed5cd6 100644 --- a/Marlin/src/HAL/HAL_LPC1768/spi_pins.h +++ b/Marlin/src/HAL/HAL_LPC1768/spi_pins.h @@ -25,7 +25,7 @@ #include "src/core/macros.h" -#if ENABLED(SDSUPPORT) && ENABLED(DOGLCD) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN) +#if ENABLED(SDSUPPORT) && HAS_GRAPHICAL_LCD && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN) #define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently // needed due to the speed and mode requred for communicating with each device being different. // This requirement can be removed if the SPI access to these devices is updated to use diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp index 9ac0ae460c..554f945892 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp @@ -57,7 +57,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD //#include #include @@ -132,6 +132,6 @@ uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp index 110d9149c4..c71bb4ba6a 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp @@ -79,7 +79,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -198,6 +198,6 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction index 80c8da7239..a0fd991654 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction @@ -63,7 +63,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -249,6 +249,6 @@ uint8_t u8g_com_HAL_LPC1768_ssd_sw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp index 827ae5abde..9139f1b8d8 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp @@ -57,7 +57,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD //#include #include @@ -148,6 +148,6 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp index 9e9b76439a..652ad54393 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp @@ -57,7 +57,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include #include "SoftwareSPI.h" @@ -151,6 +151,6 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp index 43b46d5ddf..a00c45b305 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp @@ -57,7 +57,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include #include "SoftwareSPI.h" @@ -125,6 +125,6 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp index a5c4f39429..87d3a5f30a 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp @@ -21,7 +21,6 @@ * */ - #ifdef STM32F7 // -------------------------------------------------------------------------- diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index faf4e6f204..4c6b3a0b9c 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -379,7 +379,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { #if ENABLED(DISABLE_INACTIVE_E) disable_e_steppers(); #endif - #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL) // Only needed with an LCD + #if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL) if (ubl.lcd_map_control) ubl.lcd_map_control = defer_return_to_status = false; #endif } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index 65235a5f42..bc5088f209 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -143,7 +143,7 @@ constexpr float unified_bed_leveling::_mesh_index_to_xpos[16], unified_bed_leveling::_mesh_index_to_ypos[16]; - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU bool unified_bed_leveling::lcd_map_control = false; #endif diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index 2e8af93141..f851b2e05c 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -157,7 +157,7 @@ class unified_bed_leveling { MESH_MIN_Y + 14 * (MESH_Y_DIST), MESH_MIN_Y + 15 * (MESH_Y_DIST) }; - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU static bool lcd_map_control; #endif diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 438c41b6a2..5a8087bf3e 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -628,7 +628,7 @@ LEAVE: - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_reset_alert_level(); lcd_quick_feedback(true); lcd_reset_status(); diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 6c232b5db8..751152b2c7 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -45,7 +45,7 @@ #include "../feature/runout.h" #endif -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../lcd/ultralcd.h" #endif @@ -102,7 +102,7 @@ static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_ } #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT, mode); #else UNUSED(mode); @@ -139,7 +139,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l #endif if (!ensure_safe_temperature(mode)) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) // Show status screen lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif @@ -148,7 +148,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l } if (pause_for_user) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) // Show "insert filament" lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode); #endif @@ -172,7 +172,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l KEEPALIVE_STATE(IN_HANDLER); } - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) // Show "wait for load" message lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode); #endif @@ -209,7 +209,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CONTINUOUS_PURGE); #endif @@ -224,7 +224,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l do { if (purge_length > 0) { // "Wait for filament purge" - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE, mode); #endif @@ -234,7 +234,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l } // Show "Purge More" / "Resume" menu and wait for reply - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) { KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = false; @@ -246,7 +246,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l // Keep looping if "Purge More" was selected } while ( - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU show_lcd && advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE #else 0 @@ -272,7 +272,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/ ) { if (!ensure_safe_temperature(mode)) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) // Show status screen lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif @@ -342,7 +342,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE); #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) // Show initial message lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT); #endif @@ -351,7 +351,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u SERIAL_ERROR_START(); SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) { // Show status screen lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); LCD_MESSAGEPGM(MSG_M600_TOO_COLD); @@ -416,7 +416,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u void wait_for_filament_reload(const int8_t max_beep_count/*=0*/ DXC_ARGS) { bool nozzle_timed_out = false; - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT); #endif SERIAL_ECHO_START(); @@ -454,11 +454,11 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/ DXC_ARGS) { nozzle_timed_out |= thermalManager.is_heater_idle(e); if (nozzle_timed_out) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE); #endif SERIAL_ECHO_START(); - #if ENABLED(ULTIPANEL) && ENABLED(EMERGENCY_PARSER) + #if HAS_LCD_MENU && ENABLED(EMERGENCY_PARSER) SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_HEAT); #elif ENABLED(EMERGENCY_PARSER) SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_HEAT_M108); @@ -475,11 +475,11 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/ DXC_ARGS) { // Wait for the heaters to reach the target temperatures ensure_safe_temperature(); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT); #endif SERIAL_ECHO_START(); - #if ENABLED(ULTIPANEL) && ENABLED(EMERGENCY_PARSER) + #if HAS_LCD_MENU && ENABLED(EMERGENCY_PARSER) SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT); #elif ENABLED(EMERGENCY_PARSER) SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT_M108); @@ -550,7 +550,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // Load the new filament load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, ADVANCED_PAUSE_MODE_PAUSE_PRINT DXC_PASS); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME); // "Wait for print to resume" #endif @@ -578,7 +578,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le runout.reset(); #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU // Show status screen lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index 5b666c96b9..f418fd7536 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -156,7 +156,7 @@ int16_t g26_bed_temp, int8_t g26_prime_flag; -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU /** * If the LCD is clicked, cancel, wait for release, return true @@ -164,7 +164,7 @@ int8_t g26_prime_flag; bool user_canceled() { if (!is_lcd_clicked()) return false; // Return if the button isn't pressed lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_quick_feedback(true); #endif wait_for_release(); @@ -327,7 +327,7 @@ inline bool look_for_lines_to_connect() { for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) { for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (user_canceled()) return true; // Check if the user wants to stop the Mesh Validation #endif @@ -418,14 +418,14 @@ inline bool turn_on_heaters() { if (g26_bed_temp > 25) { lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99); lcd_quick_feedback(true); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_external_control = true; #endif #endif thermalManager.setTargetBed(g26_bed_temp); while (ABS(thermalManager.degBed() - g26_bed_temp) > 3) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (is_lcd_clicked()) return exit_from_g26(); #endif @@ -448,7 +448,7 @@ inline bool turn_on_heaters() { thermalManager.setTargetHotend(g26_hotend_temp, 0); while (ABS(thermalManager.degHotend(0) - g26_hotend_temp) > 3) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (is_lcd_clicked()) return exit_from_g26(); #endif @@ -474,7 +474,7 @@ inline bool turn_on_heaters() { */ inline bool prime_nozzle() { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU #if ENABLED(PREVENT_LENGTHY_EXTRUDE) float Total_Prime = 0.0; #endif @@ -619,7 +619,7 @@ void GcodeSuite::G26() { if (parser.seen('P')) { if (!parser.has_value()) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU g26_prime_flag = -1; #else SERIAL_PROTOCOLLNPGM("?Prime length must be specified when not using an LCD."); @@ -664,7 +664,7 @@ void GcodeSuite::G26() { } int16_t g26_repeats; - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1); #else if (!parser.seen('R')) { @@ -723,7 +723,7 @@ void GcodeSuite::G26() { move_to(destination, 0.0); move_to(destination, g26_ooze_amount); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_external_control = true; #endif @@ -831,7 +831,7 @@ void GcodeSuite::G26() { plan_arc(endpoint, arc_offset, false); // Draw a counter-clockwise arc feedrate_mm_s = save_feedrate; set_destination_from_current(); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation #endif @@ -857,7 +857,7 @@ void GcodeSuite::G26() { for (int8_t ind = start_ind; ind <= end_ind; ind++) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation #endif @@ -906,7 +906,7 @@ void GcodeSuite::G26() { move_to(destination, 0); // Move back to the starting position //debug_current_and_destination(PSTR("done doing X/Y move.")); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_external_control = false; // Give back control of the LCD Panel! #endif diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 7ec76c1126..3aba869824 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -204,7 +204,7 @@ static float calibration_probe(const float &nx, const float &ny, const bool stow #endif } -#if HAS_BED_PROBE && ENABLED(ULTIPANEL) +#if HAS_BED_PROBE && HAS_LCD_MENU static float probe_z_shift(const float center) { STOW_PROBE(); endstops.enable_z_probe(false); @@ -588,7 +588,7 @@ void GcodeSuite::G33() { switch (probe_points) { case -1: - #if HAS_BED_PROBE && ENABLED(ULTIPANEL) + #if HAS_BED_PROBE && HAS_LCD_MENU zprobe_zoffset += probe_z_shift(z_at_pt[CEN]); #endif diff --git a/Marlin/src/gcode/control/M17_M18_M84.cpp b/Marlin/src/gcode/control/M17_M18_M84.cpp index 6a878884b9..cf448511e3 100644 --- a/Marlin/src/gcode/control/M17_M18_M84.cpp +++ b/Marlin/src/gcode/control/M17_M18_M84.cpp @@ -60,7 +60,7 @@ void GcodeSuite::M18_M84() { #endif } - #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL) // Only needed with an LCD + #if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL) if (ubl.lcd_map_control) ubl.lcd_map_control = defer_return_to_status = false; #endif } diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index 155fb59c21..573a44bfa3 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -27,7 +27,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../../lcd/ultralcd.h" #endif @@ -82,7 +82,7 @@ restore_stepper_drivers(); #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_reset_status(); #endif } @@ -115,7 +115,7 @@ void GcodeSuite::M81() { PSU_OFF(); #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF "."); #endif } diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index 64661e6e5e..07a6167a11 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -33,7 +33,7 @@ #include "../../../module/tool_change.h" #endif -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../../../lcd/ultralcd.h" #endif @@ -70,7 +70,7 @@ void GcodeSuite::M600() { #endif // Show initial "wait for start" message - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT, target_extruder); #endif diff --git a/Marlin/src/gcode/feature/pause/M701_M702.cpp b/Marlin/src/gcode/feature/pause/M701_M702.cpp index 5e438fc1ce..a50b4efe72 100644 --- a/Marlin/src/gcode/feature/pause/M701_M702.cpp +++ b/Marlin/src/gcode/feature/pause/M701_M702.cpp @@ -34,7 +34,7 @@ #include "../../../module/tool_change.h" #endif -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../../../lcd/ultralcd.h" #endif @@ -61,7 +61,7 @@ void GcodeSuite::M701() { if (parser.seenval('Z')) park_point.z = parser.linearval('Z'); // Show initial "wait for load" message - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, ADVANCED_PAUSE_MODE_LOAD_FILAMENT, target_extruder); #endif @@ -98,7 +98,7 @@ void GcodeSuite::M701() { #endif // Show status screen - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif } @@ -127,7 +127,7 @@ void GcodeSuite::M702() { if (parser.seenval('Z')) park_point.z = parser.linearval('Z'); // Show initial "wait for unload" message - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, target_extruder); #endif @@ -171,7 +171,7 @@ void GcodeSuite::M702() { #endif // Show status screen - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif } diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 593ae26cc9..83f0367910 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -427,7 +427,7 @@ void GcodeSuite::process_parsed_command( case 120: M120(); break; // M120: Enable endstops case 121: M121(); break; // M121: Disable endstops - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU case 145: M145(); break; // M145: Set material heatup parameters #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index d8fd7b972e..39f70aca4b 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -571,7 +571,7 @@ private: static void M190(); #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU static void M145(); #endif diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index b2b4ccd135..505fef340e 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -27,7 +27,7 @@ #include "../gcode.h" #include "../../module/stepper.h" -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../../lcd/ultralcd.h" #endif @@ -59,7 +59,7 @@ void GcodeSuite::M0_M1() { planner.synchronize(); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (has_message) lcd_setstatus(args, true); @@ -93,7 +93,7 @@ void GcodeSuite::M0_M1() { printerEventLEDs.onResumeAfterWait(); #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_reset_status(); #endif diff --git a/Marlin/src/gcode/lcd/M145.cpp b/Marlin/src/gcode/lcd/M145.cpp index 410d014474..9052a6493e 100644 --- a/Marlin/src/gcode/lcd/M145.cpp +++ b/Marlin/src/gcode/lcd/M145.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../gcode.h" #include "../../lcd/ultralcd.h" @@ -60,4 +60,4 @@ void GcodeSuite::M145() { } } -#endif // ULTIPANEL +#endif // HAS_LCD_MENU diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index 6123bc90fc..9c9f479974 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -273,7 +273,7 @@ public: static inline void set_input_temp_units(TempUnit units) { input_temp_units = units; } - #if ENABLED(ULTIPANEL) && DISABLED(DISABLE_M503) + #if HAS_LCD_MENU && DISABLED(DISABLE_M503) FORCE_INLINE static char temp_units_code() { return input_temp_units == TEMPUNIT_K ? 'K' : input_temp_units == TEMPUNIT_F ? 'F' : 'C'; @@ -293,7 +293,7 @@ public: } } - #endif // ULTIPANEL && !DISABLE_M503 + #endif // HAS_LCD_MENU && !DISABLE_M503 static inline float value_celsius() { const float f = value_float(); diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 7de38442dc..2d7fe1ab5e 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -387,7 +387,7 @@ inline void get_serial_commands() { // Process critical commands early if (strcmp(command, "M108") == 0) { wait_for_heatup = false; - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU wait_for_user = false; #endif } diff --git a/Marlin/src/gcode/queue.h b/Marlin/src/gcode/queue.h index 41b4ec255b..a75d8affa4 100644 --- a/Marlin/src/gcode/queue.h +++ b/Marlin/src/gcode/queue.h @@ -97,7 +97,7 @@ void enqueue_and_echo_commands_P(PGM_P const pgcode); */ bool enqueue_and_echo_command(const char* cmd); -#define HAS_LCD_QUEUE_NOW (ENABLED(MALYAN_LCD) || (ENABLED(ULTIPANEL) && (ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE)))) +#define HAS_LCD_QUEUE_NOW (ENABLED(MALYAN_LCD) || (HAS_LCD_MENU && (ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE)))) #define HAS_QUEUE_NOW (ENABLED(SDSUPPORT) || HAS_LCD_QUEUE_NOW) #if HAS_QUEUE_NOW diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index b6f0b4e881..8bd14970d4 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -239,7 +239,7 @@ /** * Override here because this is set in Configuration_adv.h */ -#if ENABLED(ULTIPANEL) && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) +#if HAS_LCD_MENU && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) #undef SD_DETECT_INVERTED #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index eb491cecff..9a94edfe1c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -866,7 +866,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "You probably want to use Max Endstops for DELTA!" #elif ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(AUTO_BED_LEVELING_BILINEAR) && !UBL_SEGMENTED #error "ENABLE_LEVELING_FADE_HEIGHT on DELTA requires AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL." - #elif ENABLED(DELTA_AUTO_CALIBRATION) && !(HAS_BED_PROBE || ENABLED(ULTIPANEL)) + #elif ENABLED(DELTA_AUTO_CALIBRATION) && !(HAS_BED_PROBE || HAS_LCD_MENU) #error "DELTA_AUTO_CALIBRATION requires a probe or LCD Controller." #elif ABL_GRID #if (GRID_MAX_POINTS_X & 1) == 0 || (GRID_MAX_POINTS_Y & 1) == 0 diff --git a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp index b5793d0743..7dc80b0528 100644 --- a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp +++ b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp @@ -14,16 +14,15 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(ULTRA_LCD) && DISABLED(DOGLCD) +#if HAS_CHARACTER_LCD #include "../ultralcd.h" #include "../../Marlin.h" -#include -#include "../fontutils.h" -#include "../lcdprint.h" - #include "ultralcd_common_HD44780.h" + +#include + #ifndef LCD_CLASS #include #define LCD_CLASS LiquidCrystal @@ -1039,4 +1038,4 @@ int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) { return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length); } -#endif // ULTRA_LCD && !DOGLCD +#endif // HAS_CHARACTER_LCD diff --git a/Marlin/src/lcd/HD44780/ultralcd_common_HD44780.h b/Marlin/src/lcd/HD44780/ultralcd_common_HD44780.h index d4dd2afae5..9dc1b54310 100644 --- a/Marlin/src/lcd/HD44780/ultralcd_common_HD44780.h +++ b/Marlin/src/lcd/HD44780/ultralcd_common_HD44780.h @@ -32,24 +32,6 @@ #include "../../libs/duration_t.h" #endif -#if ENABLED(AUTO_BED_LEVELING_UBL) - #include "../../feature/bedlevel/ubl/ubl.h" - - #if ENABLED(ULTIPANEL) - #define ULTRA_X_PIXELS_PER_CHAR 5 - #define ULTRA_Y_PIXELS_PER_CHAR 8 - #define ULTRA_COLUMNS_FOR_MESH_MAP 7 - #define ULTRA_ROWS_FOR_MESH_MAP 4 - - #define N_USER_CHARS 8 - - #define TOP_LEFT _BV(0) - #define TOP_RIGHT _BV(1) - #define LOWER_LEFT _BV(2) - #define LOWER_RIGHT _BV(3) - #endif -#endif - //////////////////////////////////// // Setup button and encode mappings for each panel (into 'buttons' variable // @@ -57,7 +39,7 @@ // macro name. The mapping is independent of whether the button is directly connected or // via a shift/i2c register. -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU extern volatile uint8_t buttons; @@ -119,7 +101,21 @@ #define LCD_CLICKED (buttons & (B_MI|B_ST)) #endif -#endif // ULTIPANEL + #if ENABLED(AUTO_BED_LEVELING_UBL) + #define ULTRA_X_PIXELS_PER_CHAR 5 + #define ULTRA_Y_PIXELS_PER_CHAR 8 + #define ULTRA_COLUMNS_FOR_MESH_MAP 7 + #define ULTRA_ROWS_FOR_MESH_MAP 4 + + #define N_USER_CHARS 8 + + #define TOP_LEFT _BV(0) + #define TOP_RIGHT _BV(1) + #define LOWER_LEFT _BV(2) + #define LOWER_RIGHT _BV(3) + #endif + +#endif // HAS_LCD_MENU //////////////////////////////////// // Create LCD class instance and chipset-specific information @@ -141,12 +137,11 @@ #elif ENABLED(LCD_I2C_TYPE_MCP23017) // For the LED indicators (which may be mapped to different events in lcd_implementation_update_indicators()) + #define LCD_HAS_STATUS_INDICATORS #define LED_A 0x04 //100 #define LED_B 0x02 //010 #define LED_C 0x01 //001 - #define LCD_HAS_STATUS_INDICATORS - #include #include #define LCD_CLASS LiquidTWI2 @@ -160,9 +155,9 @@ #include #define LCD_CLASS LiquidCrystal_I2C -// 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection #elif ENABLED(SR_LCD_2W_NL) + // 2 wire Non-latching LCD SR from: + // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection extern "C" void __cxa_pure_virtual() { while (1); } #include #include @@ -178,12 +173,7 @@ // Standard directly connected LCD implementations #include #define LCD_CLASS LiquidCrystal - #endif #include "../fontutils.h" #include "../lcdprint.h" - -#if ENABLED(LCD_PROGRESS_BAR) - #define LCD_STR_PROGRESS "\x03\x04\x05" -#endif diff --git a/Marlin/src/lcd/HD44780/ultralcd_impl_HD44780.cpp b/Marlin/src/lcd/HD44780/ultralcd_impl_HD44780.cpp index 6528d69a03..06bab39c9c 100644 --- a/Marlin/src/lcd/HD44780/ultralcd_impl_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/ultralcd_impl_HD44780.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(ULTRA_LCD) && DISABLED(DOGLCD) +#if HAS_CHARACTER_LCD /** * ultralcd_impl_HD44780.cpp @@ -40,6 +40,10 @@ #include "../../module/planner.h" #include "../../module/motion.h" +#if ENABLED(AUTO_BED_LEVELING_UBL) + #include "../../feature/bedlevel/ubl/ubl.h" +#endif + //////////////////////////////////// // Create LCD class instance and chipset-specific information #if ENABLED(LCD_I2C_TYPE_PCF8575) @@ -79,16 +83,6 @@ LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7 #endif -#include "../fontutils.h" -#include "../lcdprint.h" - -#if ENABLED(LCD_PROGRESS_BAR) - static millis_t progress_bar_ms = 0; // Start millis of the current progress bar cycle - #if PROGRESS_MSG_EXPIRE > 0 - static millis_t expire_status_ms = 0; // millis at which to expire the status message - #endif -#endif - #if ENABLED(LCD_HAS_STATUS_INDICATORS) static void lcd_implementation_update_indicators(); #endif @@ -100,9 +94,13 @@ static void createChar_P(const char c, const byte * const ptr) { lcd.createChar(c, temp); } +#if ENABLED(LCD_PROGRESS_BAR) + #define LCD_STR_PROGRESS "\x03\x04\x05" +#endif + void lcd_set_custom_characters( #if ENABLED(LCD_PROGRESS_BAR) || ENABLED(SHOW_BOOTSCREEN) - const uint8_t screen_charset=CHARSET_INFO + const HD44780CharSet screen_charset/*=CHARSET_INFO*/ #endif ) { // CHARSET_BOOT @@ -318,11 +316,7 @@ void lcd_set_custom_characters( } -void lcd_implementation_init( - #if ENABLED(LCD_PROGRESS_BAR) - const uint8_t screen_charset=CHARSET_INFO - #endif -) { +void lcd_implementation_init() { #if ENABLED(LCD_I2C_TYPE_PCF8575) lcd.begin(LCD_WIDTH, LCD_HEIGHT); @@ -348,11 +342,7 @@ void lcd_implementation_init( lcd.begin(LCD_WIDTH, LCD_HEIGHT); #endif - lcd_set_custom_characters( - #if ENABLED(LCD_PROGRESS_BAR) - screen_charset - #endif - ); + LCD_SET_CHARSET(currentScreen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU); lcd.clear(); } @@ -416,7 +406,7 @@ void lcd_implementation_clear() { lcd.clear(); } } void lcd_bootscreen() { - lcd_set_custom_characters(CHARSET_BOOT); + LCD_SET_CHARSET(CHARSET_BOOT); lcd.clear(); #define LCD_EXTRA_SPACE (LCD_WIDTH-8) @@ -485,7 +475,7 @@ void lcd_implementation_clear() { lcd.clear(); } lcd.clear(); safe_delay(100); - lcd_set_custom_characters(); + LCD_SET_CHARSET(CHARSET_INFO); lcd.clear(); } @@ -975,7 +965,7 @@ FORCE_INLINE void _draw_status_message(const bool blink) { #endif -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #if ENABLED(ADVANCED_PAUSE_FEATURE) @@ -1581,6 +1571,6 @@ FORCE_INLINE void _draw_status_message(const bool blink) { #endif // AUTO_BED_LEVELING_UBL -#endif // ULTIPANEL +#endif // HAS_LCD_MENU -#endif // ULTRA_LCD && !DOGLCD +#endif // HAS_CHARACTER_LCD diff --git a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp index b19f32c54a..8a09c68084 100644 --- a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp +++ b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp @@ -9,7 +9,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include extern U8GLIB *pu8g; @@ -62,4 +62,4 @@ int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) { return ret; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp b/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp index 3249068299..c0f8e10d00 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp @@ -67,7 +67,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include #include "HAL_LCD_com_defines.h" @@ -281,4 +281,4 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp index 515ac32f6c..fce915a2b5 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp @@ -55,7 +55,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -233,4 +233,4 @@ u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_sw_spi = { u8g_dev_st7565_64128n_HAL_2x_f U8G_PB_DEV(u8g_dev_st7565_64128n_HAL_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_HAL_fn, U8G_COM_HAL_HW_SPI_FN); u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi = { u8g_dev_st7565_64128n_HAL_2x_fn, &u8g_dev_st7565_64128n_HAL_2x_pb, U8G_COM_HAL_HW_SPI_FN }; -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp index bef53879f6..5088ac3641 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp @@ -55,7 +55,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -209,4 +209,4 @@ u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi = { u8g_dev_st7920_128x64_HAL_4x_f u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI }; #endif -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp index e58bb34fae..03372ece05 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp @@ -59,7 +59,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -114,19 +114,18 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS); u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq); break; - case U8G_DEV_MSG_STOP: - break; - case U8G_DEV_MSG_PAGE_NEXT: - { - u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); - u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); - u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); /* select current page */ - u8g_SetAddress(u8g, dev, 1); /* data mode */ - if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 ) - return 0; - u8g_SetChipSelect(u8g, dev, 0); - } - break; + + case U8G_DEV_MSG_STOP: break; + + case U8G_DEV_MSG_PAGE_NEXT: { + u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); + u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); + u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); /* select current page */ + u8g_SetAddress(u8g, dev, 1); /* data mode */ + if (!u8g_pb_WriteBuffer(pb, u8g, dev)) return 0; + u8g_SetChipSelect(u8g, dev, 0); + } break; + case U8G_DEV_MSG_CONTRAST: u8g_SetChipSelect(u8g, dev, 1); u8g_SetAddress(u8g, dev, 0); /* instruction mode */ @@ -144,25 +143,25 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS); u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq); break; - case U8G_DEV_MSG_STOP: - break; - case U8G_DEV_MSG_PAGE_NEXT: - { - u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); - u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); - u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page)); /* select current page */ - u8g_SetAddress(u8g, dev, 1); /* data mode */ - u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf); - u8g_SetChipSelect(u8g, dev, 0); + case U8G_DEV_MSG_STOP: break; + + case U8G_DEV_MSG_PAGE_NEXT: { + u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); + + u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); + u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page)); /* select current page */ + u8g_SetAddress(u8g, dev, 1); /* data mode */ + u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf); + u8g_SetChipSelect(u8g, dev, 0); + + u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); + u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page+1)); /* select current page */ + u8g_SetAddress(u8g, dev, 1); /* data mode */ + u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); + u8g_SetChipSelect(u8g, dev, 0); + } break; - u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); - u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page+1)); /* select current page */ - u8g_SetAddress(u8g, dev, 1); /* data mode */ - u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); - u8g_SetChipSelect(u8g, dev, 0); - } - break; case U8G_DEV_MSG_CONTRAST: u8g_SetChipSelect(u8g, dev, 1); u8g_SetAddress(u8g, dev, 0); /* instruction mode */ @@ -182,4 +181,4 @@ u8g_pb_t u8g_dev_uc1701_mini12864_HAL_2x_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_sw_spi = { u8g_dev_uc1701_mini12864_HAL_2x_fn, &u8g_dev_uc1701_mini12864_HAL_2x_pb, U8G_COM_HAL_SW_SPI_FN }; u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_hw_spi = { u8g_dev_uc1701_mini12864_HAL_2x_fn, &u8g_dev_uc1701_mini12864_HAL_2x_pb, U8G_COM_HAL_HW_SPI_FN }; -#endif // DOGLCD \ No newline at end of file +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp index 1f5f5de506..1b808bdc49 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp @@ -9,7 +9,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include #include "../fontutils.h" @@ -317,4 +317,4 @@ int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg) { return data.adv; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp index c6547c4655..63b148b727 100644 --- a/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp @@ -245,7 +245,7 @@ void lcd_kill_screen() { void lcd_implementation_clear() { } // Automatically cleared by Picture Loop -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU uint8_t row_y1, row_y2; @@ -655,6 +655,6 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop #endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY -#endif // ULTIPANEL +#endif // HAS_LCD_MENU #endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 181d067333..52b6573328 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "menu.h" #include "../ultralcd.h" @@ -75,8 +75,6 @@ bool no_reentry = false; //////// Menu Navigation & History ///////// //////////////////////////////////////////// -void lcd_status_screen(); - void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); } void lcd_save_previous_screen() { @@ -203,14 +201,6 @@ void menu_action_setting_edit_callback_bool(PGM_P pstr, bool* ptr, screenFunc_t bool printer_busy() { return planner.movesplanned() || IS_SD_PRINTING(); } -#if HAS_CHARACTER_LCD && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(LCD_PROGRESS_BAR_TEST) || ENABLED(AUTO_BED_LEVELING_UBL)) - void lcd_set_custom_characters( - #if ENABLED(LCD_PROGRESS_BAR) || ENABLED(SHOW_BOOTSCREEN) - const uint8_t screen_charset=CHARSET_INFO - #endif - ); -#endif - /** * General function to go directly to a screen */ @@ -258,19 +248,17 @@ void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) { #endif screen_history_depth = 0; } + lcd_implementation_clear(); + // Re-initialize custom characters that may be re-used - #if HAS_CHARACTER_LCD && ENABLED(AUTO_BED_LEVELING_UBL) - if (!ubl.lcd_map_control) { - lcd_set_custom_characters( - #if ENABLED(LCD_PROGRESS_BAR) - screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU - #endif - ); - } - #elif ENABLED(LCD_PROGRESS_BAR) - lcd_set_custom_characters(screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU); + #if HAS_CHARACTER_LCD + #if ENABLED(AUTO_BED_LEVELING_UBL) + if (!ubl.lcd_map_control) + #endif + LCD_SET_CHARSET(screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU); #endif + lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; screen_changed = true; #if HAS_GRAPHICAL_LCD @@ -476,4 +464,4 @@ void _lcd_draw_homing() { void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); } #endif -#endif // ULTIPANEL +#endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 9124a218bf..0773c6c11c 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -54,7 +54,7 @@ static void lcd_factory_settings() { static int8_t bar_percent = 0; if (use_click()) { lcd_goto_previous_menu(); - lcd_set_custom_characters(CHARSET_MENU); + LCD_SET_CHARSET(CHARSET_MENU); return; } bar_percent += (int8_t)encoderPosition; @@ -68,7 +68,7 @@ static void lcd_factory_settings() { void _progress_bar_test() { lcd_goto_screen(progress_bar_test); - lcd_set_custom_characters(); + LCD_SET_CHARSET(CHARSET_INFO); } #endif // LCD_PROGRESS_BAR_TEST diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 6d67683bcb..e6452b2acf 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -49,7 +49,7 @@ #if ENABLED(POWER_LOSS_RECOVERY) #include "../feature/power_loss_recovery.h" - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU void menu_job_recovery(); #endif #endif @@ -100,7 +100,7 @@ uint8_t lcd_status_update_delay = 1, // First update one loop delayed millis_t previous_lcd_status_ms = 0; #endif -#if ENABLED(SDSUPPORT) && ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES) +#if HAS_LCD_MENU && ENABLED(SDSUPPORT) && ENABLED(SCROLL_LONG_FILENAMES) uint8_t filename_scroll_pos, filename_scroll_max; #endif @@ -122,8 +122,6 @@ millis_t next_button_update_ms; int8_t encoderDirection = 1; #endif -void lcd_status_screen(); - #if HAS_LCD_MENU #include "menu/menu.h" @@ -202,7 +200,7 @@ void lcd_init() { lcd_buttons_update(); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU encoderDiff = 0; #endif } @@ -363,6 +361,14 @@ bool lcd_blink() { * This is very display-dependent, so the lcd implementation draws this. */ +#if ENABLED(LCD_PROGRESS_BAR) + millis_t progress_bar_ms = 0; // Start millis of the current progress bar cycle + #if PROGRESS_MSG_EXPIRE > 0 + static millis_t expire_status_ms = 0; + void dontExpireStatus() { expire_status_ms = 0; } + #endif +#endif + #if LCD_INFO_SCREEN_STYLE == 0 void lcd_impl_status_screen_0(); #elif LCD_INFO_SCREEN_STYLE == 1 @@ -371,12 +377,12 @@ bool lcd_blink() { void lcd_status_screen() { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU ENCODER_DIRECTION_NORMAL(); ENCODER_RATE_MULTIPLY(false); #endif - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD)) + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || HAS_GRAPHICAL_LCD) // Progress bar % comes from SD when actively printing if (IS_SD_PRINTING()) progress_bar_percent = card.percentDone(); @@ -425,18 +431,14 @@ void lcd_status_screen() { #endif // LCD_PROGRESS_BAR - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (use_click()) { #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) previous_lcd_status_ms = millis(); // get status message to show up for a while #endif - lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. - #if ENABLED(LCD_PROGRESS_BAR) - CHARSET_MENU - #endif - ); lcd_goto_screen(menu_main); + lcd_implementation_init(); // May revive the LCD if static electricity killed it return; } @@ -465,7 +467,7 @@ void lcd_status_screen() { feedrate_percentage = constrain(feedrate_percentage, 10, 999); - #endif // ULTIPANEL + #endif // HAS_LCD_MENU #if LCD_INFO_SCREEN_STYLE == 0 lcd_impl_status_screen_0(); @@ -514,7 +516,7 @@ void kill_screen(PGM_P lcd_msg) { void lcd_quick_feedback(const bool clear_buttons) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_refresh(); if (clear_buttons) buttons = 0; next_button_update_ms = millis() + 500; @@ -525,7 +527,7 @@ void lcd_quick_feedback(const bool clear_buttons) { // Buzz and wait. The delay is needed for buttons to settle! lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU #if ENABLED(LCD_USE_I2C_BUZZER) delay(10); #elif PIN_EXISTS(BEEPER) @@ -534,7 +536,7 @@ void lcd_quick_feedback(const bool clear_buttons) { #endif } -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU extern bool no_reentry; // Flag to prevent recursion into menu handlers @@ -602,7 +604,7 @@ void lcd_quick_feedback(const bool clear_buttons) { } } -#endif // ULTIPANEL +#endif // HAS_LCD_MENU /** * Update the LCD, read encoder buttons, etc. @@ -652,7 +654,7 @@ void lcd_update() { static uint16_t max_display_update_time = 0; static millis_t next_lcd_update_ms; - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU static millis_t return_to_status_ms = 0; // Handle any queued Move Axis motion @@ -688,7 +690,7 @@ void lcd_update() { } #endif - #endif // ULTIPANEL + #endif // HAS_LCD_MENU #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) @@ -712,11 +714,7 @@ void lcd_update() { } lcd_refresh(); - lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. - #if ENABLED(LCD_PROGRESS_BAR) - currentScreen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU - #endif - ); + lcd_implementation_init(); // May revive the LCD if static electricity killed it } #endif // SDSUPPORT && SD_DETECT_PIN @@ -730,7 +728,7 @@ void lcd_update() { const millis_t ms = millis(); if (ELAPSED(ms, next_lcd_update_ms) - #if ENABLED(DOGLCD) + #if HAS_GRAPHICAL_LCD || drawing_screen #endif ) { @@ -741,7 +739,7 @@ void lcd_update() { lcd_implementation_update_indicators(); #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU #if ENABLED(LCD_HAS_SLOW_BUTTONS) slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context @@ -797,18 +795,18 @@ void lcd_update() { lcdDrawUpdate = LCDVIEW_REDRAW_NOW; } - #endif // ULTIPANEL + #endif // HAS_LCD_MENU // This runs every ~100ms when idling often enough. // Instead of tracking changes just redraw the Status Screen once per second. if ( - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU currentScreen == lcd_status_screen && #endif !lcd_status_update_delay-- ) { lcd_status_update_delay = 9 - #if ENABLED(DOGLCD) + #if HAS_GRAPHICAL_LCD + 3 #endif ; @@ -816,7 +814,7 @@ void lcd_update() { lcdDrawUpdate = LCDVIEW_REDRAW_NOW; } - #if ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES) + #if HAS_LCD_MENU && ENABLED(SCROLL_LONG_FILENAMES) // If scrolling of long file names is enabled and we are in the sd card menu, // cause a refresh to occur until all the text has scrolled into view. if (currentScreen == menu_sdcard && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) { @@ -830,7 +828,7 @@ void lcd_update() { // then we want to use 1/2 of the time only. uint16_t bbr2 = planner.block_buffer_runtime() >> 1; - #if ENABLED(DOGLCD) + #if HAS_GRAPHICAL_LCD const bool &is_drawing = drawing_screen; #else constexpr bool is_drawing = false; @@ -855,15 +853,15 @@ void lcd_update() { buttons_reprapworld_keypad = 0; #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU #define CURRENTSCREEN() (*currentScreen)() #else #define CURRENTSCREEN() lcd_status_screen() #endif - #if ENABLED(DOGLCD) + #if HAS_GRAPHICAL_LCD #if ENABLED(LIGHTWEIGHT_UI) - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU const bool in_status = currentScreen == lcd_status_screen; #else constexpr bool in_status = true; @@ -896,7 +894,7 @@ void lcd_update() { CURRENTSCREEN(); #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_clicked = false; #endif @@ -905,7 +903,7 @@ void lcd_update() { NOLESS(max_display_update_time, millis() - ms); } - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU // Return to Status Screen after a timeout if (currentScreen == lcd_status_screen || defer_return_to_status) @@ -913,7 +911,7 @@ void lcd_update() { else if (ELAPSED(ms, return_to_status_ms)) lcd_return_to_status(); - #endif // ULTIPANEL + #endif // HAS_LCD_MENU // Change state of drawing flag between screen updates if (!is_drawing) switch (lcdDrawUpdate) { @@ -942,6 +940,7 @@ void lcd_finishstatus(const bool persist=false) { expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE; #endif #endif + lcd_refresh(); #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) @@ -953,10 +952,6 @@ void lcd_finishstatus(const bool persist=false) { #endif } -#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 - void dontExpireStatus() { expire_status_ms = 0; } -#endif - bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); } void lcd_setstatus(const char * const message, const bool persist) { @@ -1023,7 +1018,7 @@ void lcd_status_printf_P(const uint8_t level, PGM_P const fmt, ...) { void lcd_setalertstatusPGM(PGM_P const message) { lcd_setstatusPGM(message, 1); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_return_to_status(); #endif } @@ -1068,7 +1063,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } } #endif -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU /** * Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement) @@ -1252,6 +1247,6 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } } } -#endif // ULTIPANEL +#endif // HAS_LCD_MENU #endif // ULTRA_LCD diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index e24673c25c..5cd870393b 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -89,7 +89,7 @@ #elif ENABLED(U8GLIB_SSD1306) // Generic support for SSD1306 OLED I2C LCDs - //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE + //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes #define U8G_CLASS U8GLIB_SSD1306_128X64_2X #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes @@ -102,7 +102,7 @@ //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes #elif ENABLED(U8GLIB_SH1106) // Generic support for SH1106 OLED I2C LCDs - //#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE + //#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes #define U8G_CLASS U8GLIB_SH1106_128X64_2X #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes @@ -199,6 +199,7 @@ #include "../module/motion.h" // for active_extruder #endif + void lcd_status_screen(); void lcd_return_to_status(); bool lcd_hasstatus(); void lcd_setstatus(const char* message, const bool persist=false); @@ -229,8 +230,11 @@ void lcd_quick_feedback(const bool clear_buttons); // Audible feedback for a button click - could also be visual - #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 - void dontExpireStatus(); + #if ENABLED(LCD_PROGRESS_BAR) + extern millis_t progress_bar_ms; // Start time for the current progress bar cycle + #if PROGRESS_MSG_EXPIRE > 0 + void dontExpireStatus(); + #endif #endif #if ENABLED(LCD_SET_PROGRESS_MANUALLY) @@ -246,7 +250,7 @@ void set_lcd_contrast(const int16_t value); #endif - #if ENABLED(DOGLCD) + #if HAS_GRAPHICAL_LCD #define SETCURSOR(col, row) lcd_moveto(col * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT)) #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - len * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT)) #else @@ -316,7 +320,7 @@ extern uint8_t filename_scroll_pos, filename_scroll_max; #endif - #endif // ULTIPANEL + #endif // HAS_LCD_MENU #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) extern millis_t previous_lcd_status_ms; @@ -422,22 +426,29 @@ extern char lcd_status_message[]; void lcd_reselect_last_file(); #endif -// LCD implementations -void lcd_implementation_clear(); -void lcd_implementation_init(); - #if HAS_GRAPHICAL_LCD extern bool drawing_screen, first_page; #elif HAS_SPI_LCD constexpr bool first_page = true; #endif +// LCD implementations +void lcd_implementation_clear(); +void lcd_implementation_init(); + #if HAS_CHARACTER_LCD - enum HD44780CharSet : uint8_t { - CHARSET_MENU, - CHARSET_INFO, - CHARSET_BOOT - }; + enum HD44780CharSet : uint8_t { CHARSET_MENU, CHARSET_INFO, CHARSET_BOOT }; + + void lcd_set_custom_characters( + #if ENABLED(LCD_PROGRESS_BAR) || ENABLED(SHOW_BOOTSCREEN) + const HD44780CharSet screen_charset=CHARSET_INFO + #endif + ); + #if ENABLED(LCD_PROGRESS_BAR) + #define LCD_SET_CHARSET(C) lcd_set_custom_characters(C) + #else + #define LCD_SET_CHARSET(C) lcd_set_custom_characters() + #endif #endif diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 68864cb2ba..b23414166f 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -70,7 +70,7 @@ #include "../feature/fanmux.h" #endif -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../lcd/ultralcd.h" #endif @@ -524,7 +524,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n no_move = true; #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_return_to_status(); #endif