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
Describe the solution you'd like
We are currently using NeoPixelBrightnessBus objects in bus_manager.h + bus_wrapper.h.
It seems that there is a replacement with similar functionality, however considering that we also have challenges related to gamma correction LUT and "non-natural dimming" (like #2767), destructive brightness reduction, and color values < 28 being mapped to 0 due to 8bit gamma LUT (several discussions on discord) , and we want to support higher bitdepht at least for PWM (#2868),...
Well it might be a good time to plan for a redesign of bus_manager.h, and see if we can replace NeoPixelBrightnessBus with something more appropriate.
It should not be that difficult, though tedious, as entire WLED interacts with bus manager and not bus wrapper.
Btw bus_manager is an abstraction layer providing API (actually replicating NPBB from bus_wrapper).
Color recovery (although lossy) is quite trivial: recovered = (original*256) / (brightness+1). I would therefore propose we use the standard NeoPixelBus instead of NeoPixelBusLg and handle the brightness scaling in bus manager. This also gives greater control for >8 bit busses. As for the new gamma correction capability (which is cool to have in the library now!), it would likely not make sense to delegate it to NPB, as we still need it within WLED for e.g. analog busses and for functionality like having correction enabled for FX but not for live data.
@blazoncek I will do ESP8266 testing of #3091 on Wednesday, will test adding brightness scaling to get/setPixelColor :)
NPBLg will return unmodified (original) pixel value from SetPixelColor(), there should be no need to recover old value from it.
At least that was my impression after a glimpse of the NPBLg code.
There are some clever tricks in NPBLg for 16bit LEDs.
Looks like my brief read-through was not accurate enough.
And BTW, I did not touch post-processing in bus_wrapper. I merely replaced NeoPixelBrightnessBus with NeoPixelBusLg. Nothing more.
Activity
blazoncek commentedon Feb 10, 2023
It should not be that difficult, though tedious, as entire WLED interacts with bus manager and not bus wrapper.
Btw bus_manager is an abstraction layer providing API (actually replicating NPBB from bus_wrapper).
Replace NeoPixelBrightnessBus with NeoPixelBusLg
blazoncek commentedon Feb 13, 2023
@softhack007 will you have time to test the above commit?
softhack007 commentedon Feb 13, 2023
Not this week, sorry. I'm away from home until 20th.
But I'll surely take a look and test next week.
Aircoookie commentedon Feb 14, 2023
Color recovery (although lossy) is quite trivial:
recovered = (original*256) / (brightness+1). I would therefore propose we use the standardNeoPixelBusinstead ofNeoPixelBusLgand handle the brightness scaling in bus manager. This also gives greater control for >8 bit busses. As for the new gamma correction capability (which is cool to have in the library now!), it would likely not make sense to delegate it to NPB, as we still need it within WLED for e.g. analog busses and for functionality like having correction enabled for FX but not for live data.@blazoncek I will do ESP8266 testing of #3091 on Wednesday, will test adding brightness scaling to get/setPixelColor :)
blazoncek commentedon Feb 14, 2023
NPBLg will return unmodified (original) pixel value from SetPixelColor(), there should be no need to recover old value from it.
At least that was my impression after a glimpse of the NPBLg code.
There are some clever tricks in NPBLg for 16bit LEDs.
Aircoookie commentedon Feb 14, 2023
As far as I understand, it returns the original (as in, already scaled) value as written to the LED. So if you set 255,128,0 at 50% bri it would just return 127,64,0 rather than attempting to restore the color: https://github.com/Makuna/NeoPixelBus/blob/master/src/NeoPixelBusLg.h#L92-L92
Non-lossy reconstruction is not even possible without an extra buffer, but I will give you the benefit of the doubt and first test the PR as is.
blazoncek commentedon Feb 14, 2023
Looks like my brief read-through was not accurate enough.
And BTW, I did not touch post-processing in bus_wrapper. I merely replaced NeoPixelBrightnessBus with NeoPixelBusLg. Nothing more.
Add Ucs890x support and swaps NeoPixelBrightnessBus with NeoPixelBusLg (
Add Ucs890x support and swaps NeoPixelBrightnessBus with NeoPixelBusLg (