Browse Source

🐛 Fix TFT backlight sleep/wake (#23153)

Tanguy Pruvot 2 years ago
parent
commit
f33396c2c3
No account linked to committer's email address
2 changed files with 10 additions and 6 deletions
  1. 5
    3
      Marlin/src/lcd/tft/touch.cpp
  2. 5
    3
      Marlin/src/lcd/touch/touch_buttons.cpp

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

287
 #if HAS_TOUCH_SLEEP
287
 #if HAS_TOUCH_SLEEP
288
 
288
 
289
   void Touch::sleepTimeout() {
289
   void Touch::sleepTimeout() {
290
-    #if PIN_EXISTS(TFT_BACKLIGHT)
291
-      OUT_WRITE(TFT_BACKLIGHT_PIN, LOW);
290
+    #if HAS_LCD_BRIGHTNESS
291
+      ui.set_brightness(0);
292
+    #elif PIN_EXISTS(TFT_BACKLIGHT)
293
+      WRITE(TFT_BACKLIGHT_PIN, LOW);
292
     #endif
294
     #endif
293
     next_sleep_ms = TSLP_SLEEPING;
295
     next_sleep_ms = TSLP_SLEEPING;
294
   }
296
   }
295
   void Touch::wakeUp() {
297
   void Touch::wakeUp() {
296
     if (isSleeping()) {
298
     if (isSleeping()) {
297
       #if HAS_LCD_BRIGHTNESS
299
       #if HAS_LCD_BRIGHTNESS
298
-        ui._set_brightness();
300
+        ui.set_brightness(ui.brightness);
299
       #elif PIN_EXISTS(TFT_BACKLIGHT)
301
       #elif PIN_EXISTS(TFT_BACKLIGHT)
300
         WRITE(TFT_BACKLIGHT_PIN, HIGH);
302
         WRITE(TFT_BACKLIGHT_PIN, HIGH);
301
       #endif
303
       #endif

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

115
 #if HAS_TOUCH_SLEEP
115
 #if HAS_TOUCH_SLEEP
116
 
116
 
117
   void TouchButtons::sleepTimeout() {
117
   void TouchButtons::sleepTimeout() {
118
-    #if PIN_EXISTS(TFT_BACKLIGHT)
119
-      OUT_WRITE(TFT_BACKLIGHT_PIN, LOW);
118
+    #if HAS_LCD_BRIGHTNESS
119
+      ui.set_brightness(0);
120
+    #elif PIN_EXISTS(TFT_BACKLIGHT)
121
+      WRITE(TFT_BACKLIGHT_PIN, LOW);
120
     #endif
122
     #endif
121
     next_sleep_ms = TSLP_SLEEPING;
123
     next_sleep_ms = TSLP_SLEEPING;
122
   }
124
   }
123
   void TouchButtons::wakeUp() {
125
   void TouchButtons::wakeUp() {
124
     if (isSleeping()) {
126
     if (isSleeping()) {
125
       #if HAS_LCD_BRIGHTNESS
127
       #if HAS_LCD_BRIGHTNESS
126
-        ui._set_brightness();
128
+        ui.set_brightness(ui.brightness);
127
       #elif PIN_EXISTS(TFT_BACKLIGHT)
129
       #elif PIN_EXISTS(TFT_BACKLIGHT)
128
         WRITE(TFT_BACKLIGHT_PIN, HIGH);
130
         WRITE(TFT_BACKLIGHT_PIN, HIGH);
129
       #endif
131
       #endif

Loading…
Cancel
Save