You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//Fixing if all bits in resolution is set = LEDC FULL ON
uint32_t max_duty = (1 << bus->channel_resolution) - 1;
if ((duty == max_duty) && (max_duty != 1)) {
duty = max_duty + 1;
If a user want to set resolution as 5 and set duty 31/32, it should be failed.
Duty ratio should be like as below.
https://github.com/espressif/arduino-esp32/blame/9e2f75564127a9853f80f3eb637b264406cb2f30/cores/esp32/esp32-hal-ledc.c#L181
If a user want to set resolution as 5 and set duty 31/32, it should be failed.
Duty ratio should be like as below.
channel_resolution = 5, duty = 0 → duty ratio = 0/32
channel_resolution = 5, duty = 1 → duty ratio = 1/32
channel_resolution = 5, duty = 2 → duty ratio = 2/32
...
channel_resolution = 5, duty = 30 → duty ratio = 30/32
channel_resolution = 5, duty = 31 → duty ratio = 31/32
channel_resolution = 5, duty = 32 → duty ratio = 32/32
However, current code makes it like below.
channel_resolution = 5, duty = 31 → duty ratio = 32/32 -> WRONG RATIO
channel_resolution = 5, duty = 32 → duty ratio = 32/32
The code on top just need to be deleted.
The text was updated successfully, but these errors were encountered: