Browse Source

🐛 Fix TFT backlight sleep/wake (#23153)

Tanguy Pruvot 3 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,15 +287,17 @@ bool Touch::get_point(int16_t *x, int16_t *y) {
287 287
 #if HAS_TOUCH_SLEEP
288 288
 
289 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 294
     #endif
293 295
     next_sleep_ms = TSLP_SLEEPING;
294 296
   }
295 297
   void Touch::wakeUp() {
296 298
     if (isSleeping()) {
297 299
       #if HAS_LCD_BRIGHTNESS
298
-        ui._set_brightness();
300
+        ui.set_brightness(ui.brightness);
299 301
       #elif PIN_EXISTS(TFT_BACKLIGHT)
300 302
         WRITE(TFT_BACKLIGHT_PIN, HIGH);
301 303
       #endif

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

@@ -115,15 +115,17 @@ uint8_t TouchButtons::read_buttons() {
115 115
 #if HAS_TOUCH_SLEEP
116 116
 
117 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 122
     #endif
121 123
     next_sleep_ms = TSLP_SLEEPING;
122 124
   }
123 125
   void TouchButtons::wakeUp() {
124 126
     if (isSleeping()) {
125 127
       #if HAS_LCD_BRIGHTNESS
126
-        ui._set_brightness();
128
+        ui.set_brightness(ui.brightness);
127 129
       #elif PIN_EXISTS(TFT_BACKLIGHT)
128 130
         WRITE(TFT_BACKLIGHT_PIN, HIGH);
129 131
       #endif

Loading…
Cancel
Save