Repository navigation
Add global brightness support for ADA102 and SK9822 - #653
Conversation
|
@focalintent Does this PR look better now? |
|
Users should be made aware that these two chips respond differently to changes made to these 5 bit brightness fields that might not be obvious at first, and for the APA102 has potential undesirable effects. The APA102 brightness controls a (relatively) low frequency PWM, a frequency that can cause noticeable flicker for viewers that have relative motion to the LEDs. (ref 1) That is likely a reason that the default brightness value was set to full scale - to avoid this PWM effect. The SK9822 has a totally different implementation of this brightness field, which appears to be based on a current regulation scheme, and does not suffer from flicker. (ref 2) Also there has been some discussion about this brightness adjustment being scaled slightly differently between these chips, with a denominator of 31 or 32. (ref 3) In the same thread there was some concern that there may, or may not, be be some shifting of the color in the SK9822 when adjusting the brightness via GBC. ref 1: Tim's Blog - APA102 aka “Superled” |
|
This was discussed in the comments above on this PR -- this is also why this is off by default and why, for the most part I haven't exposed the brightness at all. If/when this gets exposed in documentation for users it'll have all these caveats and more. This is mostly temporary anyway, as this will likely get revised in the wake of the RGB16 support where the mapping options may become more interesting. |
|
@focalintent Speaking of RGB16 and RGBW - do you have any timelines for it in mind? |
|
@extesy When using FASTLED_USE_GLOBAL_BRIGHTNESS=1, for certain brightness values the brightness of the LEDs drops to almost all the way off. This causes a flickering when smoothly changing brightness values. The values at which this happens are: 8, 16, 24, 33, 41, 49, 66, 74, 82, 99, 107, 132, 140, 165, and 198. Which is a very strange sequence... Is this a known issue (part of your "less accurate" statement)? Changing the parameter to 2 fixes this but this seems like a bug and I'd like to use the fastest code possible. |
|
@burgerga123 See #657 |
|
Hi, I could not quite figure out how to use the brightness control for the APA 102 LEDs. Are these brightness bits only used for internal calculation or should I control them using |
ADA102andSK9822controllers allow fine brightness control using lower 5 bits in the first byte of each pixel. Currently this byte is hardcoded to be0xFFwhich means it always uses full brightness. FastLED does brightness scaling by dividing 8-bit values and it produces super inaccurate results with low brightness settings (values below 5 is almost unusable).This pull requests makes full use of per-pixel brightness control to avoid scaling down actual color values and this preserves much better color accuracy at low brightness settings, creating pretty much "HDR mode".
I've tested this code using
LOLIN D32andADA102strip. I don't haveSK9822in my posession yet but its code was identical toADA102before my changes so I expect it to work as well.To enable "HDR mode" uncomment new config parameter in
fastled_config.hand set your strip brightness to some very low number.FASTLED_USE_GLOBAL_BRIGHTNESS=1is faster but less accurate andFASTLED_USE_GLOBAL_BRIGHTNESS=2is slower but more accurate.Fixes #91 and #469.