🚸 TFT backlight PWM / brightness (#22841)

This commit is contained in:
Tanguy Pruvot
2021-09-27 21:01:47 +02:00
committed by Scott Lahteine
parent 34c9f64925
commit 064f91e9b0
7 changed files with 40 additions and 3 deletions

View File

@ -294,7 +294,9 @@ bool Touch::get_point(int16_t *x, int16_t *y) {
}
void Touch::wakeUp() {
if (isSleeping()) {
#if PIN_EXISTS(TFT_BACKLIGHT)
#if HAS_LCD_BRIGHTNESS
ui._set_brightness();
#elif PIN_EXISTS(TFT_BACKLIGHT)
WRITE(TFT_BACKLIGHT_PIN, HIGH);
#endif
}

View File

@ -210,6 +210,15 @@ void MarlinUI::clear_lcd() {
cursor.set(0, 0);
}
#if HAS_LCD_BRIGHTNESS
void MarlinUI::_set_brightness() {
#if PIN_EXISTS(TFT_BACKLIGHT)
if (PWM_PIN(TFT_BACKLIGHT_PIN))
analogWrite(pin_t(TFT_BACKLIGHT_PIN), brightness);
#endif
}
#endif
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
void MarlinUI::touch_calibration_screen() {