Skip to content

Commit

Permalink
brightness before backlight
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Nov 19, 2021
1 parent 83b34bc commit 3f937a6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions Marlin/src/lcd/tft/touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,19 @@ bool Touch::get_point(int16_t *x, int16_t *y) {
#if HAS_TOUCH_SLEEP

void Touch::sleepTimeout() {
#if PIN_EXISTS(TFT_BACKLIGHT)
TERN(HAS_LCD_BRIGHTNESS, ui.set_brightness(0), 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 PIN_EXISTS(TFT_BACKLIGHT)
TERN(HAS_LCD_BRIGHTNESS, ui.set_brightness(ui.brightness), WRITE(TFT_BACKLIGHT_PIN, HIGH));
#if HAS_LCD_BRIGHTNESS
ui.set_brightness(0);
#elif PIN_EXISTS(TFT_BACKLIGHT)
WRITE(TFT_BACKLIGHT_PIN, HIGH);
#endif
}
next_sleep_ms = millis() + SEC_TO_MS(TOUCH_IDLE_SLEEP);
Expand Down
12 changes: 8 additions & 4 deletions Marlin/src/lcd/touch/touch_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,19 @@ uint8_t TouchButtons::read_buttons() {
#if HAS_TOUCH_SLEEP

void TouchButtons::sleepTimeout() {
#if PIN_EXISTS(TFT_BACKLIGHT)
TERN(HAS_LCD_BRIGHTNESS, ui.set_brightness(0), 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 PIN_EXISTS(TFT_BACKLIGHT)
TERN(HAS_LCD_BRIGHTNESS, ui.set_brightness(ui.brightness), WRITE(TFT_BACKLIGHT_PIN, HIGH));
#if HAS_LCD_BRIGHTNESS
ui.set_brightness(0);
#elif PIN_EXISTS(TFT_BACKLIGHT)
WRITE(TFT_BACKLIGHT_PIN, HIGH);
#endif
}
next_sleep_ms = millis() + SEC_TO_MS(TOUCH_IDLE_SLEEP);
Expand Down

0 comments on commit 3f937a6

Please sign in to comment.