diff --git a/Marlin/Conditionals_LCD.h b/Marlin/Conditionals_LCD.h index 42a326297..5a858a68c 100644 --- a/Marlin/Conditionals_LCD.h +++ b/Marlin/Conditionals_LCD.h @@ -367,6 +367,11 @@ #endif #endif + #if ENABLED(NO_LCD_MENUS) + #undef ULTIPANEL + #undef NEWPANEL + #endif + // Boot screens #if DISABLED(ULTRA_LCD) #undef SHOW_BOOTSCREEN @@ -374,7 +379,7 @@ #define BOOTSCREEN_TIMEOUT 2500 #endif - #define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST) + #define HAS_DEBUG_MENU (ENABLED(ULTIPANEL) && ENABLED(LCD_PROGRESS_BAR_TEST)) // MK2 Multiplexer forces SINGLENOZZLE and kills DISABLE_INACTIVE_EXTRUDER #if ENABLED(MK2_MULTIPLEXER) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 361b4cbbb..8c95a5dfb 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1392,6 +1392,15 @@ */ //#define SD_CHECK_AND_RETRY +/** + * LCD Menu Items + * + * Disable all menus and only display the Status Screen, or + * just remove some extraneous menu items to recover space. + */ +//#define NO_LCD_MENUS +//#define SLIM_LCD_MENUS + // // ENCODER SETTINGS // diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 6fc096c17..94b522815 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -493,9 +493,6 @@ // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU -// Leave out seldom-used LCD menu items to recover some Program Memory -//#define SLIM_LCD_MENUS - // Scroll a longer status message into view //#define STATUS_MESSAGE_SCROLLING diff --git a/Marlin/G26_Mesh_Validation_Tool.cpp b/Marlin/G26_Mesh_Validation_Tool.cpp index 4497eedd4..a605aaa90 100644 --- a/Marlin/G26_Mesh_Validation_Tool.cpp +++ b/Marlin/G26_Mesh_Validation_Tool.cpp @@ -486,7 +486,9 @@ if (g26_bed_temp > 25) { lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99); lcd_quick_feedback(true); - lcd_external_control = true; + #if ENABLED(NEWPANEL) + lcd_external_control = true; + #endif #endif thermalManager.setTargetBed(g26_bed_temp); while (abs(thermalManager.degBed() - g26_bed_temp) > 3) { @@ -732,7 +734,7 @@ move_to(destination, 0.0); move_to(destination, g26_ooze_amount); - #if ENABLED(ULTRA_LCD) + #if ENABLED(NEWPANEL) lcd_external_control = true; #endif @@ -836,7 +838,7 @@ move_to(destination, 0); // Move back to the starting position //debug_current_and_destination(PSTR("done doing X/Y move.")); - #if ENABLED(ULTRA_LCD) + #if ENABLED(NEWPANEL) lcd_external_control = false; // Give back control of the LCD Panel! #endif diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index 65fb67c70..3acd867e6 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -49,9 +49,6 @@ void _lcd_ubl_output_map_lcd(); #endif - extern float meshedit_done; - extern long babysteps_done; - #define SIZE_OF_LITTLE_RAISE 1 #define BIG_RAISE_NOT_NEEDED 0 diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 1b06c4aa7..f3c803e91 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -61,33 +61,10 @@ #include "fwretract.h" #endif -#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) - bool lcd_external_control; // = false -#endif - #if ENABLED(POWER_LOSS_RECOVERY) #include "power_loss_recovery.h" #endif -// Initialized by settings.load() -int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; - -#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) - millis_t previous_lcd_status_ms = 0; -#endif - -#if ENABLED(BABYSTEPPING) - long babysteps_done = 0; - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - static void lcd_babystep_zoffset(); - #else - static void lcd_babystep_z(); - #endif -#endif - -uint8_t lcd_status_update_delay = 1, // First update one loop delayed - lcd_status_message_level; // Higher level blocks lower level - #if ENABLED(STATUS_MESSAGE_SCROLLING) #if LONG_FILENAME_LENGTH > CHARSIZE * 2 * (LCD_WIDTH) #define MAX_MESSAGE_LENGTH LONG_FILENAME_LENGTH @@ -100,8 +77,14 @@ uint8_t lcd_status_update_delay = 1, // First update one loop delayed #endif char lcd_status_message[MAX_MESSAGE_LENGTH + 1]; +uint8_t lcd_status_update_delay = 1, // First update one loop delayed + lcd_status_message_level; // Higher level blocks lower level -#if ENABLED(SCROLL_LONG_FILENAMES) +#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + millis_t previous_lcd_status_ms = 0; +#endif + +#if ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES) uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash; #endif @@ -112,11 +95,23 @@ char lcd_status_message[MAX_MESSAGE_LENGTH + 1]; #if ENABLED(DOGLCD) #include "ultralcd_impl_DOGM.h" #include + bool drawing_screen, // = false + first_page; #else #include "ultralcd_impl_HD44780.h" + constexpr bool first_page = true; #endif +// The main status screen +void lcd_status_screen(); + +millis_t next_lcd_update_ms; + +uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial) +uint16_t max_display_update_time = 0; + #if ENABLED(ULTIPANEL) + #define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(_type, _name, _strFunc) \ inline void lcd_implementation_drawmenu_setting_edit_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \ UNUSED(pstr2); \ @@ -144,29 +139,6 @@ char lcd_status_message[MAX_MESSAGE_LENGTH + 1]; #define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) DRAW_BOOL_SETTING(sel, row, pstr, data) #define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) DRAW_BOOL_SETTING(sel, row, pstr, data) #define lcd_implementation_drawmenu_setting_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset) DRAW_BOOL_SETTING(sel, row, pstr, data) -#endif // ULTIPANEL - -// The main status screen -void lcd_status_screen(); - -millis_t next_lcd_update_ms; - -uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial) -uint16_t max_display_update_time = 0; - -#if ENABLED(DOGLCD) - bool drawing_screen, // = false - first_page; -#else - constexpr bool first_page = true; -#endif - -#if ENABLED(DAC_STEPPER_CURRENT) - #include "stepper_dac.h" //was dac_mcp4728.h MarlinMain uses stepper dac for the m-codes - uint8_t driverPercent[XYZE]; -#endif - -#if ENABLED(ULTIPANEL) #ifndef TALL_FONT_CORRECTION #define TALL_FONT_CORRECTION 0 @@ -175,6 +147,27 @@ uint16_t max_display_update_time = 0; bool no_reentry = false; constexpr int8_t menu_bottom = LCD_HEIGHT - (TALL_FONT_CORRECTION); + // Initialized by settings.load() + int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; + + #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) + bool lcd_external_control; // = false + #endif + + #if ENABLED(BABYSTEPPING) + long babysteps_done = 0; + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + static void lcd_babystep_zoffset(); + #else + static void lcd_babystep_z(); + #endif + #endif + + #if ENABLED(DAC_STEPPER_CURRENT) + #include "stepper_dac.h" //was dac_mcp4728.h MarlinMain uses stepper dac for the m-codes + uint8_t driverPercent[XYZE]; + #endif + //////////////////////////////////////////// ///////////////// Menu Tree //////////////// //////////////////////////////////////////// @@ -780,36 +773,41 @@ void kill_screen(const char* lcd_msg) { lcd_kill_screen(); } -#if ENABLED(ULTIPANEL) +/** + * + * Audio feedback for controller clicks + * + */ +void lcd_buzz(const long duration, const uint16_t freq) { + #if ENABLED(LCD_USE_I2C_BUZZER) + lcd.buzz(duration, freq); + #elif PIN_EXISTS(BEEPER) + buzzer.tone(duration, freq); + #else + UNUSED(duration); UNUSED(freq); + #endif +} - /** - * - * Audio feedback for controller clicks - * - */ - void lcd_buzz(const long duration, const uint16_t freq) { - #if ENABLED(LCD_USE_I2C_BUZZER) - lcd.buzz(duration, freq); - #elif PIN_EXISTS(BEEPER) - buzzer.tone(duration, freq); - #else - UNUSED(duration); UNUSED(freq); - #endif - } +void lcd_quick_feedback(const bool clear_buttons) { + lcd_refresh(); - void lcd_quick_feedback(const bool clear_buttons) { - lcd_refresh(); + #if ENABLED(ULTIPANEL) if (clear_buttons) buttons = 0; next_button_update_ms = millis() + 500; + #else + UNUSED(clear_buttons); + #endif - // Buzz and wait. The delay is needed for buttons to settle! - lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); - #if ENABLED(LCD_USE_I2C_BUZZER) - delay(10); - #elif PIN_EXISTS(BEEPER) - for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } - #endif - } + // Buzz and wait. The delay is needed for buttons to settle! + lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); + #if ENABLED(LCD_USE_I2C_BUZZER) + delay(10); + #elif PIN_EXISTS(BEEPER) + for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } + #endif +} + +#if ENABLED(ULTIPANEL) void lcd_completion_feedback(const bool good/*=true*/) { if (good) { @@ -5251,7 +5249,7 @@ void lcd_update() { lcdDrawUpdate = LCDVIEW_REDRAW_NOW; } - #if ENABLED(SCROLL_LONG_FILENAMES) + #if ENABLED(ULTIPANEL) && 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 == lcd_sdcard_menu && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) { diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 5adbf148e..bf7ae0fef 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -41,20 +41,6 @@ #include "Marlin.h" - #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) - extern bool lcd_external_control; - #else - constexpr bool lcd_external_control = false; - #endif - - extern int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; - - #if ENABLED(LCD_BED_LEVELING) - extern bool lcd_wait_for_move; - #else - constexpr bool lcd_wait_for_move = false; - #endif - int16_t lcd_strlen(const char* s); int16_t lcd_strlen_P(const char* s); bool lcd_hasstatus(); @@ -74,6 +60,8 @@ void lcd_buzz(const long duration, const uint16_t freq); #endif + 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(); #endif @@ -107,6 +95,20 @@ typedef void (*screenFunc_t)(); typedef void (*menuAction_t)(); + extern int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; + + #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) + extern bool lcd_external_control; + #else + constexpr bool lcd_external_control = false; + #endif + + #if ENABLED(LCD_BED_LEVELING) + extern bool lcd_wait_for_move; + #else + constexpr bool lcd_wait_for_move = false; + #endif + void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder=0); // Encoder click is directly connected @@ -130,7 +132,6 @@ extern volatile uint8_t buttons; // The last-checked buttons in a bit array. void lcd_buttons_update(); - void lcd_quick_feedback(const bool clear_buttons); // Audible feedback for a button click - could also be visual void lcd_completion_feedback(const bool good=true); #if ENABLED(ADVANCED_PAUSE_FEATURE)