Browse Source

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

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
EvilGremlin 1 year ago
parent
commit
2f91154cbd
No account linked to committer's email address

+ 4
- 3
Marlin/Configuration.h View File

@@ -3156,10 +3156,11 @@
3156 3156
 //
3157 3157
 //#define TOUCH_SCREEN
3158 3158
 #if ENABLED(TOUCH_SCREEN)
3159
-  #define BUTTON_DELAY_EDIT  50 // (ms) Button repeat delay for edit screens
3160
-  #define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus
3159
+  #define BUTTON_DELAY_EDIT      50 // (ms) Button repeat delay for edit screens
3160
+  #define BUTTON_DELAY_MENU     250 // (ms) Button repeat delay for menus
3161 3161
 
3162
-  //#define TOUCH_IDLE_SLEEP 300 // (s) Turn off the TFT backlight if set (5mn)
3162
+  //#define DISABLE_ENCODER         // Disable the click encoder, if any
3163
+  //#define TOUCH_IDLE_SLEEP_MINS 5 // (minutes) Display Sleep after a period of inactivity. Set with M255 S.
3163 3164
 
3164 3165
   #define TOUCH_SCREEN_CALIBRATION
3165 3166
 

+ 2
- 2
Marlin/Configuration_adv.h View File

@@ -1321,7 +1321,7 @@
1321 1321
 //
1322 1322
 // LCD Backlight Timeout
1323 1323
 //
1324
-//#define LCD_BACKLIGHT_TIMEOUT 30 // (s) Timeout before turning off the backlight
1324
+//#define LCD_BACKLIGHT_TIMEOUT_MINS 1  // (minutes) Timeout before turning off the backlight
1325 1325
 
1326 1326
 #if HAS_BED_PROBE && EITHER(HAS_MARLINUI_MENU, HAS_TFT_LVGL_UI)
1327 1327
   //#define PROBE_OFFSET_WIZARD       // Add a Probe Z Offset calibration option to the LCD menu
@@ -1739,7 +1739,7 @@
1739 1739
    * Adds the menu item Configuration > LCD Timeout (m) to set a wait period
1740 1740
    * from 0 (disabled) to 99 minutes.
1741 1741
    */
1742
-  //#define DISPLAY_SLEEP_MINUTES 2  // (minutes) Timeout before turning off the screen
1742
+  //#define DISPLAY_SLEEP_MINUTES 2  // (minutes) Timeout before turning off the screen. Set with M255 S.
1743 1743
 
1744 1744
   /**
1745 1745
    * ST7920-based LCDs can emulate a 16 x 4 character display using

+ 5
- 9
Marlin/src/gcode/lcd/M255.cpp View File

@@ -32,12 +32,11 @@
32 32
  */
33 33
 void GcodeSuite::M255() {
34 34
   if (parser.seenval('S')) {
35
+    const int m = parser.value_int();
35 36
     #if HAS_DISPLAY_SLEEP
36
-      const int m = parser.value_int();
37
-      ui.sleep_timeout_minutes = constrain(m, SLEEP_TIMEOUT_MIN, SLEEP_TIMEOUT_MAX);
37
+      ui.sleep_timeout_minutes = constrain(m, ui.sleep_timeout_min, ui.sleep_timeout_max);
38 38
     #else
39
-      const unsigned int s = parser.value_ushort() * 60;
40
-      ui.lcd_backlight_timeout = constrain(s, LCD_BKL_TIMEOUT_MIN, LCD_BKL_TIMEOUT_MAX);
39
+      ui.backlight_timeout_minutes = constrain(m, ui.backlight_timeout_min, ui.backlight_timeout_max);
41 40
     #endif
42 41
   }
43 42
   else
@@ -47,11 +46,8 @@ void GcodeSuite::M255() {
47 46
 void GcodeSuite::M255_report(const bool forReplay/*=true*/) {
48 47
   report_heading_etc(forReplay, F(STR_DISPLAY_SLEEP));
49 48
   SERIAL_ECHOLNPGM("  M255 S",
50
-    #if HAS_DISPLAY_SLEEP
51
-      ui.sleep_timeout_minutes, " ; (minutes)"
52
-    #else
53
-      ui.lcd_backlight_timeout, " ; (seconds)"
54
-    #endif
49
+    TERN(HAS_DISPLAY_SLEEP, ui.sleep_timeout_minutes, ui.backlight_timeout_minutes),
50
+    " ; (minutes)"
55 51
   );
56 52
 }
57 53
 

+ 1
- 1
Marlin/src/inc/Conditionals_LCD.h View File

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

+ 2
- 2
Marlin/src/inc/Conditionals_adv.h View File

@@ -647,10 +647,10 @@
647 647
 #if ALL(HAS_RESUME_CONTINUE, PRINTER_EVENT_LEDS, SDSUPPORT)
648 648
   #define HAS_LEDS_OFF_FLAG 1
649 649
 #endif
650
-#ifdef DISPLAY_SLEEP_MINUTES
650
+#ifdef DISPLAY_SLEEP_MINUTES || TOUCH_IDLE_SLEEP_MINS
651 651
   #define HAS_DISPLAY_SLEEP 1
652 652
 #endif
653
-#if HAS_DISPLAY_SLEEP || LCD_BACKLIGHT_TIMEOUT
653
+#if HAS_DISPLAY_SLEEP || LCD_BACKLIGHT_TIMEOUT_MINS
654 654
   #define HAS_GCODE_M255 1
655 655
 #endif
656 656
 

+ 4
- 0
Marlin/src/inc/Conditionals_post.h View File

@@ -3761,6 +3761,10 @@
3761 3761
   #define HAS_ROTARY_ENCODER 1
3762 3762
 #endif
3763 3763
 
3764
+#if DISABLED(DISABLE_ENCODER) && ANY(HAS_ROTARY_ENCODER, HAS_ADC_BUTTONS) && ANY(TFT_CLASSIC_UI, TFT_COLOR_UI)
3765
+  #define HAS_BACK_ITEM 1
3766
+#endif
3767
+
3764 3768
 #if PIN_EXISTS(SAFE_POWER) && DISABLED(DISABLE_DRIVER_SAFE_POWER_PROTECT)
3765 3769
   #define HAS_DRIVER_SAFE_POWER_PROTECT 1
3766 3770
 #endif

+ 7
- 3
Marlin/src/inc/SanityCheck.h View File

@@ -642,6 +642,10 @@
642 642
   #error "LEVEL_CORNERS_* settings have been renamed BED_TRAMMING_*."
643 643
 #elif defined(LEVEL_CENTER_TOO)
644 644
   #error "LEVEL_CENTER_TOO is now BED_TRAMMING_INCLUDE_CENTER."
645
+#elif defined(TOUCH_IDLE_SLEEP)
646
+  #error "TOUCH_IDLE_SLEEP (seconds) is now TOUCH_IDLE_SLEEP_MINS (minutes)."
647
+#elif defined(LCD_BACKLIGHT_TIMEOUT)
648
+  #error "LCD_BACKLIGHT_TIMEOUT (seconds) is now LCD_BACKLIGHT_TIMEOUT_MINS (minutes)."
645 649
 #endif
646 650
 
647 651
 // 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
3030 3034
   #endif
3031 3035
 #endif
3032 3036
 
3033
-#if LCD_BACKLIGHT_TIMEOUT
3037
+#if LCD_BACKLIGHT_TIMEOUT_MINS
3034 3038
   #if !HAS_ENCODER_ACTION
3035
-    #error "LCD_BACKLIGHT_TIMEOUT requires an LCD with encoder or keypad."
3039
+    #error "LCD_BACKLIGHT_TIMEOUT_MINS requires an LCD with encoder or keypad."
3036 3040
   #elif !PIN_EXISTS(LCD_BACKLIGHT)
3037
-    #error "LCD_BACKLIGHT_TIMEOUT requires LCD_BACKLIGHT_PIN."
3041
+    #error "LCD_BACKLIGHT_TIMEOUT_MINS requires LCD_BACKLIGHT_PIN."
3038 3042
   #endif
3039 3043
 #endif
3040 3044
 

+ 1
- 2
Marlin/src/lcd/dogm/marlinui_DOGM.cpp View File

@@ -343,8 +343,7 @@ void MarlinUI::draw_kill_screen() {
343 343
 void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
344 344
 
345 345
 #if HAS_DISPLAY_SLEEP
346
-  void MarlinUI::sleep_on()  { u8g.sleepOn(); }
347
-  void MarlinUI::sleep_off() { u8g.sleepOff(); }
346
+  void MarlinUI::sleep_display(const bool sleep)  { sleep ? u8g.sleepOn() : u8g.sleepOff(); }
348 347
 #endif
349 348
 
350 349
 #if HAS_LCD_BRIGHTNESS

+ 0
- 1
Marlin/src/lcd/language/language_de.h View File

@@ -407,7 +407,6 @@ namespace Language_de {
407 407
   LSTR MSG_ADVANCE_K_E                    = _UxGT("Vorschubfaktor *");
408 408
   LSTR MSG_CONTRAST                       = _UxGT("LCD-Kontrast");
409 409
   LSTR MSG_BRIGHTNESS                     = _UxGT("LCD-Helligkeit");
410
-  LSTR MSG_LCD_TIMEOUT_SEC                = _UxGT("LCD-Ruhezustand (s)");
411 410
   LSTR MSG_SCREEN_TIMEOUT                 = _UxGT("LCD Timeout (m)");
412 411
   LSTR MSG_BRIGHTNESS_OFF                 = _UxGT("LCD ausschalten");
413 412
   LSTR MSG_STORE_EEPROM                   = _UxGT("Konfig. speichern");

+ 0
- 1
Marlin/src/lcd/language/language_en.h View File

@@ -422,7 +422,6 @@ namespace Language_en {
422 422
   LSTR MSG_ADVANCE_K_E                    = _UxGT("Advance K *");
423 423
   LSTR MSG_CONTRAST                       = _UxGT("LCD Contrast");
424 424
   LSTR MSG_BRIGHTNESS                     = _UxGT("LCD Brightness");
425
-  LSTR MSG_LCD_TIMEOUT_SEC                = _UxGT("LCD Timeout (s)");
426 425
   LSTR MSG_SCREEN_TIMEOUT                 = _UxGT("LCD Timeout (m)");
427 426
   LSTR MSG_BRIGHTNESS_OFF                 = _UxGT("Backlight Off");
428 427
   LSTR MSG_STORE_EEPROM                   = _UxGT("Store Settings");

+ 1
- 1
Marlin/src/lcd/language/language_fr.h View File

@@ -321,7 +321,7 @@ namespace Language_fr {
321 321
   LSTR MSG_ADVANCE_K_E                    = _UxGT("Avance K *");
322 322
   LSTR MSG_BRIGHTNESS                     = _UxGT("Luminosité LCD");
323 323
   LSTR MSG_CONTRAST                       = _UxGT("Contraste LCD");
324
-  LSTR MSG_LCD_TIMEOUT_SEC                = _UxGT("Veille LCD (s)");
324
+  LSTR MSG_SCREEN_TIMEOUT                 = _UxGT("Veille LCD (m)");
325 325
   LSTR MSG_BRIGHTNESS_OFF                 = _UxGT("Éteindre l'écran LCD");
326 326
   LSTR MSG_STORE_EEPROM                   = _UxGT("Enregistrer config.");
327 327
   LSTR MSG_LOAD_EEPROM                    = _UxGT("Charger config.");

+ 0
- 1
Marlin/src/lcd/language/language_it.h View File

@@ -418,7 +418,6 @@ namespace Language_it {
418 418
   LSTR MSG_ADVANCE_K_E                    = _UxGT("K Avanzamento *");
419 419
   LSTR MSG_CONTRAST                       = _UxGT("Contrasto LCD");
420 420
   LSTR MSG_BRIGHTNESS                     = _UxGT("Luminosità LCD");
421
-  LSTR MSG_LCD_TIMEOUT_SEC                = _UxGT("Timeout LCD (s)");
422 421
   LSTR MSG_SCREEN_TIMEOUT                 = _UxGT("Timeout LCD (m)");
423 422
   LSTR MSG_BRIGHTNESS_OFF                 = _UxGT("Spegni Retroillum.");
424 423
   LSTR MSG_STORE_EEPROM                   = _UxGT("Salva impostazioni");

+ 0
- 1
Marlin/src/lcd/language/language_sk.h View File

@@ -419,7 +419,6 @@ namespace Language_sk {
419 419
   LSTR MSG_ADVANCE_K_E                    = _UxGT("K pre posun *");
420 420
   LSTR MSG_CONTRAST                       = _UxGT("Kontrast LCD");
421 421
   LSTR MSG_BRIGHTNESS                     = _UxGT("Jas LCD");
422
-  LSTR MSG_LCD_TIMEOUT_SEC                = _UxGT("Čas. limit LCD (s)");
423 422
   LSTR MSG_SCREEN_TIMEOUT                 = _UxGT("Čas. limit LCD (m)");
424 423
   LSTR MSG_BRIGHTNESS_OFF                 = _UxGT("Podsviet. vyp.");
425 424
   LSTR MSG_STORE_EEPROM                   = _UxGT("Uložiť nastavenie");

+ 1
- 1
Marlin/src/lcd/language/language_uk.h View File

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

+ 11
- 7
Marlin/src/lcd/marlinui.cpp View File

@@ -174,22 +174,26 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
174 174
   volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
175 175
 #endif
176 176
 
177
-#if LCD_BACKLIGHT_TIMEOUT
177
+#if LCD_BACKLIGHT_TIMEOUT_MINS
178 178
 
179
-  uint16_t MarlinUI::lcd_backlight_timeout; // Initialized by settings.load()
179
+  constexpr uint8_t MarlinUI::backlight_timeout_min, MarlinUI::backlight_timeout_max;
180
+
181
+  uint8_t MarlinUI::backlight_timeout_minutes; // Initialized by settings.load()
180 182
   millis_t MarlinUI::backlight_off_ms = 0;
181 183
   void MarlinUI::refresh_backlight_timeout() {
182
-    backlight_off_ms = lcd_backlight_timeout ? millis() + lcd_backlight_timeout * 1000UL : 0;
184
+    backlight_off_ms = backlight_timeout_minutes ? millis() + backlight_timeout_minutes * 60UL * 1000UL : 0;
183 185
     WRITE(LCD_BACKLIGHT_PIN, HIGH);
184 186
   }
185 187
 
186 188
 #elif HAS_DISPLAY_SLEEP
187 189
 
190
+  constexpr uint8_t MarlinUI::sleep_timeout_min, MarlinUI::sleep_timeout_max;
191
+
188 192
   uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load()
189 193
   millis_t MarlinUI::screen_timeout_millis = 0;
190 194
   void MarlinUI::refresh_screen_timeout() {
191 195
     screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0;
192
-    sleep_off();
196
+    sleep_display(false);
193 197
   }
194 198
 
195 199
 #endif
@@ -1059,7 +1063,7 @@ void MarlinUI::init() {
1059 1063
 
1060 1064
           reset_status_timeout(ms);
1061 1065
 
1062
-          #if LCD_BACKLIGHT_TIMEOUT
1066
+          #if LCD_BACKLIGHT_TIMEOUT_MINS
1063 1067
             refresh_backlight_timeout();
1064 1068
           #elif HAS_DISPLAY_SLEEP
1065 1069
             refresh_screen_timeout();
@@ -1169,14 +1173,14 @@ void MarlinUI::init() {
1169 1173
           return_to_status();
1170 1174
       #endif
1171 1175
 
1172
-      #if LCD_BACKLIGHT_TIMEOUT
1176
+      #if LCD_BACKLIGHT_TIMEOUT_MINS
1173 1177
         if (backlight_off_ms && ELAPSED(ms, backlight_off_ms)) {
1174 1178
           WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off
1175 1179
           backlight_off_ms = 0;
1176 1180
         }
1177 1181
       #elif HAS_DISPLAY_SLEEP
1178 1182
         if (screen_timeout_millis && ELAPSED(ms, screen_timeout_millis))
1179
-          sleep_on();
1183
+          sleep_display();
1180 1184
       #endif
1181 1185
 
1182 1186
       // Change state of drawing flag between screen updates

+ 7
- 8
Marlin/src/lcd/marlinui.h View File

@@ -270,20 +270,19 @@ public:
270 270
     FORCE_INLINE static void refresh_brightness() { set_brightness(brightness); }
271 271
   #endif
272 272
 
273
-  #if LCD_BACKLIGHT_TIMEOUT
274
-    #define LCD_BKL_TIMEOUT_MIN 1u
275
-    #define LCD_BKL_TIMEOUT_MAX UINT16_MAX // Slightly more than 18 hours
276
-    static uint16_t lcd_backlight_timeout;
273
+  #if LCD_BACKLIGHT_TIMEOUT_MINS
274
+    static constexpr uint8_t backlight_timeout_min = 0;
275
+    static constexpr uint8_t backlight_timeout_max = 99;
276
+    static uint8_t backlight_timeout_minutes;
277 277
     static millis_t backlight_off_ms;
278 278
     static void refresh_backlight_timeout();
279 279
   #elif HAS_DISPLAY_SLEEP
280
-    #define SLEEP_TIMEOUT_MIN 0
281
-    #define SLEEP_TIMEOUT_MAX 99
280
+    static constexpr uint8_t sleep_timeout_min = 0;
281
+    static constexpr uint8_t sleep_timeout_max = 99;
282 282
     static uint8_t sleep_timeout_minutes;
283 283
     static millis_t screen_timeout_millis;
284 284
     static void refresh_screen_timeout();
285
-    static void sleep_on();
286
-    static void sleep_off();
285
+    static void sleep_display(const bool sleep=true);
287 286
   #endif
288 287
 
289 288
   #if HAS_DWIN_E3V2_BASIC

+ 3
- 3
Marlin/src/lcd/menu/menu_configuration.cpp View File

@@ -547,10 +547,10 @@ void menu_configuration() {
547 547
   //
548 548
   // Set display backlight / sleep timeout
549 549
   //
550
-  #if LCD_BACKLIGHT_TIMEOUT && LCD_BKL_TIMEOUT_MIN < LCD_BKL_TIMEOUT_MAX
551
-    EDIT_ITEM(uint16_4, MSG_LCD_TIMEOUT_SEC, &ui.lcd_backlight_timeout, LCD_BKL_TIMEOUT_MIN, LCD_BKL_TIMEOUT_MAX, ui.refresh_backlight_timeout);
550
+  #if LCD_BACKLIGHT_TIMEOUT_MINS
551
+    EDIT_ITEM(uint8, MSG_SCREEN_TIMEOUT, &ui.backlight_timeout_minutes, ui.backlight_timeout_min, ui.backlight_timeout_max, ui.refresh_backlight_timeout);
552 552
   #elif HAS_DISPLAY_SLEEP
553
-    EDIT_ITEM(uint8, MSG_SCREEN_TIMEOUT, &ui.sleep_timeout_minutes, SLEEP_TIMEOUT_MIN, SLEEP_TIMEOUT_MAX, ui.refresh_screen_timeout);
553
+    EDIT_ITEM(uint8, MSG_SCREEN_TIMEOUT, &ui.sleep_timeout_minutes, ui.sleep_timeout_min, ui.sleep_timeout_max, ui.refresh_screen_timeout);
554 554
   #endif
555 555
 
556 556
   #if ENABLED(FWRETRACT)

+ 7
- 2
Marlin/src/lcd/menu/menu_item.h View File

@@ -402,8 +402,13 @@ class MenuItem_bool : public MenuEditItemBase {
402 402
 
403 403
 // Predefined menu item types //
404 404
 
405
-#define BACK_ITEM_F(FLABEL)                              MENU_ITEM_F(back, FLABEL)
406
-#define BACK_ITEM(LABEL)                                   MENU_ITEM(back, LABEL)
405
+#if HAS_BACK_ITEM
406
+  #define BACK_ITEM_F(FLABEL)                            MENU_ITEM_F(back, FLABEL)
407
+  #define BACK_ITEM(LABEL)                                 MENU_ITEM(back, LABEL)
408
+#else
409
+  #define BACK_ITEM_F(FLABEL) NOOP
410
+  #define BACK_ITEM(LABEL)    NOOP
411
+#endif
407 412
 
408 413
 #define ACTION_ITEM_N_S_F(N, S, FLABEL, ACTION)      MENU_ITEM_N_S_F(function, N, S, FLABEL, ACTION)
409 414
 #define ACTION_ITEM_N_S(N, S, LABEL, ACTION)       ACTION_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), ACTION)

+ 11
- 11
Marlin/src/lcd/menu/menu_main.cpp View File

@@ -325,6 +325,17 @@ void menu_main() {
325 325
     SUBMENU(MSG_TEMPERATURE, menu_temperature);
326 326
   #endif
327 327
 
328
+  #if ENABLED(ADVANCED_PAUSE_FEATURE)
329
+    #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES)
330
+      YESNO_ITEM(MSG_FILAMENTCHANGE,
331
+        menu_change_filament, nullptr,
332
+        GET_TEXT_F(MSG_FILAMENTCHANGE), (const char *)nullptr, F("?")
333
+      );
334
+    #else
335
+      SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament);
336
+    #endif
337
+  #endif
338
+
328 339
   #if HAS_POWER_MONITOR
329 340
     SUBMENU(MSG_POWER_MONITOR, menu_power_monitor);
330 341
   #endif
@@ -349,17 +360,6 @@ void menu_main() {
349 360
     }
350 361
   #endif
351 362
 
352
-  #if ENABLED(ADVANCED_PAUSE_FEATURE)
353
-    #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES)
354
-      YESNO_ITEM(MSG_FILAMENTCHANGE,
355
-        menu_change_filament, nullptr,
356
-        GET_TEXT_F(MSG_FILAMENTCHANGE), (const char *)nullptr, F("?")
357
-      );
358
-    #else
359
-      SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament);
360
-    #endif
361
-  #endif
362
-
363 363
   #if ENABLED(LCD_INFO_MENU)
364 364
     SUBMENU(MSG_INFO_MENU, menu_info);
365 365
   #endif

+ 1
- 1
Marlin/src/lcd/tft/touch.cpp View File

@@ -302,7 +302,7 @@ bool Touch::get_point(int16_t *x, int16_t *y) {
302 302
         WRITE(TFT_BACKLIGHT_PIN, HIGH);
303 303
       #endif
304 304
     }
305
-    next_sleep_ms = millis() + SEC_TO_MS(TOUCH_IDLE_SLEEP);
305
+    next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60);
306 306
   }
307 307
 
308 308
 #endif // HAS_TOUCH_SLEEP

+ 2
- 2
Marlin/src/lcd/touch/touch_buttons.cpp View File

@@ -61,7 +61,7 @@ TouchButtons touchBt;
61 61
 
62 62
 void TouchButtons::init() {
63 63
   touchIO.Init();
64
-  TERN_(HAS_TOUCH_SLEEP, next_sleep_ms = millis() + SEC_TO_MS(TOUCH_IDLE_SLEEP));
64
+  TERN_(HAS_TOUCH_SLEEP, next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60));
65 65
 }
66 66
 
67 67
 uint8_t TouchButtons::read_buttons() {
@@ -135,7 +135,7 @@ uint8_t TouchButtons::read_buttons() {
135 135
         WRITE(TFT_BACKLIGHT_PIN, HIGH);
136 136
       #endif
137 137
     }
138
-    next_sleep_ms = millis() + SEC_TO_MS(TOUCH_IDLE_SLEEP);
138
+    next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60);
139 139
   }
140 140
 
141 141
 #endif // HAS_TOUCH_SLEEP

+ 9
- 9
Marlin/src/module/settings.cpp View File

@@ -402,8 +402,8 @@ typedef struct SettingsDataStruct {
402 402
   //
403 403
   // Display Sleep
404 404
   //
405
-  #if LCD_BACKLIGHT_TIMEOUT
406
-    uint16_t lcd_backlight_timeout;                     // M255 S
405
+  #if LCD_BACKLIGHT_TIMEOUT_MINS
406
+    uint8_t backlight_timeout_minutes;                  // M255 S
407 407
   #elif HAS_DISPLAY_SLEEP
408 408
     uint8_t sleep_timeout_minutes;                      // M255 S
409 409
   #endif
@@ -640,7 +640,7 @@ void MarlinSettings::postprocess() {
640 640
   TERN_(HAS_LCD_CONTRAST, ui.refresh_contrast());
641 641
   TERN_(HAS_LCD_BRIGHTNESS, ui.refresh_brightness());
642 642
 
643
-  #if LCD_BACKLIGHT_TIMEOUT
643
+  #if LCD_BACKLIGHT_TIMEOUT_MINS
644 644
     ui.refresh_backlight_timeout();
645 645
   #elif HAS_DISPLAY_SLEEP
646 646
     ui.refresh_screen_timeout();
@@ -1157,8 +1157,8 @@ void MarlinSettings::postprocess() {
1157 1157
     //
1158 1158
     // LCD Backlight / Sleep Timeout
1159 1159
     //
1160
-    #if LCD_BACKLIGHT_TIMEOUT
1161
-      EEPROM_WRITE(ui.lcd_backlight_timeout);
1160
+    #if LCD_BACKLIGHT_TIMEOUT_MINS
1161
+      EEPROM_WRITE(ui.backlight_timeout_minutes);
1162 1162
     #elif HAS_DISPLAY_SLEEP
1163 1163
       EEPROM_WRITE(ui.sleep_timeout_minutes);
1164 1164
     #endif
@@ -2108,8 +2108,8 @@ void MarlinSettings::postprocess() {
2108 2108
       //
2109 2109
       // LCD Backlight / Sleep Timeout
2110 2110
       //
2111
-      #if LCD_BACKLIGHT_TIMEOUT
2112
-        EEPROM_READ(ui.lcd_backlight_timeout);
2111
+      #if LCD_BACKLIGHT_TIMEOUT_MINS
2112
+        EEPROM_READ(ui.backlight_timeout_minutes);
2113 2113
       #elif HAS_DISPLAY_SLEEP
2114 2114
         EEPROM_READ(ui.sleep_timeout_minutes);
2115 2115
       #endif
@@ -3198,8 +3198,8 @@ void MarlinSettings::reset() {
3198 3198
   //
3199 3199
   // LCD Backlight / Sleep Timeout
3200 3200
   //
3201
-  #if LCD_BACKLIGHT_TIMEOUT
3202
-    ui.lcd_backlight_timeout = LCD_BACKLIGHT_TIMEOUT;
3201
+  #if LCD_BACKLIGHT_TIMEOUT_MINS
3202
+    ui.backlight_timeout_minutes = LCD_BACKLIGHT_TIMEOUT_MINS;
3203 3203
   #elif HAS_DISPLAY_SLEEP
3204 3204
     ui.sleep_timeout_minutes = DISPLAY_SLEEP_MINUTES;
3205 3205
   #endif

+ 1
- 1
buildroot/tests/mega2560 View File

@@ -213,7 +213,7 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 1 \
213 213
         TEMP_SENSOR_0 -2 TEMP_SENSOR_REDUNDANT -2 \
214 214
         TEMP_SENSOR_REDUNDANT_SOURCE E1 TEMP_SENSOR_REDUNDANT_TARGET E0 \
215 215
         TEMP_0_CS_PIN 11 TEMP_1_CS_PIN 12 \
216
-        LCD_BACKLIGHT_TIMEOUT 30
216
+        LCD_BACKLIGHT_TIMEOUT_MINS 2
217 217
 opt_enable MPCTEMP MINIPANEL
218 218
 opt_disable PIDTEMP
219 219
 exec_test $1 $2 "MEGA2560 RAMPS | Redundant temperature sensor | 2x MAX6675 | BL Timeout" "$3"

Loading…
Cancel
Save