Analog LED Support

Same with me and I have been as well! :wink:

I need to read up on github about pull-requests. Until I figure that out…

It seems that the 8266 may not be up to it, so my code is for the ESP32. It’s currently for 4x RGB channels with the LED pins being {15,2,4, 5,18,19, 21,22,23, 13,12,14} or 4x RGBW {15,2,4,5, 18,19,21,22, 13,12,14,27, 26,25,33,32}.

Let me know if you want a bin file! I plan on making boards as well.

1 Like

Any updates? What are you guys using to drive the LEDs?

It’s working well! I’ve got my own boards that I am working on and I’ve also put wled on a Shelly RGBW2.

I think there is a single-channel BIN file on Git, too.

I may just use a high current ws2811 pixel driver board as I will have pixels as well. All of them I can find appear to be out of stock though.

In the latest source, the analog-led writing was moved back to NpbWrapper.h from FX_fcn.

Was that on purpose?

@Def3nder, @Aircoookie comments?

Nothing was really moved… But I have to agree the function naming is very confusing, something I hadn’t really noticed before. setRgbwPwm() in fx_fcn.h and SetRgbwPwm() both are relevant and implement part of the functionality, but are separate functions that do different thigns. I will rename one of them.

Okay. I was using a Def3nder branch. It was moved it to try and diminish the flickering.

Hi @Aircoookie, the reason of the simmilar (but different) naming was that the one function is public (can be used from other modules wether the other one can only be accessed by the wrapper. I used this style simmilar to the other functions in the wrapper that had the same name but different first-letter-case.

I’m sorry to not find time working on WLED because of personal problems.
As WLED is my most interesting project I will (re-)start working when time comes …

Greetings from Berlin - stay healthy !

1 Like

Should the above code still work in 0.10?

Not sure if it’s something I introduced, but it’s bombing out and saying it doesn’t know what ‘color’ or ‘b’ is.

Now with actual error goodness. Kinda looks like what I’ve seen before when I missed a semicolon, closing brace, or mismatched loops. :open_mouth: I can’t find anything like that, though.

sketch\FX_fcn.cpp: In member function ‘void WS2812FX::setRgbwPwm()’:

FX_fcn.cpp:859:21: error: ‘color’ was not declared in this scope

 bus->SetRgbwPwm(color.R * b / 255, color.G * b / 255, color.B * b / 255, color.W * b / 255);

                 ^

FX_fcn.cpp:859:31: error: ‘b’ was not declared in this scope

 bus->SetRgbwPwm(color.R * b / 255, color.G * b / 255, color.B * b / 255, color.W * b / 255);

So, I moved the ledcWrite stuff back into NpbWrapper but only some things work. I need to turn up the Master Brightness slider almost all of the way to get the LEDs/relay to turn on, and then only colors with mostly blue work. :frowning:

Anyone have any ideas on this?

I thought @Aircookie fixed this issue a couple versions ago.

091 is working fine. Something is different in this regard in 010.

In the current master for FX_fcn.cpp, line 859 is not the above quoted text. If you update to the current master version, does that fix the problem?

This is about 010 and getting these modifications into it. :wink:

I’ve tried going at this several ways and still not having any luck. The closest I’ve been is one of the four outputs working correctly.

Here is the code for one version…

void WS2812FX::setRgbwPwm(void) {
  uint32_t nowUp = millis(); // Be aware, millis() rolls over every 49 days
  if (nowUp - _analogLastShow < MIN_SHOW_DELAY) return;
  _analogLastShow = nowUp;

  for (uint16_t i = 0 ; i < 4 ; i++) {   
    RgbwColor color = bus->GetPixelColorRgbw(i);
    byte b = getBrightness();
    if (color == _analogLastColor && b == _analogLastBri){}
    else {
      ledcWrite(i*4+0, color.R*b/255);  //RPIN
      ledcWrite(i*4+1, color.G*b/255);  //GPIN
      ledcWrite(i*4+2, color.B*b/255);  //BPIN
      ledcWrite(i*4+3, color.W*b/255);  //BPIN
      _analogLastColor = color;
      _analogLastBri = b;
    }
  }

This is probably going to make your head explode, but && is performed before == in C’s order of precedence for logical operations.

Working fine in 091. :man_shrugging: