rpi-ws281x / rpi-ws281x-csharp

C# / .NET library wrapper for the rpi-ws281x library
BSD 2-Clause "Simplified" License
28 stars 17 forks source link

Anybody alive out there? SK6812W strips washed out #4

Open d8ahazard opened 3 years ago

d8ahazard commented 3 years ago

Hello, trying to see if this wrapper is still alive. I see it hasn't been updated in quite a while and it's pretty far behind https://github.com/kenssamson/rpi-ws281x-csharp, but I figured I'd ask here anyway since I can't seem to submit an issue on the other repo, despite it being the one available on nuget.

I'm trying to control a set of SK6812W strips, but when I send any colors through them, it seems as if the white component is just completely at 100% all of the time.

Is there anything I need to do that I'm not? I'm currently setting the strip type as SK6812W, and while the color hues are right, the white just never turns off unless I send full black...which obv. isn't ideal.

Any help would be much appreciated...

d8ahazard commented 3 years ago

Okay, I'm starting to understand now.

The strips aren't washed out. Somebody thought it would be a good idea to control the value of the white LED using the alpha channel, and rgb using their respective values.

This makes sense from a pragmatic standpoint, but is also MIND-NUMBINGLY-FRUSTRATING to try and debug issues.

"Why am I having voltage drops with only 200 LED's?".

Well Tim, that's because the library or the wrapper isn't smart enough to know that it has RGB and W LEDs to work with, so it tries to use them all at the same time. And when you turn on the RGB and W components on a bunch of LEDs at the same time at full brightness, the chips just can't handle it and the voltage drops.

Apparently, the solution to this is to do two things:

One - you need to find the minimum integer value out of the R,G,B values, and use this for the alpha value so your white color is set appropriately.

Two - You need to check to see if R + G + B values are all equal, and if so, then use Color.FromArgb() with the value that r/g/b is set to as the alpha value. So, if r/g/b are all 100, then you do Color.FromArgb(100, 0, 0, 0) to generate the proper white color. This will eliminate apparent voltage drops.

There's probably more that needs to be done to accurately represent shades of white that aren't perfectly equal, but for now, it's a lot better than when I started.

If anybody is maintaining this yet, please let me know, it would be nice to see this properly fixed in what I perceive to be the "official" wrapper library, even if it's not available on nuGet.