⚗️ Use pwm_set_duty over analogWrite to set PWM (#23048)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
		@@ -342,7 +342,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
 | 
			
		||||
  void MarlinUI::_set_brightness() {
 | 
			
		||||
    #if PIN_EXISTS(TFT_BACKLIGHT)
 | 
			
		||||
      if (PWM_PIN(TFT_BACKLIGHT_PIN))
 | 
			
		||||
        analogWrite(pin_t(TFT_BACKLIGHT_PIN), brightness);
 | 
			
		||||
        set_pwm_duty(pin_t(TFT_BACKLIGHT_PIN), brightness);
 | 
			
		||||
    #endif
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -213,7 +213,7 @@ void MarlinUI::clear_lcd() {
 | 
			
		||||
  void MarlinUI::_set_brightness() {
 | 
			
		||||
    #if PIN_EXISTS(TFT_BACKLIGHT)
 | 
			
		||||
      if (PWM_PIN(TFT_BACKLIGHT_PIN))
 | 
			
		||||
        analogWrite(pin_t(TFT_BACKLIGHT_PIN), brightness);
 | 
			
		||||
        set_pwm_duty(pin_t(TFT_BACKLIGHT_PIN), brightness);
 | 
			
		||||
    #endif
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user