Browse Source

♻️ Display sleep minutes, encoder disable option (#24618)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
FB4S_WIFI
EvilGremlin 2 years ago
committed by Scott Lahteine
parent
commit
ef1cf0d5a1
  1. 3
      Marlin/Configuration.h
  2. 4
      Marlin/Configuration_adv.h
  3. 14
      Marlin/src/gcode/lcd/M255.cpp
  4. 2
      Marlin/src/inc/Conditionals_LCD.h
  5. 4
      Marlin/src/inc/Conditionals_adv.h
  6. 4
      Marlin/src/inc/Conditionals_post.h
  7. 10
      Marlin/src/inc/SanityCheck.h
  8. 3
      Marlin/src/lcd/dogm/marlinui_DOGM.cpp
  9. 1
      Marlin/src/lcd/language/language_de.h
  10. 1
      Marlin/src/lcd/language/language_en.h
  11. 2
      Marlin/src/lcd/language/language_fr.h
  12. 1
      Marlin/src/lcd/language/language_it.h
  13. 1
      Marlin/src/lcd/language/language_sk.h
  14. 2
      Marlin/src/lcd/language/language_uk.h
  15. 18
      Marlin/src/lcd/marlinui.cpp
  16. 15
      Marlin/src/lcd/marlinui.h
  17. 6
      Marlin/src/lcd/menu/menu_configuration.cpp
  18. 5
      Marlin/src/lcd/menu/menu_item.h
  19. 22
      Marlin/src/lcd/menu/menu_main.cpp
  20. 2
      Marlin/src/lcd/tft/touch.cpp
  21. 4
      Marlin/src/lcd/touch/touch_buttons.cpp
  22. 18
      Marlin/src/module/settings.cpp
  23. 2
      buildroot/tests/mega2560

3
Marlin/Configuration.h

@ -3159,7 +3159,8 @@
#define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens #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_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 #define TOUCH_SCREEN_CALIBRATION

4
Marlin/Configuration_adv.h

@ -1321,7 +1321,7 @@
// //
// LCD Backlight Timeout // 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) #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 //#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 * Adds the menu item Configuration > LCD Timeout (m) to set a wait period
* from 0 (disabled) to 99 minutes. * 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 * ST7920-based LCDs can emulate a 16 x 4 character display using

14
Marlin/src/gcode/lcd/M255.cpp

@ -32,12 +32,11 @@
*/ */
void GcodeSuite::M255() { void GcodeSuite::M255() {
if (parser.seenval('S')) { if (parser.seenval('S')) {
#if HAS_DISPLAY_SLEEP
const int m = parser.value_int(); const int m = parser.value_int();
ui.sleep_timeout_minutes = constrain(m, SLEEP_TIMEOUT_MIN, SLEEP_TIMEOUT_MAX); #if HAS_DISPLAY_SLEEP
ui.sleep_timeout_minutes = constrain(m, ui.sleep_timeout_min, ui.sleep_timeout_max);
#else #else
const unsigned int s = parser.value_ushort() * 60; ui.backlight_timeout_minutes = constrain(m, ui.backlight_timeout_min, ui.backlight_timeout_max);
ui.lcd_backlight_timeout = constrain(s, LCD_BKL_TIMEOUT_MIN, LCD_BKL_TIMEOUT_MAX);
#endif #endif
} }
else else
@ -47,11 +46,8 @@ void GcodeSuite::M255() {
void GcodeSuite::M255_report(const bool forReplay/*=true*/) { void GcodeSuite::M255_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, F(STR_DISPLAY_SLEEP)); report_heading_etc(forReplay, F(STR_DISPLAY_SLEEP));
SERIAL_ECHOLNPGM(" M255 S", SERIAL_ECHOLNPGM(" M255 S",
#if HAS_DISPLAY_SLEEP TERN(HAS_DISPLAY_SLEEP, ui.sleep_timeout_minutes, ui.backlight_timeout_minutes),
ui.sleep_timeout_minutes, " ; (minutes)" " ; (minutes)"
#else
ui.lcd_backlight_timeout, " ; (seconds)"
#endif
); );
} }

2
Marlin/src/inc/Conditionals_LCD.h

@ -1599,7 +1599,7 @@
// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046' // This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
#if ENABLED(TOUCH_SCREEN) #if ENABLED(TOUCH_SCREEN)
#if TOUCH_IDLE_SLEEP #if TOUCH_IDLE_SLEEP_MINS
#define HAS_TOUCH_SLEEP 1 #define HAS_TOUCH_SLEEP 1
#endif #endif
#if NONE(TFT_TOUCH_DEVICE_GT911, TFT_TOUCH_DEVICE_XPT2046) #if NONE(TFT_TOUCH_DEVICE_GT911, TFT_TOUCH_DEVICE_XPT2046)

4
Marlin/src/inc/Conditionals_adv.h

@ -647,10 +647,10 @@
#if ALL(HAS_RESUME_CONTINUE, PRINTER_EVENT_LEDS, SDSUPPORT) #if ALL(HAS_RESUME_CONTINUE, PRINTER_EVENT_LEDS, SDSUPPORT)
#define HAS_LEDS_OFF_FLAG 1 #define HAS_LEDS_OFF_FLAG 1
#endif #endif
#ifdef DISPLAY_SLEEP_MINUTES #ifdef DISPLAY_SLEEP_MINUTES || TOUCH_IDLE_SLEEP_MINS
#define HAS_DISPLAY_SLEEP 1 #define HAS_DISPLAY_SLEEP 1
#endif #endif
#if HAS_DISPLAY_SLEEP || LCD_BACKLIGHT_TIMEOUT #if HAS_DISPLAY_SLEEP || LCD_BACKLIGHT_TIMEOUT_MINS
#define HAS_GCODE_M255 1 #define HAS_GCODE_M255 1
#endif #endif

4
Marlin/src/inc/Conditionals_post.h

@ -3761,6 +3761,10 @@
#define HAS_ROTARY_ENCODER 1 #define HAS_ROTARY_ENCODER 1
#endif #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) #if PIN_EXISTS(SAFE_POWER) && DISABLED(DISABLE_DRIVER_SAFE_POWER_PROTECT)
#define HAS_DRIVER_SAFE_POWER_PROTECT 1 #define HAS_DRIVER_SAFE_POWER_PROTECT 1
#endif #endif

10
Marlin/src/inc/SanityCheck.h

@ -642,6 +642,10 @@
#error "LEVEL_CORNERS_* settings have been renamed BED_TRAMMING_*." #error "LEVEL_CORNERS_* settings have been renamed BED_TRAMMING_*."
#elif defined(LEVEL_CENTER_TOO) #elif defined(LEVEL_CENTER_TOO)
#error "LEVEL_CENTER_TOO is now BED_TRAMMING_INCLUDE_CENTER." #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 #endif
// L64xx stepper drivers have been removed // 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
#endif #endif
#if LCD_BACKLIGHT_TIMEOUT #if LCD_BACKLIGHT_TIMEOUT_MINS
#if !HAS_ENCODER_ACTION #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) #elif !PIN_EXISTS(LCD_BACKLIGHT)
#error "LCD_BACKLIGHT_TIMEOUT requires LCD_BACKLIGHT_PIN." #error "LCD_BACKLIGHT_TIMEOUT_MINS requires LCD_BACKLIGHT_PIN."
#endif #endif
#endif #endif

3
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 void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
#if HAS_DISPLAY_SLEEP #if HAS_DISPLAY_SLEEP
void MarlinUI::sleep_on() { u8g.sleepOn(); } void MarlinUI::sleep_display(const bool sleep) { sleep ? u8g.sleepOn() : u8g.sleepOff(); }
void MarlinUI::sleep_off() { u8g.sleepOff(); }
#endif #endif
#if HAS_LCD_BRIGHTNESS #if HAS_LCD_BRIGHTNESS

1
Marlin/src/lcd/language/language_de.h

@ -407,7 +407,6 @@ namespace Language_de {
LSTR MSG_ADVANCE_K_E = _UxGT("Vorschubfaktor *"); LSTR MSG_ADVANCE_K_E = _UxGT("Vorschubfaktor *");
LSTR MSG_CONTRAST = _UxGT("LCD-Kontrast"); LSTR MSG_CONTRAST = _UxGT("LCD-Kontrast");
LSTR MSG_BRIGHTNESS = _UxGT("LCD-Helligkeit"); 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_SCREEN_TIMEOUT = _UxGT("LCD Timeout (m)");
LSTR MSG_BRIGHTNESS_OFF = _UxGT("LCD ausschalten"); LSTR MSG_BRIGHTNESS_OFF = _UxGT("LCD ausschalten");
LSTR MSG_STORE_EEPROM = _UxGT("Konfig. speichern"); LSTR MSG_STORE_EEPROM = _UxGT("Konfig. speichern");

1
Marlin/src/lcd/language/language_en.h

@ -422,7 +422,6 @@ namespace Language_en {
LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *"); LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *");
LSTR MSG_CONTRAST = _UxGT("LCD Contrast"); LSTR MSG_CONTRAST = _UxGT("LCD Contrast");
LSTR MSG_BRIGHTNESS = _UxGT("LCD Brightness"); 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_SCREEN_TIMEOUT = _UxGT("LCD Timeout (m)");
LSTR MSG_BRIGHTNESS_OFF = _UxGT("Backlight Off"); LSTR MSG_BRIGHTNESS_OFF = _UxGT("Backlight Off");
LSTR MSG_STORE_EEPROM = _UxGT("Store Settings"); LSTR MSG_STORE_EEPROM = _UxGT("Store Settings");

2
Marlin/src/lcd/language/language_fr.h

@ -321,7 +321,7 @@ namespace Language_fr {
LSTR MSG_ADVANCE_K_E = _UxGT("Avance K *"); LSTR MSG_ADVANCE_K_E = _UxGT("Avance K *");
LSTR MSG_BRIGHTNESS = _UxGT("Luminosité LCD"); LSTR MSG_BRIGHTNESS = _UxGT("Luminosité LCD");
LSTR MSG_CONTRAST = _UxGT("Contraste 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_BRIGHTNESS_OFF = _UxGT("Éteindre l'écran LCD");
LSTR MSG_STORE_EEPROM = _UxGT("Enregistrer config."); LSTR MSG_STORE_EEPROM = _UxGT("Enregistrer config.");
LSTR MSG_LOAD_EEPROM = _UxGT("Charger config."); LSTR MSG_LOAD_EEPROM = _UxGT("Charger config.");

1
Marlin/src/lcd/language/language_it.h

@ -418,7 +418,6 @@ namespace Language_it {
LSTR MSG_ADVANCE_K_E = _UxGT("K Avanzamento *"); LSTR MSG_ADVANCE_K_E = _UxGT("K Avanzamento *");
LSTR MSG_CONTRAST = _UxGT("Contrasto LCD"); LSTR MSG_CONTRAST = _UxGT("Contrasto LCD");
LSTR MSG_BRIGHTNESS = _UxGT("Luminosità 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_SCREEN_TIMEOUT = _UxGT("Timeout LCD (m)");
LSTR MSG_BRIGHTNESS_OFF = _UxGT("Spegni Retroillum."); LSTR MSG_BRIGHTNESS_OFF = _UxGT("Spegni Retroillum.");
LSTR MSG_STORE_EEPROM = _UxGT("Salva impostazioni"); LSTR MSG_STORE_EEPROM = _UxGT("Salva impostazioni");

1
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_ADVANCE_K_E = _UxGT("K pre posun *");
LSTR MSG_CONTRAST = _UxGT("Kontrast LCD"); LSTR MSG_CONTRAST = _UxGT("Kontrast LCD");
LSTR MSG_BRIGHTNESS = _UxGT("Jas 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_SCREEN_TIMEOUT = _UxGT("Čas. limit LCD (m)");
LSTR MSG_BRIGHTNESS_OFF = _UxGT("Podsviet. vyp."); LSTR MSG_BRIGHTNESS_OFF = _UxGT("Podsviet. vyp.");
LSTR MSG_STORE_EEPROM = _UxGT("Uložiť nastavenie"); LSTR MSG_STORE_EEPROM = _UxGT("Uložiť nastavenie");

2
Marlin/src/lcd/language/language_uk.h

@ -455,7 +455,7 @@ namespace Language_uk {
LSTR MSG_CONTRAST = _UxGT("Контраст"); LSTR MSG_CONTRAST = _UxGT("Контраст");
LSTR MSG_BRIGHTNESS = _UxGT("Яскравість"); LSTR MSG_BRIGHTNESS = _UxGT("Яскравість");
#endif #endif
LSTR MSG_LCD_TIMEOUT_SEC = _UxGT("LCD Таймаут, с"); LSTR MSG_SCREEN_TIMEOUT = _UxGT("LCD Таймаут, x");
LSTR MSG_BRIGHTNESS_OFF = _UxGT("Підсвітка вимк."); LSTR MSG_BRIGHTNESS_OFF = _UxGT("Підсвітка вимк.");
LSTR MSG_STORE_EEPROM = _UxGT("Зберегти в EEPROM"); LSTR MSG_STORE_EEPROM = _UxGT("Зберегти в EEPROM");
LSTR MSG_LOAD_EEPROM = _UxGT("Зчитати з EEPROM"); LSTR MSG_LOAD_EEPROM = _UxGT("Зчитати з EEPROM");

18
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 volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
#endif #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; millis_t MarlinUI::backlight_off_ms = 0;
void MarlinUI::refresh_backlight_timeout() { 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); WRITE(LCD_BACKLIGHT_PIN, HIGH);
} }
#elif HAS_DISPLAY_SLEEP #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() uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load()
millis_t MarlinUI::screen_timeout_millis = 0; millis_t MarlinUI::screen_timeout_millis = 0;
void MarlinUI::refresh_screen_timeout() { void MarlinUI::refresh_screen_timeout() {
screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0; screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0;
sleep_off(); sleep_display(false);
} }
#endif #endif
@ -1059,7 +1063,7 @@ void MarlinUI::init() {
reset_status_timeout(ms); reset_status_timeout(ms);
#if LCD_BACKLIGHT_TIMEOUT #if LCD_BACKLIGHT_TIMEOUT_MINS
refresh_backlight_timeout(); refresh_backlight_timeout();
#elif HAS_DISPLAY_SLEEP #elif HAS_DISPLAY_SLEEP
refresh_screen_timeout(); refresh_screen_timeout();
@ -1169,14 +1173,14 @@ void MarlinUI::init() {
return_to_status(); return_to_status();
#endif #endif
#if LCD_BACKLIGHT_TIMEOUT #if LCD_BACKLIGHT_TIMEOUT_MINS
if (backlight_off_ms && ELAPSED(ms, backlight_off_ms)) { if (backlight_off_ms && ELAPSED(ms, backlight_off_ms)) {
WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off
backlight_off_ms = 0; backlight_off_ms = 0;
} }
#elif HAS_DISPLAY_SLEEP #elif HAS_DISPLAY_SLEEP
if (screen_timeout_millis && ELAPSED(ms, screen_timeout_millis)) if (screen_timeout_millis && ELAPSED(ms, screen_timeout_millis))
sleep_on(); sleep_display();
#endif #endif
// Change state of drawing flag between screen updates // Change state of drawing flag between screen updates

15
Marlin/src/lcd/marlinui.h

@ -270,20 +270,19 @@ public:
FORCE_INLINE static void refresh_brightness() { set_brightness(brightness); } FORCE_INLINE static void refresh_brightness() { set_brightness(brightness); }
#endif #endif
#if LCD_BACKLIGHT_TIMEOUT #if LCD_BACKLIGHT_TIMEOUT_MINS
#define LCD_BKL_TIMEOUT_MIN 1u static constexpr uint8_t backlight_timeout_min = 0;
#define LCD_BKL_TIMEOUT_MAX UINT16_MAX // Slightly more than 18 hours static constexpr uint8_t backlight_timeout_max = 99;
static uint16_t lcd_backlight_timeout; static uint8_t backlight_timeout_minutes;
static millis_t backlight_off_ms; static millis_t backlight_off_ms;
static void refresh_backlight_timeout(); static void refresh_backlight_timeout();
#elif HAS_DISPLAY_SLEEP #elif HAS_DISPLAY_SLEEP
#define SLEEP_TIMEOUT_MIN 0 static constexpr uint8_t sleep_timeout_min = 0;
#define SLEEP_TIMEOUT_MAX 99 static constexpr uint8_t sleep_timeout_max = 99;
static uint8_t sleep_timeout_minutes; static uint8_t sleep_timeout_minutes;
static millis_t screen_timeout_millis; static millis_t screen_timeout_millis;
static void refresh_screen_timeout(); static void refresh_screen_timeout();
static void sleep_on(); static void sleep_display(const bool sleep=true);
static void sleep_off();
#endif #endif
#if HAS_DWIN_E3V2_BASIC #if HAS_DWIN_E3V2_BASIC

6
Marlin/src/lcd/menu/menu_configuration.cpp

@ -547,10 +547,10 @@ void menu_configuration() {
// //
// Set display backlight / sleep timeout // Set display backlight / sleep timeout
// //
#if LCD_BACKLIGHT_TIMEOUT && LCD_BKL_TIMEOUT_MIN < LCD_BKL_TIMEOUT_MAX #if LCD_BACKLIGHT_TIMEOUT_MINS
EDIT_ITEM(uint16_4, MSG_LCD_TIMEOUT_SEC, &ui.lcd_backlight_timeout, LCD_BKL_TIMEOUT_MIN, LCD_BKL_TIMEOUT_MAX, ui.refresh_backlight_timeout); 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 #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 #endif
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)

5
Marlin/src/lcd/menu/menu_item.h

@ -402,8 +402,13 @@ class MenuItem_bool : public MenuEditItemBase {
// Predefined menu item types // // Predefined menu item types //
#if HAS_BACK_ITEM
#define BACK_ITEM_F(FLABEL) MENU_ITEM_F(back, FLABEL) #define BACK_ITEM_F(FLABEL) MENU_ITEM_F(back, FLABEL)
#define BACK_ITEM(LABEL) MENU_ITEM(back, LABEL) #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_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) #define ACTION_ITEM_N_S(N, S, LABEL, ACTION) ACTION_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), ACTION)

22
Marlin/src/lcd/menu/menu_main.cpp

@ -325,6 +325,17 @@ void menu_main() {
SUBMENU(MSG_TEMPERATURE, menu_temperature); SUBMENU(MSG_TEMPERATURE, menu_temperature);
#endif #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 #if HAS_POWER_MONITOR
SUBMENU(MSG_POWER_MONITOR, menu_power_monitor); SUBMENU(MSG_POWER_MONITOR, menu_power_monitor);
#endif #endif
@ -349,17 +360,6 @@ void menu_main() {
} }
#endif #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) #if ENABLED(LCD_INFO_MENU)
SUBMENU(MSG_INFO_MENU, menu_info); SUBMENU(MSG_INFO_MENU, menu_info);
#endif #endif

2
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); WRITE(TFT_BACKLIGHT_PIN, HIGH);
#endif #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 #endif // HAS_TOUCH_SLEEP

4
Marlin/src/lcd/touch/touch_buttons.cpp

@ -61,7 +61,7 @@ TouchButtons touchBt;
void TouchButtons::init() { void TouchButtons::init() {
touchIO.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() { uint8_t TouchButtons::read_buttons() {
@ -135,7 +135,7 @@ uint8_t TouchButtons::read_buttons() {
WRITE(TFT_BACKLIGHT_PIN, HIGH); WRITE(TFT_BACKLIGHT_PIN, HIGH);
#endif #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 #endif // HAS_TOUCH_SLEEP

18
Marlin/src/module/settings.cpp

@ -402,8 +402,8 @@ typedef struct SettingsDataStruct {
// //
// Display Sleep // Display Sleep
// //
#if LCD_BACKLIGHT_TIMEOUT #if LCD_BACKLIGHT_TIMEOUT_MINS
uint16_t lcd_backlight_timeout; // M255 S uint8_t backlight_timeout_minutes; // M255 S
#elif HAS_DISPLAY_SLEEP #elif HAS_DISPLAY_SLEEP
uint8_t sleep_timeout_minutes; // M255 S uint8_t sleep_timeout_minutes; // M255 S
#endif #endif
@ -640,7 +640,7 @@ void MarlinSettings::postprocess() {
TERN_(HAS_LCD_CONTRAST, ui.refresh_contrast()); TERN_(HAS_LCD_CONTRAST, ui.refresh_contrast());
TERN_(HAS_LCD_BRIGHTNESS, ui.refresh_brightness()); TERN_(HAS_LCD_BRIGHTNESS, ui.refresh_brightness());
#if LCD_BACKLIGHT_TIMEOUT #if LCD_BACKLIGHT_TIMEOUT_MINS
ui.refresh_backlight_timeout(); ui.refresh_backlight_timeout();
#elif HAS_DISPLAY_SLEEP #elif HAS_DISPLAY_SLEEP
ui.refresh_screen_timeout(); ui.refresh_screen_timeout();
@ -1157,8 +1157,8 @@ void MarlinSettings::postprocess() {
// //
// LCD Backlight / Sleep Timeout // LCD Backlight / Sleep Timeout
// //
#if LCD_BACKLIGHT_TIMEOUT #if LCD_BACKLIGHT_TIMEOUT_MINS
EEPROM_WRITE(ui.lcd_backlight_timeout); EEPROM_WRITE(ui.backlight_timeout_minutes);
#elif HAS_DISPLAY_SLEEP #elif HAS_DISPLAY_SLEEP
EEPROM_WRITE(ui.sleep_timeout_minutes); EEPROM_WRITE(ui.sleep_timeout_minutes);
#endif #endif
@ -2108,8 +2108,8 @@ void MarlinSettings::postprocess() {
// //
// LCD Backlight / Sleep Timeout // LCD Backlight / Sleep Timeout
// //
#if LCD_BACKLIGHT_TIMEOUT #if LCD_BACKLIGHT_TIMEOUT_MINS
EEPROM_READ(ui.lcd_backlight_timeout); EEPROM_READ(ui.backlight_timeout_minutes);
#elif HAS_DISPLAY_SLEEP #elif HAS_DISPLAY_SLEEP
EEPROM_READ(ui.sleep_timeout_minutes); EEPROM_READ(ui.sleep_timeout_minutes);
#endif #endif
@ -3198,8 +3198,8 @@ void MarlinSettings::reset() {
// //
// LCD Backlight / Sleep Timeout // LCD Backlight / Sleep Timeout
// //
#if LCD_BACKLIGHT_TIMEOUT #if LCD_BACKLIGHT_TIMEOUT_MINS
ui.lcd_backlight_timeout = LCD_BACKLIGHT_TIMEOUT; ui.backlight_timeout_minutes = LCD_BACKLIGHT_TIMEOUT_MINS;
#elif HAS_DISPLAY_SLEEP #elif HAS_DISPLAY_SLEEP
ui.sleep_timeout_minutes = DISPLAY_SLEEP_MINUTES; ui.sleep_timeout_minutes = DISPLAY_SLEEP_MINUTES;
#endif #endif

2
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_0 -2 TEMP_SENSOR_REDUNDANT -2 \
TEMP_SENSOR_REDUNDANT_SOURCE E1 TEMP_SENSOR_REDUNDANT_TARGET E0 \ TEMP_SENSOR_REDUNDANT_SOURCE E1 TEMP_SENSOR_REDUNDANT_TARGET E0 \
TEMP_0_CS_PIN 11 TEMP_1_CS_PIN 12 \ TEMP_0_CS_PIN 11 TEMP_1_CS_PIN 12 \
LCD_BACKLIGHT_TIMEOUT 30 LCD_BACKLIGHT_TIMEOUT_MINS 2
opt_enable MPCTEMP MINIPANEL opt_enable MPCTEMP MINIPANEL
opt_disable PIDTEMP opt_disable PIDTEMP
exec_test $1 $2 "MEGA2560 RAMPS | Redundant temperature sensor | 2x MAX6675 | BL Timeout" "$3" exec_test $1 $2 "MEGA2560 RAMPS | Redundant temperature sensor | 2x MAX6675 | BL Timeout" "$3"

Loading…
Cancel
Save