-
Notifications
You must be signed in to change notification settings - Fork 625
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
[FEATURE REQUEST] Custom color order for SK6812 compatible strips #540
Comments
Thanks so much for this, I was running into the exact same problem. I wonder if this would be a better fix, mostly because the Python library was not liking those changes. If we just change the comparison: // If our shift mask includes the highest nibble, then we have 4 LEDs, RBGW.
if (channel->strip_type & SK6812_SHIFT_WMASK)
{
array_size = 4;
} To: // If any shift includes 0x18, then we have 4 LEDs, RBGW.
if (channel->strip_type >> 24 == 0x18 || ((channel->strip_type >> 16) & 0xff) == 0x18 || ((channel->strip_type >> 8) & 0xff) == 0x18 || (channel->strip_type & 0xff) == 0x18)
{
array_size = 4;
} It correctly adjusts to 4 colors, and the Python library likes it better #define SK6812_STRIP_WRGB 0x00181008 |
What was the problem? |
I didn't save the exact error, but it threw type conversion fits if the strip started with '98', i.e. 0x98100800 |
Went back to get it, here is the Python error output: |
What hardware are you using this library on? 64 or 32 bit? |
32bit |
I'm not a Python expert but that could explain why you see the error. I believe on 32bit systems int is limited to 2,147,483,647, hence the overflow. To avoid this issue you can try using not the highest, but the second highest bit to signal the W component, which this means you'd need to do the following changes:
|
Thanks for the change, I'll try it out. |
You won't notice any performance difference, but it will be faster than your solution ;) |
Hi, I came across this issue as me too wants to use WS2814 Strips (24V rulez :D) ... I will try your changes and when they work for me, I wonder if it was ok for you if I start a pull request with your patch ;) |
Sure, go ahead :) |
I recently came across a WS2814/SK6812 compatible strip with (unusual?) WRGB color order, which I unfortunately cannot configure properly to use with this great library. The closest I can get is SK6812_STRIP_BRGW but the Blue and White are swapped.
The problem I'm facing is that currently the library assumes that W is always last, and and detects presence of W by checking only the highest nibble of the strip type
where
SK6812_SHIFT_WMASK
is defined as#define SK6812_SHIFT_WMASK 0xf0000000
The way I've temporarily solved it for myself is to check the highest bit of each byte of the strip type with the mask defined as follows:
#define SK6812_SHIFT_WMASK 0x80808080
and modified the strip types to the highest bit of the W byte enabled here
In addition to that I've modified setting the color shift values here and here to
Do you think such modification could be added to the library?
P.S. Not sure how popular my type of the strip is, but just in case you would find it worth adding it, here is the strip type #define for it
#define SK6812_STRIP_WRGB 0x00981008
The text was updated successfully, but these errors were encountered: