From 184fc36a088204a1a6d98afbf3e05f24670e2e77 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 21 Nov 2021 20:13:01 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20TFT=20backlight=20sleep/wa?= =?UTF-8?q?ke=20(#23153)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/tft/touch.cpp | 8 +++++--- Marlin/src/lcd/touch/touch_buttons.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index dc1f2ecb6c..a04715a295 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -287,15 +287,17 @@ bool Touch::get_point(int16_t *x, int16_t *y) { #if HAS_TOUCH_SLEEP void Touch::sleepTimeout() { - #if PIN_EXISTS(TFT_BACKLIGHT) - OUT_WRITE(TFT_BACKLIGHT_PIN, LOW); + #if HAS_LCD_BRIGHTNESS + ui.set_brightness(0); + #elif PIN_EXISTS(TFT_BACKLIGHT) + WRITE(TFT_BACKLIGHT_PIN, LOW); #endif next_sleep_ms = TSLP_SLEEPING; } void Touch::wakeUp() { if (isSleeping()) { #if HAS_LCD_BRIGHTNESS - ui._set_brightness(); + ui.set_brightness(ui.brightness); #elif PIN_EXISTS(TFT_BACKLIGHT) WRITE(TFT_BACKLIGHT_PIN, HIGH); #endif diff --git a/Marlin/src/lcd/touch/touch_buttons.cpp b/Marlin/src/lcd/touch/touch_buttons.cpp index feaba8483b..c15bb08281 100644 --- a/Marlin/src/lcd/touch/touch_buttons.cpp +++ b/Marlin/src/lcd/touch/touch_buttons.cpp @@ -115,15 +115,17 @@ uint8_t TouchButtons::read_buttons() { #if HAS_TOUCH_SLEEP void TouchButtons::sleepTimeout() { - #if PIN_EXISTS(TFT_BACKLIGHT) - OUT_WRITE(TFT_BACKLIGHT_PIN, LOW); + #if HAS_LCD_BRIGHTNESS + ui.set_brightness(0); + #elif PIN_EXISTS(TFT_BACKLIGHT) + WRITE(TFT_BACKLIGHT_PIN, LOW); #endif next_sleep_ms = TSLP_SLEEPING; } void TouchButtons::wakeUp() { if (isSleeping()) { #if HAS_LCD_BRIGHTNESS - ui._set_brightness(); + ui.set_brightness(ui.brightness); #elif PIN_EXISTS(TFT_BACKLIGHT) WRITE(TFT_BACKLIGHT_PIN, HIGH); #endif