Skip to content
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

Implement WS2811 WW/CW #4457

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Implement WS2811 WW/CW #4457

wants to merge 1 commit into from

Conversation

lmoe
Copy link

@lmoe lmoe commented Jan 4, 2025

This should add support for WS2811 warm white / cold white strips.
They work by using the WS2812 protocol (RGB) but using WW for R, CW for G and ignoring B.

I have seen support for WS2811 by using WS2811 White but this doesn't support CCT.
You can use the original WS2812 type, but this makes it hard to properly tune CCT without losing brightness.

I have seen quite a few special if/else blocks for certain types, which made following the code a bit difficult for me. I've thought adding separate type handlers might make things easier to work on, even if it's more code in the end.

Tested it with an ESP32.

Hope the PR is fine to submit like this :)

@lmoe lmoe force-pushed the add_ws2811_wwcw branch from f8f3ed0 to 3d3ce44 Compare January 4, 2025 19:08
@softhack007
Copy link
Collaborator

softhack007 commented Jan 5, 2025

@lmoe please don't use force-push while you have a PR open in the main WLED repo. You can simply push changes to your branch and they will be added to your PR automatically.

lmoe force-pushed the add_ws2811_wwcw branch from f8f3ed0 to 3d3ce44 Compare4 hours ago

force-push however has some very bad side-effects on github and it makes reviewing PRs a nightmare.,.

@softhack007 softhack007 requested a review from blazoncek January 5, 2025 00:02
@lmoe
Copy link
Author

lmoe commented Jan 5, 2025

Ah, sorry. Just wanted to condense a second commit I've made after I opened the PR into one, and this was muscle memory.
If it helps I can create a new PR and close this one. :) @softhack007

@softhack007
Copy link
Collaborator

@lmoe we can continue with this PR, no need to create a new one.

You might get feedback requesting code changes, so just remember to push new commits but don't use force-push.

Copy link
Collaborator

@blazoncek blazoncek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not like the idea of adding new wrapper type as the only difference is in RGB value for color.

There is already a method that works for single white addressable strips in BusDigital. Modify that and leave wrapper alone.

I would also keep original const as it was specified since WS281X type of chips share similar signal specifications.

Another downside of this approach is that UI has no clue this is not a RGB strip and will show RGB controls instead of hiding them.

One thing that remains open is the use of A (amber) channel (since there are WWA strips). I think that using 0 is acceptable until WLED is modified to support such strip fully.

Still, there may be strips that have ww/cw/ww, cw/ww/cw, ... order of LEDs (maximizing chip utilisation). This should be added but I still have no idea how to implement with as little change as possible. And I loath duplicating code!

@@ -89,6 +89,11 @@
#define I_8266_U1_SM16825_5 104
#define I_8266_DM_SM16825_5 105
#define I_8266_BB_SM16825_5 106
//WS2811 (WWCW)
#define I_8266_U0_NEO_WS2811_WWCW 107
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values overlap.

@@ -139,6 +144,11 @@
#define I_32_RN_SM16825_5 107
#define I_32_I0_SM16825_5 108
#define I_32_I1_SM16825_5 109
//WS2811 (WWCW)
#define I_32_RN_NEO_WS2811_WWCW 110
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do these.

@@ -226,6 +236,11 @@
#define B_8266_U1_SM16825_5 NeoPixelBusLg<NeoRgbwcSm16825eFeature, NeoEsp8266Uart1Ws2813Method, NeoGammaNullMethod>
#define B_8266_DM_SM16825_5 NeoPixelBusLg<NeoRgbwcSm16825eFeature, NeoEsp8266Dma800KbpsMethod, NeoGammaNullMethod>
#define B_8266_BB_SM16825_5 NeoPixelBusLg<NeoRgbwcSm16825eFeature, NeoEsp8266BitBangWs2813Method, NeoGammaNullMethod>
// W2811 (WWCW)
#define B_8266_U0_NEO_WS2811_WWCW NeoPixelBusLg<NeoGrbFeature, NeoEsp8266Uart0Ws2813Method, NeoGammaNullMethod> //3 chan, esp8266, gpio1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no difference from B_8266_U0_NEO_WS2812.

@@ -900,9 +948,14 @@ class PolyBus {
case I_8266_U1_SM16825_5: (static_cast<B_8266_U1_SM16825_5*>(busPtr))->SetPixelColor(pix, Rgbww80Color(col.R*257, col.G*257, col.B*257, cctWW*257, cctCW*257)); break;
case I_8266_DM_SM16825_5: (static_cast<B_8266_DM_SM16825_5*>(busPtr))->SetPixelColor(pix, Rgbww80Color(col.R*257, col.G*257, col.B*257, cctWW*257, cctCW*257)); break;
case I_8266_BB_SM16825_5: (static_cast<B_8266_BB_SM16825_5*>(busPtr))->SetPixelColor(pix, Rgbww80Color(col.R*257, col.G*257, col.B*257, cctWW*257, cctCW*257)); break;
case I_8266_U0_NEO_WS2811_WWCW: (static_cast<B_8266_U0_NEO_WS2811_WWCW*>(busPtr))->SetPixelColor(pix, RgbColor(cctWW, cctCW, 0)); break;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done in BusDigital instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants