-
Notifications
You must be signed in to change notification settings - Fork 38
Support Global Brightness on a per-pixel basis #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@PaintYourDragon (who wrote the originial library for arduino) has Thoughts about the global brightness, we purposefully never used it, because its not that great :/ |
@ladyada But is the reason behind not using the built in brightness simply the fact that when you do use it the frequency drops? |
yah, people didnt like the frequency submodulation - so we have a floating point brightness property, and that seems to work well for people, having two ways to adjust brightness could be confusing |
@ladyada |
The way this library is currently written - (always setting maximum global brightness, relying on R,G,B to control pixel brightness) limits the minimum brightness of the LEDs to a miniumum that is way above what they're capable of. Also, the brightness value as currently implemented is per-strip, not per-pixel, which bugs me as well. |
i would hesitate to merge - it breaks the cross-compatibility we were aiming for with neopixel.py |
@ladyada Has anyone tested the brightness byte on the new dimmer DotStars? |
nope, we use the same code where we send 0xFF |
@mcscope To be honest I'm extremely interested in your use case as it's very close to what we need as well. Is your code public? Could we test it? And perhaps contribute to it? (And I'm sorry if I sound dumb or appear to not understand how this whole FOSS contributing/merging/planning stuff works but I've never done it before so please be patient with me. 😊) |
@RedAnon here's my repository, I'm running it on a raspberry pi instead of using circuitpython. It probably wouldn't be hard to port to circuitpython. https://github.com/mcscope/liteup/blame/master/liteup/APA102/apa102.py |
maybe one of these could become an optional circuitpython advanced_dotstar library that lets you use the global illumination bit and do brightness per-pixel instead of stripwide. If it was a separate library we wouldn't be pinned to matching the NeoPixel API |
@mcscope I completely agree. A separate library like for example Adafruit_CircuitPython_Advanced_DotStar would be awesome. No idea how this works Adafruit-wise and if they would be interested in having it under their wing. Maybe @ladyada can shed some light into it? |
hiya if you make a new library we can fork it and/or point people to it! :) |
sure! |
Fixed by #19 |
@RedAnon Pull the latest and you should be able to use the brightness bits |
I can confirm it works flawlessly! Thank you so much @mcscope, you rock! 🙌 |
Just a quick question tho @mcscope |
@RedAnon No, it just brightens and dims for me. Can you post the code that's doing that? |
It's a very simple code:
When using just the old brightness like in the code above the colours won't shift much when I set the brightness to 0.75 or 0.5 or 0.25. But
when I use the per-pixel brightness like in the code above there is a quite noticeable colour difference between 0.75 or 0.5 or 0.25. I use the Adafruit 8x8 grid for testing, controlling it from Gemma M0. |
Seconding the color balance issue when using the 5-bits brightness. My implementation stores an array of 8-bit brightness values alongside my RGB values. Then I have 2 lookup tables - the first goes from 0-31 and sets the 5-bit value. The second has 32 ranges from 255-[some value], which matches up with the first matrix's values but scales down the RGB values. e.g. after lookup I may get something like 16 & 255. Meaning 5-bit brightness is 16 and RGB is not scaled. One index up in the matrices would be something like 17 & 200. Gamma correction is built into those and I get a smooth brightness gradient across 256 values with very minimal hue distortion. However I've noticed that my white balance is way off as I dim. It seems like the red on my SK9822s drops off a lot faster, making my dim colors green/blue shifted. (This is definitely not red shift from voltage drop). All in all I'm really happy with the implementation but a bit disheartened at the hardware limitation. I wonder if its manufacturer-specific as well. My only thought as this point is to specify 32 different color corrections to use for each value of the 5-bit brightness. Any other thoughts? |
Somehow i can not find the the extended version in the current main branch?! |
APA102 allows each pixel to have a 5 bit global brightness value in addition to the 8 bit RGB values for each pixel. This library doesn't allow that to be set - see this comment
I've used the global brightness a lot on other projects, and it's really a nice feature. I think we should allow people to use it and just note in the documentation that if you use it for persistence of vision applications you may get flickering. By preventing people from using the brightness bit, we're stopped them from accessing a decent range of what these leds can do.
(The brightness works by PWMing the entire output of the LED, and it's at a much slower pulse than the leds themselves do, so it can be flickery for persistence of vision)
I'll maintain the default behavior of max brightness if brightness is unspecified so as to not modify existing projects
The text was updated successfully, but these errors were encountered: