lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.02k stars 187 forks source link

fix Light_PWM backlight not works under arduino-esp32 v3.0 (IDF 5) #510

Closed WuSiYu closed 3 months ago

WuSiYu commented 3 months ago

With arduino-esp32 v3.0, in the new ledcWrite() API we should use the GPIO pin number instead of pwm channel number (ref).

tobozo commented 3 months ago

hi and thanks for your contribution :+1:

Please use the develop branch both as source and target in your PR. The master branch is only for releases.

:warning: although this PR will fix PWM with Arduino 3.x.x, it will break all previous versions.

Please use the LEDC_USE_IDF_V5 macro to prevent this (see line 52):

  #if defined LEDC_USE_IDF_V5 // Arduino 3.x.x
      ledcWrite(_cfg.pin_bl, duty);
  #else 
      ledcWrite(_cfg.pwm_channel, duty);
  #endif  
WuSiYu commented 3 months ago

my mistake,I noticed the macro but forgot to add it in the PR branch. I will close this and re-open a PR with the corrected branch and code.