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
{{ message }}
Repository navigation
control global brightness on APA102 (and other chip supporting it) #91
Still thinking about a good way to expose it in the library API - noodling on a couple of ideas.
For now I'm leaving it max'd for folks doing POV beings you start getting visible stutter/flickering as soon as you start scaling that brightness down.
I understood the need to set it to max for POV application, and I can fade it down by hacking the APA102Controller class declaration (but it's ugly :-) )
I see two ways to start :
use the alpha channel of ARGB
add a brightness member to CLEDController class and a setter method to control brightness on chips that support it.
ARGB is not officially supported yet - and this isn't an A(lpha) channel thing. It is more likely going to be something that is used as part of 16-bit RGB values (as a precursor to dithering).
I'm also very cautious about adding arbitrary methods to the controllers - especially when it is something i'm going to have to support/document - so, rather than rushing something in, i'm happy to let people that know about it adjust the value directly in the header file
what is the status of this issue ? it has been closed to let it "as it is" but later tagged with "FastLED 3.1 release"
Since 3.1 is out now, I would like to know if the global brightness of APA102 (and other) is accessible (and easily modifiable), I didn't see anything related to in the release note, nor in the code.
I really need to control it on the fly during the show, so an hard coded value in chipset.h is not a solution for me.
Thanks for your work.
The milestone adjustment was part of a bulk tagging. I never put something in for global brightness control of the APA102 because a) i couldn't put together a good interface that I was happy enough with and b) I hated the effect of using the brightness adjustment and there wasn't a good/fast reliable way to use it with the global brightness.
If you need to be able to adjust it on a per-pixel basis, that's a fair bit more complexity to deal with (as far as fitting in with the rest of the infrastructure/architecture).
thanks for the review, btw, I uploaded the wrong file, now it should be ok.
in yours, only the writeLed() method is using the bBaseValue and not the show() methods.
I've fixed that.
I just got some APA102s with the intention of using global brightness control to get pseudo 15-bit color out of the LEDs. I made a simple demo that increments/decrements a 16-bit value, and see lots of stepping at slow increments of low values with the normal 8-bit APA102, but it's really smooth when I use the GBC bits. I'll make a better demo and share with the FastLED community.
@focalintent I'm concerned by your comment of "I hated the effect of using the brightness adjustment", are you sensitive to the >500 Hz PWM? Tim commented on that too on his blog, but I'm just not seeing anything bothersome.
@embedded-creations interesting. Do you have some demo code and/or video online? I'm using dithering to prevent stepping on slow increments of low values, but this seems like an option that might be worthwhile to test.
The code interpolates between two random colors very slowly. Even with a brightness of 10/256, stepping is not very apparent on the LED using GBC bits, but it is very apparent on the 8-bit LED. Interpolation code is from the blink1 firmware, modified to work with 16-bit colors instead of 8-bit. I ran this on a Teensy 3.1 at 72MHz but it's not really platform specific.
Not so much in this issue - more likely what i'd do is either roll it in as part of a move to a 16-bit rgb(w) world, or try juggling what you've done to work with the existing brightness scaling - either way, it's unlikely that I'd ever expose a direct api for setting the brightness on a per pixel (or even really per-strip) value.
The other thing that I'd want to make sure of is that I did not slow down the APA102 output by adding extra overhead. On something like a teensy this work wouldn't be that much extra - but on avr it could pull back the performance of prepping/writing out data (in which case, I'd also want a good way to shut it off easily).
(I haven't had a chance to give the demo a try yet, though -- combination of day job, a contract that I'm trying to finish off, and still neck deep in some library internals re-architecting - and somewhere in there my brain demands sleep)
more likely what i'd do is either roll it in as part of a move to a 16-bit rgb(w) world, or try juggling what you've done to work with the existing brightness scaling - either way, it's unlikely that I'd ever expose a direct api for setting the brightness on a per pixel (or even really per-strip) value.
I agree with you. There's not much value to this unless you're using 16-bit math, or applying a gamma/color correction behind the scenes (like the SmartMatrix Library does) and mapping 8-bit RGB onto the 13-bit space.
No pressure on trying anything, I just don't want this topic to be forgotten as it's in a closed issue. Should I create a new issue for it?
I'm now testing the brand new apa102 2020, 198 leds per meter (beautiful) and got myself questioning the same. it has a sharp curve to black when using global brightness, and it would be great being able to control independent brightness as a parameter too (optionally).
Activity
focalintent commentedon Oct 30, 2014
Still thinking about a good way to expose it in the library API - noodling on a couple of ideas.
For now I'm leaving it max'd for folks doing POV beings you start getting visible stutter/flickering as soon as you start scaling that brightness down.
avilleret commentedon Oct 30, 2014
I understood the need to set it to max for POV application, and I can fade it down by hacking the
APA102Controllerclass declaration (but it's ugly :-) )I see two ways to start :
focalintent commentedon Oct 30, 2014
ARGB is not officially supported yet - and this isn't an A(lpha) channel thing. It is more likely going to be something that is used as part of 16-bit RGB values (as a precursor to dithering).
I'm also very cautious about adding arbitrary methods to the controllers - especially when it is something i'm going to have to support/document - so, rather than rushing something in, i'm happy to let people that know about it adjust the value directly in the header file
focalintent commentedon Apr 5, 2015
Leaving this as it is for now.
avilleret commentedon Dec 17, 2015
hey,
what is the status of this issue ? it has been closed to let it "as it is" but later tagged with "FastLED 3.1 release"
Since 3.1 is out now, I would like to know if the global brightness of APA102 (and other) is accessible (and easily modifiable), I didn't see anything related to in the release note, nor in the code.
I really need to control it on the fly during the show, so an hard coded value in
chipset.his not a solution for me.Thanks for your work.
focalintent commentedon Dec 17, 2015
The milestone adjustment was part of a bulk tagging. I never put something in for global brightness control of the APA102 because a) i couldn't put together a good interface that I was happy enough with and b) I hated the effect of using the brightness adjustment and there wasn't a good/fast reliable way to use it with the global brightness.
https://gist.github.com/focalintent/919fc68b365668dbfda9 has a rough outline of a modified custom class that exposes this and how you'd use it - so you can use it for your project.
If you need to be able to adjust it on a per-pixel basis, that's a fair bit more complexity to deal with (as far as fitting in with the rest of the infrastructure/architecture).
avilleret commentedon Dec 18, 2015
thanks a lot for this class example !
I have to modify it a little bit to make it work.
Here is my version : https://gist.github.com/avilleret/e84628188a85330bc660
Btw, as far as I understand, there is no chance to see that code included in FastLED one day.
I think it's a shame, but it's your choice.
Thanks again for giving me such support and code example.
focalintent commentedon Dec 18, 2015
I don't like the idea of users generally using the led controller objects directly - so this isn't a good general solution.
Also - it is important that the first three bits in an apa102 pixel data be high - or else data will get skipped.
That was why I was doing the mask with 0xE0 (force the top three bits to be high). The global brightness should then be a value from 0-31.
avilleret commentedon Dec 18, 2015
thanks for the review, btw, I uploaded the wrong file, now it should be ok.
in yours, only the
writeLed()method is using thebBaseValueand not theshow()methods.I've fixed that.
embedded-creations commentedon Jan 6, 2016
I just got some APA102s with the intention of using global brightness control to get pseudo 15-bit color out of the LEDs. I made a simple demo that increments/decrements a 16-bit value, and see lots of stepping at slow increments of low values with the normal 8-bit APA102, but it's really smooth when I use the GBC bits. I'll make a better demo and share with the FastLED community.
@focalintent I'm concerned by your comment of "I hated the effect of using the brightness adjustment", are you sensitive to the >500 Hz PWM? Tim commented on that too on his blog, but I'm just not seeing anything bothersome.
kasperkamperman commentedon Jan 6, 2016
@embedded-creations interesting. Do you have some demo code and/or video online? I'm using dithering to prevent stepping on slow increments of low values, but this seems like an option that might be worthwhile to test.
embedded-creations commentedon Jan 6, 2016
The code's a mess, I just hacked something together last night starting from the Adafruit DotStar library. Here's the interesting part:
focalintent commentedon Jan 6, 2016
Where this gets ugly is when you have non zero values for more than just one of r, g, or b :)
embedded-creations commentedon Jan 6, 2016
Yeah, I was thinking bitwise-OR the three colors, and use that as "value", shift all three colors by the same amount.
embedded-creations commentedon Jan 6, 2016
Here's a simple demo:
https://github.com/embedded-creations/apa102-gbctest
The code interpolates between two random colors very slowly. Even with a brightness of 10/256, stepping is not very apparent on the LED using GBC bits, but it is very apparent on the 8-bit LED. Interpolation code is from the blink1 firmware, modified to work with 16-bit colors instead of 8-bit. I ran this on a Teensy 3.1 at 72MHz but it's not really platform specific.
embedded-creations commentedon Jan 9, 2016
Did anyone give the demo code a try? I'm curious what you guys think. Do you notice the PWM dimming?
@focalintent This issue was closed 8 months ago, is it worth reopening the topic as there is interest?
focalintent commentedon Jan 9, 2016
Not so much in this issue - more likely what i'd do is either roll it in as part of a move to a 16-bit rgb(w) world, or try juggling what you've done to work with the existing brightness scaling - either way, it's unlikely that I'd ever expose a direct api for setting the brightness on a per pixel (or even really per-strip) value.
The other thing that I'd want to make sure of is that I did not slow down the APA102 output by adding extra overhead. On something like a teensy this work wouldn't be that much extra - but on avr it could pull back the performance of prepping/writing out data (in which case, I'd also want a good way to shut it off easily).
(I haven't had a chance to give the demo a try yet, though -- combination of day job, a contract that I'm trying to finish off, and still neck deep in some library internals re-architecting - and somewhere in there my brain demands sleep)
embedded-creations commentedon Jan 10, 2016
I agree with you. There's not much value to this unless you're using 16-bit math, or applying a gamma/color correction behind the scenes (like the SmartMatrix Library does) and mapping 8-bit RGB onto the 13-bit space.
No pressure on trying anything, I just don't want this topic to be forgotten as it's in a closed issue. Should I create a new issue for it?
focalintent commentedon Jan 11, 2016
Nah - it's already part of the giant offline list i'm keeping for the 16-bit re-write of the library :)
embedded-creations commentedon Mar 29, 2016
Here's a more complete implementation of using APA102 GBC to increase color depth, and a demo video:
http://community.particle.io/t/smartmatrix-apa102-library-open-hardware-photon-apa102-shield/21562
dimitre commentedon Apr 29, 2017
I'm now testing the brand new apa102 2020, 198 leds per meter (beautiful) and got myself questioning the same. it has a sharp curve to black when using global brightness, and it would be great being able to control independent brightness as a parameter too (optionally).
Today I've made some proof of concept using this library, of course it doesn't have the amazing capabilities of FastLED
https://github.com/pololu/apa102-arduino
and I could make a great smooth gradient to black dimming the color and global brightness at the same time.
extesy commentedon Sep 15, 2018
@avilleret @focalintent I've created a pull request #653 to add global brightness support.