Analog LED Support

A great start has been made. Let’s keep it going!

Addressable is great, but there are some applications where it’s beyond overkill. :wink:

My thought was to use more than just the first pixel’s color. I recently started using the ESP32 and it’s possible to handle much more. I am currently working on four, RGBW channels. In my experience, RGB is usually fine with proper support, i.e. white balance/color correction, but that is still down the road.

My first road-block was that SetPixelColor is only getting an indexPixel of 0, even though I changed the code to…

if (indexPixel > 3) return; // Ignore all but first four pixels.

Anyone have ideas?

1 Like


if (indexPixel > 3) return; // Ignore all but first four pixels.

should work fine! What you are probably experiencing is that only the color of the 4th pixel (indexPixel == 3) is set. You’ll need a switch statement that sets the correct analog output to set the color to.
Also of course, LED count in LED settings should be at least 4.

I plan to support runtime-configurable multi-strip support soon, including support for as many analog channels as you have PWM pins available :slight_smile:

1 Like

I wish. indexPixel is always 0.

If it got beyond that, this would handle the outputs…

void SetRgbPwm(uint8_t r, uint8_t g, uint8_t b, uint16_t i)
    ledcWrite(i*3+0, r);  //RPIN
    ledcWrite(i*3+1, g);  //GPIN
    ledcWrite(i*3+2, b);  //BPIN

Just looked into this again.

There are two checks if (indexPixel != 0) return; //set analog LEDs from first pixel
in SetPixelColor, one for RGB and one for RGBW.
Have you replaced both?

I’m not using RGBW, but I’ll try that.

1 Like

No change. :frowning:

Hmm… can you send me the NpbWrapper.h you have so far?

Will do.

Sent via email!

Took a look and I have no idea why it wouldn’t work… (at least when the LED type is set to RGB)
An issue I had with ESP32 before is that they sometimes seem to enter RGBW mode even though that is not set in the settings. Maybe that is the culprit here, too.
You can try to see if going to LED settings, checking RGBW, saving, unchecking RGBW again, saving and maybe rebooting helps :slight_smile:

Interesting! I toggled RGBW and it started working! I will set that up again and see if it’s repeatable.

1 Like

Back to indexPixel. I see what Def3nder did trying to fix flicker (moving the pixel checking from NpbWrapper.h to FX_fcn.cpp) has been put into the main code.

Would it be best to add a loop somewhere to run through the first n pixels to set the PWM values, or should I do it in FX_fcn.cpp:WS2812FX::setRgbwPwm and replace the “0” used?


@Def3nder Opinion on my question?

I believe the library that was causing problems has been updated. Maybe try a fresh build using the updated / fixed problematic library?

This is not about a library. :wink:

Hi @tonyno,

as discussed on discord - just for the other ones:

please use the WS2812FX::setRgbwPwm(void) in FX_fcn.cpp
and create a look like

for (i = 0 ; i < 5 ; i++) { 
   RgbwColor color = bus->GetPixelColorRgbw(i);
   byte b = getBrightness();
   if (color == _analogLastColor && b == _analogLastBri) return;   

   set the PWM here ...

1 Like

I found that the PWM setting is still in NpbWrapper.h. Guess I need to comment that out, then.

Looks like I’ve got it!


@tonyno Can you please explain your solution?
I have tons of analog LED-Strips, waiting for a new Controller. :grin: