🐛 Fix TFT backlight [STM32] (#23062)
This commit is contained in:
committed by
Scott Lahteine
parent
89ec1c71f0
commit
fd136d5501
@ -339,12 +339,14 @@ void MarlinUI::draw_kill_screen() {
|
||||
void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
|
||||
#if HAS_LCD_BRIGHTNESS
|
||||
|
||||
void MarlinUI::_set_brightness() {
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||
if (PWM_PIN(TFT_BACKLIGHT_PIN))
|
||||
set_pwm_duty(pin_t(TFT_BACKLIGHT_PIN), brightness);
|
||||
analogWrite(pin_t(TFT_BACKLIGHT_PIN), backlight ? brightness : 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
|
@ -210,12 +210,14 @@ void MarlinUI::clear_lcd() {
|
||||
}
|
||||
|
||||
#if HAS_LCD_BRIGHTNESS
|
||||
|
||||
void MarlinUI::_set_brightness() {
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||
if (PWM_PIN(TFT_BACKLIGHT_PIN))
|
||||
set_pwm_duty(pin_t(TFT_BACKLIGHT_PIN), brightness);
|
||||
analogWrite(pin_t(TFT_BACKLIGHT_PIN), backlight ? brightness : 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
||||
|
@ -152,8 +152,7 @@ if (lcd_id != 0xFFFFFFFF) return;
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INIT)
|
||||
WRITE(TFT_BACKLIGHT_PIN, HIGH);
|
||||
TERN_(HAS_LCD_BRIGHTNESS, ui._set_brightness());
|
||||
TERN(HAS_LCD_BRIGHTNESS, ui._set_brightness(), WRITE(TFT_BACKLIGHT_PIN, HIGH));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user