libretiny-eu / libretiny

PlatformIO development platform for IoT modules
http://docs.libretiny.eu/
MIT License
382 stars 55 forks source link

PWM bug #195

Closed lmcd closed 8 months ago

lmcd commented 8 months ago

I've just found a bug I think in the PWM implementation in esphome

I noticed when cycling through colours on a PWM bulb, that when one of the channels (between 0-255) hits exactly 17, the channel goes full brightness - then at 18 it goes back to normal.

In write_state I added the following log statement::

ESP_LOGV(TAG, "Duty %f, %f, %u", state, duty_rounded);

When duty rounded goes from 1 -> 2, the glitch occurs (colour value 17). The same occurs at 2 -> 3, which happens at colour value 26

lmcd commented 8 months ago

My bad, this is just the limits of PWM/LEDs I think at low brightnesses.