Browse Source

🩹 Fix Color UI touchscreen sleep (#24826)

EvilGremlin 1 year ago
parent
commit
fcf9f22390
No account linked to committer's email address

+ 9
- 8
Marlin/src/lcd/marlinui.cpp View File

@@ -191,11 +191,12 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
191 191
 
192 192
   uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load()
193 193
   millis_t MarlinUI::screen_timeout_millis = 0;
194
-  void MarlinUI::refresh_screen_timeout() {
195
-    screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0;
196
-    sleep_display(false);
197
-  }
198
-
194
+  #if DISABLED(TFT_COLOR_UI)
195
+    void MarlinUI::refresh_screen_timeout() {
196
+      screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0;
197
+      sleep_display(false);
198
+    }
199
+  #endif
199 200
 #endif
200 201
 
201 202
 void MarlinUI::init() {
@@ -1065,7 +1066,7 @@ void MarlinUI::init() {
1065 1066
 
1066 1067
           #if LCD_BACKLIGHT_TIMEOUT_MINS
1067 1068
             refresh_backlight_timeout();
1068
-          #elif HAS_DISPLAY_SLEEP
1069
+          #elif HAS_DISPLAY_SLEEP && DISABLED(TFT_COLOR_UI)
1069 1070
             refresh_screen_timeout();
1070 1071
           #endif
1071 1072
 
@@ -1178,9 +1179,9 @@ void MarlinUI::init() {
1178 1179
           WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off
1179 1180
           backlight_off_ms = 0;
1180 1181
         }
1181
-      #elif HAS_DISPLAY_SLEEP
1182
+      #elif HAS_DISPLAY_SLEEP && DISABLED(TFT_COLOR_UI)
1182 1183
         if (screen_timeout_millis && ELAPSED(ms, screen_timeout_millis))
1183
-          sleep_display();
1184
+          sleep_display(true);
1184 1185
       #endif
1185 1186
 
1186 1187
       // Change state of drawing flag between screen updates

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

@@ -550,7 +550,7 @@ void menu_configuration() {
550 550
   //
551 551
   #if LCD_BACKLIGHT_TIMEOUT_MINS
552 552
     EDIT_ITEM(uint8, MSG_SCREEN_TIMEOUT, &ui.backlight_timeout_minutes, ui.backlight_timeout_min, ui.backlight_timeout_max, ui.refresh_backlight_timeout);
553
-  #elif HAS_DISPLAY_SLEEP
553
+  #elif HAS_DISPLAY_SLEEP && DISABLED(TFT_COLOR_UI)
554 554
     EDIT_ITEM(uint8, MSG_SCREEN_TIMEOUT, &ui.sleep_timeout_minutes, ui.sleep_timeout_min, ui.sleep_timeout_max, ui.refresh_screen_timeout);
555 555
   #endif
556 556
 

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

@@ -642,7 +642,7 @@ void MarlinSettings::postprocess() {
642 642
 
643 643
   #if LCD_BACKLIGHT_TIMEOUT_MINS
644 644
     ui.refresh_backlight_timeout();
645
-  #elif HAS_DISPLAY_SLEEP
645
+  #elif HAS_DISPLAY_SLEEP && DISABLED(TFT_COLOR_UI)
646 646
     ui.refresh_screen_timeout();
647 647
   #endif
648 648
 }
@@ -3167,7 +3167,7 @@ void MarlinSettings::reset() {
3167 3167
   #if LCD_BACKLIGHT_TIMEOUT_MINS
3168 3168
     ui.backlight_timeout_minutes = LCD_BACKLIGHT_TIMEOUT_MINS;
3169 3169
   #elif HAS_DISPLAY_SLEEP
3170
-    ui.sleep_timeout_minutes = DISPLAY_SLEEP_MINUTES;
3170
+    ui.sleep_timeout_minutes = TERN(TOUCH_SCREEN, TOUCH_IDLE_SLEEP_MINS, DISPLAY_SLEEP_MINUTES);
3171 3171
   #endif
3172 3172
 
3173 3173
   //

Loading…
Cancel
Save