SUPLA / supla-device

Create your own Supla device! This software can be used as a library for Arduino IDE, or can be used directly with ESP8266 RTOS SDK and with ESP IDF. It is also possible to compile and run it on Linux and in FreeRTOS.
GNU General Public License v2.0
28 stars 14 forks source link

Change dimming function to non-linear #28

Closed klew closed 1 year ago

klew commented 1 year ago

https://forum.supla.org/viewtopic.php?p=135582#p135582

klew commented 1 year ago

Dimming function should be selectable. I.e. currently people may use dimmer channel to control something else than LED, which requires linear function.

Hrumque commented 1 year ago

And dimming "direction" should be selectable - steady 1 on gpio means 100% pwm, or stady 0 on gpio means 100% pwm

Hrumque commented 1 year ago

If the implementation of non-linear curves for dimming is a big problem, it can be done (even temporarily) in such a form that we limit the number of dimmer levels, e.g. to 8 or 16, and assign them pwm values (level0, level1, ... level15). So on the "input" variable the dimming remains as it is now (dim/brighten button, application, values stored in cloud etc), only in the firmware in device is made a change, even through the "case" ladder - For led lighting - I tested for 2 different light sources (led strip and led RGB) - my levels are completely smooth in 11 levels: level0 =0% pwm (off) level1 = 1% level2 = 2% level3 = 3% level4 = 5% level5 = 10% level6 = 20% level7 = 30% level8 = 45% level9 = 60% level10 = 100% between 60% pwm and 100% there is almost no brightness gain anymore. And between 1 and 3% there is a significant difference.

ADDITIONALLY - assignment of specific discrette pwm values - allows (at last) two additional possibilities:

klew commented 1 year ago

@Hrumque it is not a big problem. It's rather easy task, however I don't have time right now to handle it, so it has to wait.

klew commented 1 year ago

Done in https://github.com/SUPLA/supla-device/releases/tag/v23.5