This is not really worrying me much but I wonder if anybody else noticed this…
if I set a ws2812b (Neopixel) to CRGB (0,0,1) or (0,1,0) or (1,0,0) or even (1,1,1), my LEDs do not light up at all. They start showing life when any color is set to at least 2.
This is a side effect of how the scaling algorithm works. To keep it fast, scale8 is quite literally ((xs)>>8) where s is your scaling value from 0-255 - @Mark_Kriegsman and I have talked about this a bunch, and have mostly decided to not worry about it (the flip side also means that the highest output value is 254, not 255 - because (255255)/256 == 254. To make this correct I’d need to add a conditional and an increment. (e.g. make it ((s<255) ? (xs+1)>>8 : x) to keep it in the realm of 8 bit math/opcodes). Note that I don’t believe I have the cycle room to add the extra operations required here into the 3-wire output routine on AVR. If, some day, we ditch the AVR platform and are doing everything with 32-bit operations anyway, then we may change the scaling function to ((x(s+1))>>8) (where we don’t have to worry about 8-bit types getting promoted to 16/32)
I actually wondered if this was a WS2812 quirk or that I had a bad batch of devices.
Did not expect that answer… Guess that behavior should be added somewhere in the docs.
I have to say that even the lowest possible white CRGB (2,2,2) on a WS2812 is surprisingly bright and I think that a valid value of CRGB(1,1,1) would be useful !
Hi @Daniel_Garcia ,
Is there any way to disable all scaling functions ? I want to make sure that when I specify CRGB(0,0,1) or (0,0,2) that it is the exact data that will be sent to my device under test, not some scaled value.
Not easily right now, no. If you are setting the global brightness to 255 however, you can account for this in your testing because it will effectively subtract one from every non-zero value.
(And the work that it would take me to allow for optionally disabling scaling is actually larger than the work it will take me to roll the scale8 fix into everything – but I won’t be able to get back to doing anything library/led related until after labor day, if not mid-late september)
I am playing with a test jig that has an Adafruit RGB Color Sensor - TCS34725 to test and possibly ‘select’ a bunch of 8mm RGB LEDs with embedded ws2811 for my 8X8X8 cube.
I want to sequentially light each color with values {0,1,2,4,8,16,32,64,128,255} to test each bit of the PWM brightness control of my RGB LED under test. I would then measure the R, G and B light output on the Color Sensor and compare that with a MIN/MAX reference table that I need to create.
I can definitely work with this offset of -1 if you tell me it is consistent from 2 to 255 becoming 1 to 254.