Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
🐛 Fix TFT backlight sleep/wake (MarlinFirmware#23153)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot authored and 0xk1f0 committed Dec 26, 2021
1 parent 7872c55 commit a0df775
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Marlin/src/lcd/tft/touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/lcd/touch/touch_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a0df775

Please sign in to comment.