From 2f91154cbdcec3b81da9913bdd16556e8c775d06 Mon Sep 17 00:00:00 2001 From: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com> Date: Thu, 25 Aug 2022 20:16:55 +0300 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Display=20sleep=20minutes,?= =?UTF-8?q?=20encoder=20disable=20option=20(#24618)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 7 ++++--- Marlin/Configuration_adv.h | 4 ++-- Marlin/src/gcode/lcd/M255.cpp | 14 +++++--------- Marlin/src/inc/Conditionals_LCD.h | 2 +- Marlin/src/inc/Conditionals_adv.h | 4 ++-- Marlin/src/inc/Conditionals_post.h | 4 ++++ Marlin/src/inc/SanityCheck.h | 10 +++++++--- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 3 +-- Marlin/src/lcd/language/language_de.h | 1 - Marlin/src/lcd/language/language_en.h | 1 - Marlin/src/lcd/language/language_fr.h | 2 +- Marlin/src/lcd/language/language_it.h | 1 - Marlin/src/lcd/language/language_sk.h | 1 - Marlin/src/lcd/language/language_uk.h | 2 +- Marlin/src/lcd/marlinui.cpp | 18 +++++++++++------- Marlin/src/lcd/marlinui.h | 15 +++++++-------- Marlin/src/lcd/menu/menu_configuration.cpp | 6 +++--- Marlin/src/lcd/menu/menu_item.h | 9 +++++++-- Marlin/src/lcd/menu/menu_main.cpp | 22 +++++++++++----------- Marlin/src/lcd/tft/touch.cpp | 2 +- Marlin/src/lcd/touch/touch_buttons.cpp | 4 ++-- Marlin/src/module/settings.cpp | 18 +++++++++--------- buildroot/tests/mega2560 | 2 +- 23 files changed, 80 insertions(+), 72 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 9d82b3cc40a2..876267af7039 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3156,10 +3156,11 @@ // //#define TOUCH_SCREEN #if ENABLED(TOUCH_SCREEN) - #define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens - #define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus + #define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens + #define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus - //#define TOUCH_IDLE_SLEEP 300 // (s) Turn off the TFT backlight if set (5mn) + //#define DISABLE_ENCODER // Disable the click encoder, if any + //#define TOUCH_IDLE_SLEEP_MINS 5 // (minutes) Display Sleep after a period of inactivity. Set with M255 S. #define TOUCH_SCREEN_CALIBRATION diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 6ec969474d9f..b83da5441bc5 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1321,7 +1321,7 @@ // // LCD Backlight Timeout // -//#define LCD_BACKLIGHT_TIMEOUT 30 // (s) Timeout before turning off the backlight +//#define LCD_BACKLIGHT_TIMEOUT_MINS 1 // (minutes) Timeout before turning off the backlight #if HAS_BED_PROBE && EITHER(HAS_MARLINUI_MENU, HAS_TFT_LVGL_UI) //#define PROBE_OFFSET_WIZARD // Add a Probe Z Offset calibration option to the LCD menu @@ -1739,7 +1739,7 @@ * Adds the menu item Configuration > LCD Timeout (m) to set a wait period * from 0 (disabled) to 99 minutes. */ - //#define DISPLAY_SLEEP_MINUTES 2 // (minutes) Timeout before turning off the screen + //#define DISPLAY_SLEEP_MINUTES 2 // (minutes) Timeout before turning off the screen. Set with M255 S. /** * ST7920-based LCDs can emulate a 16 x 4 character display using diff --git a/Marlin/src/gcode/lcd/M255.cpp b/Marlin/src/gcode/lcd/M255.cpp index 4a9049ab2c61..8dc8099de149 100644 --- a/Marlin/src/gcode/lcd/M255.cpp +++ b/Marlin/src/gcode/lcd/M255.cpp @@ -32,12 +32,11 @@ */ void GcodeSuite::M255() { if (parser.seenval('S')) { + const int m = parser.value_int(); #if HAS_DISPLAY_SLEEP - const int m = parser.value_int(); - ui.sleep_timeout_minutes = constrain(m, SLEEP_TIMEOUT_MIN, SLEEP_TIMEOUT_MAX); + ui.sleep_timeout_minutes = constrain(m, ui.sleep_timeout_min, ui.sleep_timeout_max); #else - const unsigned int s = parser.value_ushort() * 60; - ui.lcd_backlight_timeout = constrain(s, LCD_BKL_TIMEOUT_MIN, LCD_BKL_TIMEOUT_MAX); + ui.backlight_timeout_minutes = constrain(m, ui.backlight_timeout_min, ui.backlight_timeout_max); #endif } else @@ -47,11 +46,8 @@ void GcodeSuite::M255() { void GcodeSuite::M255_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F(STR_DISPLAY_SLEEP)); SERIAL_ECHOLNPGM(" M255 S", - #if HAS_DISPLAY_SLEEP - ui.sleep_timeout_minutes, " ; (minutes)" - #else - ui.lcd_backlight_timeout, " ; (seconds)" - #endif + TERN(HAS_DISPLAY_SLEEP, ui.sleep_timeout_minutes, ui.backlight_timeout_minutes), + " ; (minutes)" ); } diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index a6c9f0ae4305..5e23cedc4d38 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1599,7 +1599,7 @@ // This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046' #if ENABLED(TOUCH_SCREEN) - #if TOUCH_IDLE_SLEEP + #if TOUCH_IDLE_SLEEP_MINS #define HAS_TOUCH_SLEEP 1 #endif #if NONE(TFT_TOUCH_DEVICE_GT911, TFT_TOUCH_DEVICE_XPT2046) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 21bc424f5940..0d79d710bcde 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -647,10 +647,10 @@ #if ALL(HAS_RESUME_CONTINUE, PRINTER_EVENT_LEDS, SDSUPPORT) #define HAS_LEDS_OFF_FLAG 1 #endif -#ifdef DISPLAY_SLEEP_MINUTES +#ifdef DISPLAY_SLEEP_MINUTES || TOUCH_IDLE_SLEEP_MINS #define HAS_DISPLAY_SLEEP 1 #endif -#if HAS_DISPLAY_SLEEP || LCD_BACKLIGHT_TIMEOUT +#if HAS_DISPLAY_SLEEP || LCD_BACKLIGHT_TIMEOUT_MINS #define HAS_GCODE_M255 1 #endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 650c420532ed..ea6c1f93bf8f 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -3761,6 +3761,10 @@ #define HAS_ROTARY_ENCODER 1 #endif +#if DISABLED(DISABLE_ENCODER) && ANY(HAS_ROTARY_ENCODER, HAS_ADC_BUTTONS) && ANY(TFT_CLASSIC_UI, TFT_COLOR_UI) + #define HAS_BACK_ITEM 1 +#endif + #if PIN_EXISTS(SAFE_POWER) && DISABLED(DISABLE_DRIVER_SAFE_POWER_PROTECT) #define HAS_DRIVER_SAFE_POWER_PROTECT 1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 7c0625dec44e..388303522cfc 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -642,6 +642,10 @@ #error "LEVEL_CORNERS_* settings have been renamed BED_TRAMMING_*." #elif defined(LEVEL_CENTER_TOO) #error "LEVEL_CENTER_TOO is now BED_TRAMMING_INCLUDE_CENTER." +#elif defined(TOUCH_IDLE_SLEEP) + #error "TOUCH_IDLE_SLEEP (seconds) is now TOUCH_IDLE_SLEEP_MINS (minutes)." +#elif defined(LCD_BACKLIGHT_TIMEOUT) + #error "LCD_BACKLIGHT_TIMEOUT (seconds) is now LCD_BACKLIGHT_TIMEOUT_MINS (minutes)." #endif // L64xx stepper drivers have been removed @@ -3030,11 +3034,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #endif -#if LCD_BACKLIGHT_TIMEOUT +#if LCD_BACKLIGHT_TIMEOUT_MINS #if !HAS_ENCODER_ACTION - #error "LCD_BACKLIGHT_TIMEOUT requires an LCD with encoder or keypad." + #error "LCD_BACKLIGHT_TIMEOUT_MINS requires an LCD with encoder or keypad." #elif !PIN_EXISTS(LCD_BACKLIGHT) - #error "LCD_BACKLIGHT_TIMEOUT requires LCD_BACKLIGHT_PIN." + #error "LCD_BACKLIGHT_TIMEOUT_MINS requires LCD_BACKLIGHT_PIN." #endif #endif diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index e32715988d2f..b72a1ac9263b 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -343,8 +343,7 @@ void MarlinUI::draw_kill_screen() { void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop #if HAS_DISPLAY_SLEEP - void MarlinUI::sleep_on() { u8g.sleepOn(); } - void MarlinUI::sleep_off() { u8g.sleepOff(); } + void MarlinUI::sleep_display(const bool sleep) { sleep ? u8g.sleepOn() : u8g.sleepOff(); } #endif #if HAS_LCD_BRIGHTNESS diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 5708221e9cc3..9939ea3f4429 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -407,7 +407,6 @@ namespace Language_de { LSTR MSG_ADVANCE_K_E = _UxGT("Vorschubfaktor *"); LSTR MSG_CONTRAST = _UxGT("LCD-Kontrast"); LSTR MSG_BRIGHTNESS = _UxGT("LCD-Helligkeit"); - LSTR MSG_LCD_TIMEOUT_SEC = _UxGT("LCD-Ruhezustand (s)"); LSTR MSG_SCREEN_TIMEOUT = _UxGT("LCD Timeout (m)"); LSTR MSG_BRIGHTNESS_OFF = _UxGT("LCD ausschalten"); LSTR MSG_STORE_EEPROM = _UxGT("Konfig. speichern"); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 57cae3d32858..d03b455c7196 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -422,7 +422,6 @@ namespace Language_en { LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *"); LSTR MSG_CONTRAST = _UxGT("LCD Contrast"); LSTR MSG_BRIGHTNESS = _UxGT("LCD Brightness"); - LSTR MSG_LCD_TIMEOUT_SEC = _UxGT("LCD Timeout (s)"); LSTR MSG_SCREEN_TIMEOUT = _UxGT("LCD Timeout (m)"); LSTR MSG_BRIGHTNESS_OFF = _UxGT("Backlight Off"); LSTR MSG_STORE_EEPROM = _UxGT("Store Settings"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 55b1b4e2e9c9..0a11e862f7e1 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -321,7 +321,7 @@ namespace Language_fr { LSTR MSG_ADVANCE_K_E = _UxGT("Avance K *"); LSTR MSG_BRIGHTNESS = _UxGT("Luminosité LCD"); LSTR MSG_CONTRAST = _UxGT("Contraste LCD"); - LSTR MSG_LCD_TIMEOUT_SEC = _UxGT("Veille LCD (s)"); + LSTR MSG_SCREEN_TIMEOUT = _UxGT("Veille LCD (m)"); LSTR MSG_BRIGHTNESS_OFF = _UxGT("Éteindre l'écran LCD"); LSTR MSG_STORE_EEPROM = _UxGT("Enregistrer config."); LSTR MSG_LOAD_EEPROM = _UxGT("Charger config."); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index f0c21deb96cd..0c1b3a8cee35 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -418,7 +418,6 @@ namespace Language_it { LSTR MSG_ADVANCE_K_E = _UxGT("K Avanzamento *"); LSTR MSG_CONTRAST = _UxGT("Contrasto LCD"); LSTR MSG_BRIGHTNESS = _UxGT("Luminosità LCD"); - LSTR MSG_LCD_TIMEOUT_SEC = _UxGT("Timeout LCD (s)"); LSTR MSG_SCREEN_TIMEOUT = _UxGT("Timeout LCD (m)"); LSTR MSG_BRIGHTNESS_OFF = _UxGT("Spegni Retroillum."); LSTR MSG_STORE_EEPROM = _UxGT("Salva impostazioni"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index ef1396e81ff3..bb332f4b1ff2 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -419,7 +419,6 @@ namespace Language_sk { LSTR MSG_ADVANCE_K_E = _UxGT("K pre posun *"); LSTR MSG_CONTRAST = _UxGT("Kontrast LCD"); LSTR MSG_BRIGHTNESS = _UxGT("Jas LCD"); - LSTR MSG_LCD_TIMEOUT_SEC = _UxGT("Čas. limit LCD (s)"); LSTR MSG_SCREEN_TIMEOUT = _UxGT("Čas. limit LCD (m)"); LSTR MSG_BRIGHTNESS_OFF = _UxGT("Podsviet. vyp."); LSTR MSG_STORE_EEPROM = _UxGT("Uložiť nastavenie"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 6170faedaeea..ccdcb21ddf38 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -455,7 +455,7 @@ namespace Language_uk { LSTR MSG_CONTRAST = _UxGT("Контраст"); LSTR MSG_BRIGHTNESS = _UxGT("Яскравість"); #endif - LSTR MSG_LCD_TIMEOUT_SEC = _UxGT("LCD Таймаут, с"); + LSTR MSG_SCREEN_TIMEOUT = _UxGT("LCD Таймаут, x"); LSTR MSG_BRIGHTNESS_OFF = _UxGT("Підсвітка вимк."); LSTR MSG_STORE_EEPROM = _UxGT("Зберегти в EEPROM"); LSTR MSG_LOAD_EEPROM = _UxGT("Зчитати з EEPROM"); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index e03e80ed3ce3..8b9c0e048e6b 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -174,22 +174,26 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update #endif -#if LCD_BACKLIGHT_TIMEOUT +#if LCD_BACKLIGHT_TIMEOUT_MINS - uint16_t MarlinUI::lcd_backlight_timeout; // Initialized by settings.load() + constexpr uint8_t MarlinUI::backlight_timeout_min, MarlinUI::backlight_timeout_max; + + uint8_t MarlinUI::backlight_timeout_minutes; // Initialized by settings.load() millis_t MarlinUI::backlight_off_ms = 0; void MarlinUI::refresh_backlight_timeout() { - backlight_off_ms = lcd_backlight_timeout ? millis() + lcd_backlight_timeout * 1000UL : 0; + backlight_off_ms = backlight_timeout_minutes ? millis() + backlight_timeout_minutes * 60UL * 1000UL : 0; WRITE(LCD_BACKLIGHT_PIN, HIGH); } #elif HAS_DISPLAY_SLEEP + constexpr uint8_t MarlinUI::sleep_timeout_min, MarlinUI::sleep_timeout_max; + uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load() millis_t MarlinUI::screen_timeout_millis = 0; void MarlinUI::refresh_screen_timeout() { screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0; - sleep_off(); + sleep_display(false); } #endif @@ -1059,7 +1063,7 @@ void MarlinUI::init() { reset_status_timeout(ms); - #if LCD_BACKLIGHT_TIMEOUT + #if LCD_BACKLIGHT_TIMEOUT_MINS refresh_backlight_timeout(); #elif HAS_DISPLAY_SLEEP refresh_screen_timeout(); @@ -1169,14 +1173,14 @@ void MarlinUI::init() { return_to_status(); #endif - #if LCD_BACKLIGHT_TIMEOUT + #if LCD_BACKLIGHT_TIMEOUT_MINS if (backlight_off_ms && ELAPSED(ms, backlight_off_ms)) { WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off backlight_off_ms = 0; } #elif HAS_DISPLAY_SLEEP if (screen_timeout_millis && ELAPSED(ms, screen_timeout_millis)) - sleep_on(); + sleep_display(); #endif // Change state of drawing flag between screen updates diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index b2a9bb5de955..d2e370890727 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -270,20 +270,19 @@ class MarlinUI { FORCE_INLINE static void refresh_brightness() { set_brightness(brightness); } #endif - #if LCD_BACKLIGHT_TIMEOUT - #define LCD_BKL_TIMEOUT_MIN 1u - #define LCD_BKL_TIMEOUT_MAX UINT16_MAX // Slightly more than 18 hours - static uint16_t lcd_backlight_timeout; + #if LCD_BACKLIGHT_TIMEOUT_MINS + static constexpr uint8_t backlight_timeout_min = 0; + static constexpr uint8_t backlight_timeout_max = 99; + static uint8_t backlight_timeout_minutes; static millis_t backlight_off_ms; static void refresh_backlight_timeout(); #elif HAS_DISPLAY_SLEEP - #define SLEEP_TIMEOUT_MIN 0 - #define SLEEP_TIMEOUT_MAX 99 + static constexpr uint8_t sleep_timeout_min = 0; + static constexpr uint8_t sleep_timeout_max = 99; static uint8_t sleep_timeout_minutes; static millis_t screen_timeout_millis; static void refresh_screen_timeout(); - static void sleep_on(); - static void sleep_off(); + static void sleep_display(const bool sleep=true); #endif #if HAS_DWIN_E3V2_BASIC diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 1f2257a77fe3..9eef94823e33 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -547,10 +547,10 @@ void menu_configuration() { // // Set display backlight / sleep timeout // - #if LCD_BACKLIGHT_TIMEOUT && LCD_BKL_TIMEOUT_MIN < LCD_BKL_TIMEOUT_MAX - EDIT_ITEM(uint16_4, MSG_LCD_TIMEOUT_SEC, &ui.lcd_backlight_timeout, LCD_BKL_TIMEOUT_MIN, LCD_BKL_TIMEOUT_MAX, ui.refresh_backlight_timeout); + #if LCD_BACKLIGHT_TIMEOUT_MINS + EDIT_ITEM(uint8, MSG_SCREEN_TIMEOUT, &ui.backlight_timeout_minutes, ui.backlight_timeout_min, ui.backlight_timeout_max, ui.refresh_backlight_timeout); #elif HAS_DISPLAY_SLEEP - EDIT_ITEM(uint8, MSG_SCREEN_TIMEOUT, &ui.sleep_timeout_minutes, SLEEP_TIMEOUT_MIN, SLEEP_TIMEOUT_MAX, ui.refresh_screen_timeout); + EDIT_ITEM(uint8, MSG_SCREEN_TIMEOUT, &ui.sleep_timeout_minutes, ui.sleep_timeout_min, ui.sleep_timeout_max, ui.refresh_screen_timeout); #endif #if ENABLED(FWRETRACT) diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index b0eab65c649b..7c81e3dd39bd 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -402,8 +402,13 @@ class MenuItem_bool : public MenuEditItemBase { // Predefined menu item types // -#define BACK_ITEM_F(FLABEL) MENU_ITEM_F(back, FLABEL) -#define BACK_ITEM(LABEL) MENU_ITEM(back, LABEL) +#if HAS_BACK_ITEM + #define BACK_ITEM_F(FLABEL) MENU_ITEM_F(back, FLABEL) + #define BACK_ITEM(LABEL) MENU_ITEM(back, LABEL) +#else + #define BACK_ITEM_F(FLABEL) NOOP + #define BACK_ITEM(LABEL) NOOP +#endif #define ACTION_ITEM_N_S_F(N, S, FLABEL, ACTION) MENU_ITEM_N_S_F(function, N, S, FLABEL, ACTION) #define ACTION_ITEM_N_S(N, S, LABEL, ACTION) ACTION_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), ACTION) diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 518f1e0f502d..bd1670388589 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -325,6 +325,17 @@ void menu_main() { SUBMENU(MSG_TEMPERATURE, menu_temperature); #endif + #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES) + YESNO_ITEM(MSG_FILAMENTCHANGE, + menu_change_filament, nullptr, + GET_TEXT_F(MSG_FILAMENTCHANGE), (const char *)nullptr, F("?") + ); + #else + SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament); + #endif + #endif + #if HAS_POWER_MONITOR SUBMENU(MSG_POWER_MONITOR, menu_power_monitor); #endif @@ -349,17 +360,6 @@ void menu_main() { } #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) - #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES) - YESNO_ITEM(MSG_FILAMENTCHANGE, - menu_change_filament, nullptr, - GET_TEXT_F(MSG_FILAMENTCHANGE), (const char *)nullptr, F("?") - ); - #else - SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament); - #endif - #endif - #if ENABLED(LCD_INFO_MENU) SUBMENU(MSG_INFO_MENU, menu_info); #endif diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 050b59f39f90..824b2699247b 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -302,7 +302,7 @@ bool Touch::get_point(int16_t *x, int16_t *y) { WRITE(TFT_BACKLIGHT_PIN, HIGH); #endif } - next_sleep_ms = millis() + SEC_TO_MS(TOUCH_IDLE_SLEEP); + next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60); } #endif // HAS_TOUCH_SLEEP diff --git a/Marlin/src/lcd/touch/touch_buttons.cpp b/Marlin/src/lcd/touch/touch_buttons.cpp index 604f366ed4f2..d641dd3b1c92 100644 --- a/Marlin/src/lcd/touch/touch_buttons.cpp +++ b/Marlin/src/lcd/touch/touch_buttons.cpp @@ -61,7 +61,7 @@ TouchButtons touchBt; void TouchButtons::init() { touchIO.Init(); - TERN_(HAS_TOUCH_SLEEP, next_sleep_ms = millis() + SEC_TO_MS(TOUCH_IDLE_SLEEP)); + TERN_(HAS_TOUCH_SLEEP, next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60)); } uint8_t TouchButtons::read_buttons() { @@ -135,7 +135,7 @@ uint8_t TouchButtons::read_buttons() { WRITE(TFT_BACKLIGHT_PIN, HIGH); #endif } - next_sleep_ms = millis() + SEC_TO_MS(TOUCH_IDLE_SLEEP); + next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60); } #endif // HAS_TOUCH_SLEEP diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index b40690e22c6a..aa6f48d763df 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -402,8 +402,8 @@ typedef struct SettingsDataStruct { // // Display Sleep // - #if LCD_BACKLIGHT_TIMEOUT - uint16_t lcd_backlight_timeout; // M255 S + #if LCD_BACKLIGHT_TIMEOUT_MINS + uint8_t backlight_timeout_minutes; // M255 S #elif HAS_DISPLAY_SLEEP uint8_t sleep_timeout_minutes; // M255 S #endif @@ -640,7 +640,7 @@ void MarlinSettings::postprocess() { TERN_(HAS_LCD_CONTRAST, ui.refresh_contrast()); TERN_(HAS_LCD_BRIGHTNESS, ui.refresh_brightness()); - #if LCD_BACKLIGHT_TIMEOUT + #if LCD_BACKLIGHT_TIMEOUT_MINS ui.refresh_backlight_timeout(); #elif HAS_DISPLAY_SLEEP ui.refresh_screen_timeout(); @@ -1157,8 +1157,8 @@ void MarlinSettings::postprocess() { // // LCD Backlight / Sleep Timeout // - #if LCD_BACKLIGHT_TIMEOUT - EEPROM_WRITE(ui.lcd_backlight_timeout); + #if LCD_BACKLIGHT_TIMEOUT_MINS + EEPROM_WRITE(ui.backlight_timeout_minutes); #elif HAS_DISPLAY_SLEEP EEPROM_WRITE(ui.sleep_timeout_minutes); #endif @@ -2108,8 +2108,8 @@ void MarlinSettings::postprocess() { // // LCD Backlight / Sleep Timeout // - #if LCD_BACKLIGHT_TIMEOUT - EEPROM_READ(ui.lcd_backlight_timeout); + #if LCD_BACKLIGHT_TIMEOUT_MINS + EEPROM_READ(ui.backlight_timeout_minutes); #elif HAS_DISPLAY_SLEEP EEPROM_READ(ui.sleep_timeout_minutes); #endif @@ -3198,8 +3198,8 @@ void MarlinSettings::reset() { // // LCD Backlight / Sleep Timeout // - #if LCD_BACKLIGHT_TIMEOUT - ui.lcd_backlight_timeout = LCD_BACKLIGHT_TIMEOUT; + #if LCD_BACKLIGHT_TIMEOUT_MINS + ui.backlight_timeout_minutes = LCD_BACKLIGHT_TIMEOUT_MINS; #elif HAS_DISPLAY_SLEEP ui.sleep_timeout_minutes = DISPLAY_SLEEP_MINUTES; #endif diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 536f723b73b7..9cb50688cdea 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -213,7 +213,7 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 1 \ TEMP_SENSOR_0 -2 TEMP_SENSOR_REDUNDANT -2 \ TEMP_SENSOR_REDUNDANT_SOURCE E1 TEMP_SENSOR_REDUNDANT_TARGET E0 \ TEMP_0_CS_PIN 11 TEMP_1_CS_PIN 12 \ - LCD_BACKLIGHT_TIMEOUT 30 + LCD_BACKLIGHT_TIMEOUT_MINS 2 opt_enable MPCTEMP MINIPANEL opt_disable PIDTEMP exec_test $1 $2 "MEGA2560 RAMPS | Redundant temperature sensor | 2x MAX6675 | BL Timeout" "$3"