Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
15.09k stars 3.26k forks source link

Multiple led strip control from single ESP #104

Closed N1nja98 closed 3 years ago

N1nja98 commented 5 years ago

Wow!! I must congratulate you on your awesome work! It is absolutely amazing! I was working on a similar project when i stumbled across WLED. It had almost everything i was trying to make!

One requirement of my project was to connect multiple led strips of various lengths to a single esp and control them individually or grouped. Would this be possible? If you could give me some pointers I could try and implement it myself.

Thanks!

Aircoookie commented 5 years ago

Hi, thank you! I'm very glad you like it that much! Multiple strips are a bit difficult, since there are only 2 pins available on the ESP8266 for "hardware accelerated" LED driving (software bit-bang can be unreliable), but I can consider rewriting the library a bit to at least allow those two strips to be connected.

On a related note, the next major feature I will work on is segment support! It will allow you to set different segments of the same strip to different colors, so you could also connect strips in series and control them separately!

N1nja98 commented 5 years ago

Segment support sounds like an awesome idea!

I’m currently using an ESP32 on which I understand more pins can be used than the ESP8266 so the lack of pins would not be an issue on that part.

The reason in my case for using multiple pins instead of one continuous strip divided into segments is that the strips are somewhat isolated from one another (but too short in length to add another ESP) and would require much more wiring to connect in series.

Again, your work is greatly appreciated!

N1nja98 commented 5 years ago

OK... I tried adding a second strip to the code that would be controlled same as the original strip. But I noticed that whichever strip is initialized last, gets updated, the first strip initialized remains blank; even when I change the order I initialize the strips.

I've tried and succeeded running 8 different strips at a time with the original WS2812FX library which uses the Adafruit NeoPixel Library so I assume it has something to do with NeoPixelBus. Is multiple strip output supported on ESP32 with NeoPixelBus?

Thanks!

Aircoookie commented 5 years ago

Yes, having two strips (one on DMA, one on UART) should be supported with NeoPixelBus. Can you send me your modified NpbWrapper.h so I can take a look?

N1nja98 commented 5 years ago

Only modifications are I added a third argument for ledpin to Begin() and accordingly to WS2812FX::init(). Do also need to change the PixelMethod?

debsahu commented 5 years ago

Interesting hardware method to achieve this https://youtu.be/oGB7Yrbeo_Y

Aircoookie commented 5 years ago

@debsahu those are really cool!

@N1nja98 here you have a NpbWrapper.h capable of driving two strips: NpbWrapper.zip. It just mirrors them for now, so it's should work just like if you were connecting two strips to the same pin in parallel. Please make sure not to use more than ~200 LEDs per strip with this, since you will run into memory issues with the DMA method and high LED counts. Also, the auto brightness limiter will only work for this if you divide the amp rating by 2, since it only calculates the draw for one of the strips. Once I added segment support, the two strips could display different content, which would make this approach that's only a demo right now actually useful.

Mariu86 commented 5 years ago

Aircoookie , how many segments will support wled ? Can we make a nanoleaf? Thanks

N1nja98 commented 5 years ago

@Aircoookie Thanks for the help! I now see what I did wrong. I figured every WS2812FX strip created a new NeoPixelWrapper object when in fact you have to duplicate everything in the NeoPixelWrapper.

@debsahu I wonder if similar drivers are available somewhere.

N1nja98 commented 5 years ago

I found a solution for driving more than 2 strips on ESP32 using FastLED. I'm currently driving 4 strips of 284 leds each (total 1136) on 4 separate pins, addressed as one long strip. It still uses NeopixelBus to set the pixel colors in the array but instead of using NeopixelBus' show function I use FastLED's. FastLED's led array is just pointing to NeopixelBus' array. Not the most efficient solution but it suits my purpose.

With this led setup I wanted to split the strip into 4 separate ones just to increase framerate, but with another setup I'm working on I want to drive 7 strips, each individually controlled, plus a matrix showing the time. So being able to control them from separate pins instead of wiring them in series will be much easier.

Anyway here is the modified code if anyone's interested:

Update:

The latest working version I have is this commit: https://github.com/Aircoookie/WLED/commit/a4e093159e788f60a1d0d9eabace51331ff92f07 made on May 24, 2020. WLED 0.10.0

This is placed at the top of "FX_fcn.cpp" under the include statements:

//toggle for multi-strip
#define Use_FastLED //FastLED already included in FX.h

#ifdef Use_FastLED

#define LED_TYPE    WS2812B
#define COLOR_ORDER RGB //Actually GRB. Explained later.
#define NUM_STRIPS 4
#define NUM_LEDS_PER_STRIP 284
//#define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS

CRGB* leds;
#endif // Use_FastLED

This is placed in same file in at the bottom of "WS2812FX::init" right under setBrightness(_brightness);:

//An example for driving 1136 leds in four different strips with 284 leds in each.
#ifdef Use_FastLED

        //Pointer to NeoPixelBus led array  
        leds = (CRGB*)bus->GetPixels(); //GetPixels function added to "NpbWrapper.h"

    // tell FastLED there's 284 NEOPIXEL leds on pin 12, starting at index 0 in the led array
    FastLED.addLeds<LED_TYPE, 12, COLOR_ORDER>(leds, 0, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);

    // tell FastLED there's 284 NEOPIXEL leds on pin 14, starting at index 284 in the led array
    FastLED.addLeds<LED_TYPE, 14, COLOR_ORDER>(leds, 1 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);

    // tell FastLED there's 284 NEOPIXEL leds on pin 27, starting at index 568 in the led array
    FastLED.addLeds<LED_TYPE, 27, COLOR_ORDER>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);

    // tell FastLED there's 284 NEOPIXEL leds on pin 26, starting at index 852 in the led array
    FastLED.addLeds<LED_TYPE, 26, COLOR_ORDER>(leds, 3 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);
#endif // Use_FastLED

bus->Show() in same file at bottom of "WS2812FX::show" is replaced with:

#ifndef Use_FastLED
    bus->Show();
#else
    FastLED.show();
#endif // Use_FastLED

This function is added into "NpbWrapper.h" unless it's already included in your version.

uint8_t* GetPixels() 
  {
      return _pGrb->Pixels();
  }

#define PIXELMETHOD NeoEsp32Rmt0Ws2812xMethod on line 56 in "NpbWrapper.h" is replaced with:

#define PIXELMETHOD NeoWs2813Method
//#define PIXELMETHOD NeoEsp32Rmt0Ws2812xMethod

Version number NeoPixelBus@2.5.7 on line 162 in "platformio.ini" is changed to NeoPixelBus@2.5.1

Version number Esp Async WebServer@1.2.0 on line 166 in "platformio.ini" is changed to Esp Async WebServer@1.2.2

Version number platform = espressif32@1.11.1 on line 233 in "platformio.ini" is changed to platform = espressif32@1.7.0

I use VS Code with PlatformIO for compiling and uploading. Here is the full version of the modified code. Let me know if it works for you.

WLED Multi-Strip Mod.zip

This works on WLED 0.10.0 up to the following commit:https://github.com/Aircoookie/WLED/commit/a4e093159e788f60a1d0d9eabace51331ff92f07

My color order was wrong at first. I think it's because the order of color values in NeopixelBus' led array is the same as the color order you set for your leds, while FastLED's led array is RGB no matter what color order you set. So in my case with GRB leds, showing NeopixelBus' array with FastLED results in reversed green and red. So in the COLOR_ORDER definition for FastLED I put RGB instead of GRB to change them back.

niroth81 commented 5 years ago

I know this is an old Issue. But is it possible for you to create a binary that I can do an OTA upload with to include the strip segmenting? I'm not very good with updating these files and I've been at it for days without success.

Jafterdark commented 5 years ago

I just seen this thought I'd leave it might be helpful https://www.reddit.com/r/esp32/comments/bkyeq0/20000_ws2812b_pushed_at_130fps_with_esp32_and/

fijit586 commented 4 years ago

I too am looking for more than one data signal. I just posted a "Feature Request" about it. Segments could work for my situation as the 2 channels I would want would be located next to each other (windows). I am also going to put leds on my roofline and want my animations to emanate from the peaks. I could accomplish this by wiring FROM the peak and having 2 strings, one on each side of the roof, with both led #0 at the peak. But "segments" could make this easier to wire IF I can call out a pixel and have the animation start there and go down stream on subsequent pixels but reverse and go upstream on previous ones. Then I wouldn't have to start 2 strings at the peak. I could start one really long string at the bottom of the roof, on one side.

goatchurchprime commented 4 years ago

I've heard that the state of the art with regards to fast controls is the method on the teensy.

I can't find the WLED code where the actual hardware accelerated pin driving is done, other than the setting "NeoEsp8266UartWs2813Method", but this leads to the NeoPixelBus library which implements a huge number of different hardware hacks.

In an ideal world, shouldn't NeoPixelBus be used as an external library rather than copied in?

There is so much more to it than what you get in Micropython (my favourite firmware for ESPs), which is just a single unsophisticated bitbanging-timer-delay function.

Aircoookie commented 4 years ago

Working on multi strip support right now! Promising nothing, but we might be able to get 4 outputs on 8266 and 8 on ESP32 😄

@goatchurchprime NeoPixelBus is used as an external library! I'd never be as good as Makuna with low level driving goodness. NpbWrapper.h is just for dynamically changing between RGB and RGBW modes (and soon LED pins and number of strips)

Timgerr321 commented 4 years ago

@Aircoookie I'm glad to hear that you're working on the multiple led feature. Do you have an indication on how long it takes before we can use it?

CaptainDario commented 4 years ago

Yes, I would be very interested in a timeline too. Even if it would be very vague. I could do some testing if that would somehow help?

Thanks again for the awesome software!

Aircoookie commented 4 years ago

Hi, thank you! I'm glad to hear that the multi-pin support is in high demand! Can't promise anything right now, but very likely in software selectable LED pin in early and multiple strips in late April!

PaulNBerlin commented 4 years ago

Hi @Aircoookie, will your multi strip approach also support different types of led strips controlled by the same esp? E.g. Led Pixel Lights (RGB in my case) and LED strips (GRB in my case)?

Would be great if they can be connected in row using a single data wire.

sjude68 commented 4 years ago

Hi @Aircoookie, will your multi strip approach also support different types of led strips controlled by the same esp? E.g. Led Pixel Lights (RGB in my case) and LED strips (GRB in my case)?

image

Would be great if they can be connected in row using a single data wire.

Yes. I have used it my led strip and connected the one you showed

PaulNBerlin commented 4 years ago

Hi @sjude68, I can connect but the collors are wrong image

sjude68 commented 4 years ago

Yes @PaulNBerlin the color is different because that strip uses Rgb color coding. I faced the same problem and posted the query. Something to do with segments. There should be way to in next segment.

Xeyk commented 4 years ago

Hi Mr. Aircoookie. Did you need any help testing this or coding help on this? Please let me know.

Aircoookie commented 4 years ago

@Xeyk thank you for offering your help! I will let you know once I have something to work with :) Here is what I'm working on, if you are interested: https://gist.github.com/Aircoookie/974ef271fa9b73db45aebc5199302ee5 But it's not yet in a state where it would be useful, there is still quite a bit to do

grainz commented 4 years ago

I just started with WLED yesterday to experiment with RGB in my PC with fans and strips. They use WS2812B. Having the ability to interact with each device on their own would be a great feature. I've been reading up on shift registers for more GPIO but this doesn't seem to apply to SPI type devices. I look forward to see how this progresses! Thank you for the great software!

jordanadania commented 4 years ago

Anyone know why Ninja's solution won't work for me? I get the error: CRGB does not define a type

Aircoookie commented 4 years ago

@jordanadania have you compiled WLED without modifications successfully? You might not have the FastLED library installed yet.

jordanadania commented 4 years ago

i definitely have fastled installed and have compiled wled without mod and with mod. this is my only issue so far. your code is flawless. even the most recent commits work for me. i just can NOT figure out multiple strips under this setup. I run 1200 leds on fastled using parallel output. I have a pre-soldered board where I connect all these leds to pins 6,7,5 and 8 as is the 8266 parallel output order and can't be changed afaik.

Aircoookie commented 4 years ago

@jordanadania looked at the above modification again, probably in FX_fcn.cpp the #include "FX.h" is below the pasted-in code, it needs to remain at the very top. That might be the issue.

Configurable multi-pin output will be the main feature of v0.12.0, the next major version after 0.11.0 where filesystem support will be added.

Aircoookie commented 4 years ago

Ahh, great, above code is of course outdated 😅 Try this init (no guarantee from me that it will work!)

void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst)
{
  if (supportWhite == _useRgbw && countPixels == _length && _skipFirstMode == skipFirst) return;
  RESET_RUNTIME;
  _useRgbw = supportWhite;
  _length = countPixels;
  _skipFirstMode = skipFirst;

  uint8_t ty = 1;
  if (supportWhite) ty = 2;
  _lengthRaw = _length;
  if (_skipFirstMode) {
    _lengthRaw += LED_SKIP_AMOUNT;
  }

  bus->Begin((NeoPixelType)ty, _lengthRaw);

  _segments[0].start = 0;
  _segments[0].stop = _length;

  setBrightness(_brightness);

#ifdef Use_FastLED

    //Pointer to NeoPixelBus led array  
    leds = (CRGB*)bus->GetPixels(); //GetPixels function added to "NpbWrapper.h"

    // tell FastLED there's 284 NEOPIXEL leds on pin 12, starting at index 0 in the led array
    FastLED.addLeds<LED_TYPE, 12, COLOR_ORDER>(leds, 0, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);

    // tell FastLED there's 284 NEOPIXEL leds on pin 14, starting at index 284 in the led array
    FastLED.addLeds<LED_TYPE, 14, COLOR_ORDER>(leds, 1 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);

    // tell FastLED there's 284 NEOPIXEL leds on pin 27, starting at index 568 in the led array
    FastLED.addLeds<LED_TYPE, 27, COLOR_ORDER>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);

    // tell FastLED there's 284 NEOPIXEL leds on pin 26, starting at index 852 in the led array
    FastLED.addLeds<LED_TYPE, 26, COLOR_ORDER>(leds, 3 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);
#endif // Use_FastLED
}
jordanadania commented 4 years ago

This function is added into "NpbWrapper.h"

uint8_t* GetPixels() { return _pGrb->Pixels(); }

Says I can't overload that function. You must have added it since?

jordanadania commented 4 years ago

Yeah, I am getting crazy random colors after updating LED count. On startup, the first 30 were correct.

WLED_GLOBAL uint16_t ledCount _INIT(NUM_LED*NUM_STRIPS); // overcurrent prevented by ABL

Aircoookie commented 4 years ago

You must have added it since? Yes, albeit unused.

Try rebooting, it will re-initialize everything, then it might work (weird, the pointer should get updated every time the LED count is updated)

jordanadania commented 4 years ago

After upload, I had to change led count in LED preferences again. then save. then reboot. works perfect. THANK YOU!

robinzelders commented 4 years ago

I tried to use multiple strips using @N1nja98 's code. On boot the two strips do indeed light up but checking the serial monitor it shows the following. Does anyone know what happens or even better how to fix it?

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
Ada
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4008570e  PS      : 0x00050031  A0      : 0x40084d40  A1      : 0x3ffbe7a0  
A2      : 0x00000019  A3      : 0x00000000  A4      : 0x00000001  A5      : 0x02000000  
A6      : 0x02000000  A7      : 0x00060623  A8      : 0x3ff56000  A9      : 0x3ffba264  
A10     : 0x00000015  A11     : 0x3ffbd6b0  A12     : 0x00060023  A13     : 0x3ffbc2b0  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000007  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000014  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
Core 1 was running in ISR context:
EPC1    : 0x4008570e  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x400873c1

Backtrace: 0x4008570e:0x3ffbe7a0 0x40084d3d:0x3ffbe7d0 0x4017aa97:0x3ffbc740 0x4010497e:0x3ffbc760 0x4008b875:0x3ffbc780 0x4008a091:0x3ffbc7a0

Rebooting...
ets Jun  8 2016 00:22:57
robinzelders commented 4 years ago

I tried to use multiple strips using @N1nja98 's code. On boot the two strips do indeed light up but checking the serial monitor it shows the following. Does anyone know what happens or even better how to fix it?

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
Ada
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4008570e  PS      : 0x00050031  A0      : 0x40084d40  A1      : 0x3ffbe7a0  
A2      : 0x00000019  A3      : 0x00000000  A4      : 0x00000001  A5      : 0x02000000  
A6      : 0x02000000  A7      : 0x00060623  A8      : 0x3ff56000  A9      : 0x3ffba264  
A10     : 0x00000015  A11     : 0x3ffbd6b0  A12     : 0x00060023  A13     : 0x3ffbc2b0  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000007  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000014  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
Core 1 was running in ISR context:
EPC1    : 0x4008570e  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x400873c1

Backtrace: 0x4008570e:0x3ffbe7a0 0x40084d3d:0x3ffbe7d0 0x4017aa97:0x3ffbc740 0x4010497e:0x3ffbc760 0x4008b875:0x3ffbc780 0x4008a091:0x3ffbc7a0

Rebooting...
ets Jun  8 2016 00:22:57

That is on my ESP32 on my ESP8266 I get:

Exception (28):
epc1=0x4000bdc8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffd20 end: 3fffffc0 offset: 01a0
3ffffec0:  00000000 3fffdad0 3fff0fac 3fff0db4  
3ffffed0:  3fffff30 3fffff3c 00000000 40220e1f  
3ffffee0:  00000050 3fffc6fc 00000000 3fff0bab  
3ffffef0:  00000003 3fff0d88 3fff041c 3fffff3c  
3fffff00:  3fffff30 00000050 3fff0db4 40220e8a  
3fffff10:  3ffe9924 3fffff30 3ffe9920 3fff0bab  
3fffff20:  3ffe9924 3ffe9920 3fff0db4 40214004  
3fffff30:  00706374 df01a8c0 83c6a7f0 64656c77  
3fffff40:  3fff4000 8421ad40 40100af4 3fff0fac  
3fffff50:  3fff0bb1 00000000 3fff0188 40214286  
3fffff60:  00000000 a0aa6235 3fff0100 3fff0fac  
3fffff70:  00000000 00000000 3fff0188 3fff0fac  
3fffff80:  3fffdad0 00000000 3fff0188 402142f9  
3fffff90:  3fffdad0 00000000 3fff0f6c 40214bc0  
3fffffa0:  feefeffe feefeffe feefeffe 40227f54  
3fffffb0:  feefeffe feefeffe 3ffe87f0 4010088d  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1392, room 16 
tail 0
chksum 0xd0
csum 0xd0
v3d128e5c
~ld

Which decodes to: Exception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads PC: 0x4000bdc8 EXCVADDR: 0x00000000

But still, no idea what that means exactly

N1nja98 commented 4 years ago

Not sure if this mod works on ESP8266. I've only used it on ESP32. I've since had to modify some code after some updates. I've had to change #define PIXELMETHOD NeoEsp32Rmt0Ws2812xMethod to //#define PIXELMETHOD NeoEsp32Rmt0Ws2812xMethod #define PIXELMETHOD NeoWs2813Method in NpbWrapper.h

PaulNBerlin commented 4 years ago

Hello @Aircoookie,

I would like to know in which direction the development regarding this issue will go. In my opinion there are 2 options:

  1. Controlling multiple types of strips using multiple output pins of the esp
  2. Controlling multiple types of stript using 1 output pins + segments (e.g. first segment uses GRB color and second RGB color) --> This option would result in only 1 data wire.

Thanks Paul

robinzelders commented 4 years ago

Not sure if this mod works on ESP8266. I've only used it on ESP32. I've since had to modify some code after some updates. I've had to change #define PIXELMETHOD NeoEsp32Rmt0Ws2812xMethod to //#define PIXELMETHOD NeoEsp32Rmt0Ws2812xMethod #define PIXELMETHOD NeoWs2813Method in NpbWrapper.h

Still get the same error unfortunately

jordanadania commented 4 years ago

It works perfectly on the 8266. Robinzelders error sounds like out of range. Either and array went too far or a variable like uint8_t went beyond 255. Check for something like that.

robinzelders commented 4 years ago

I only get the error if I use FastLED.show() instead of bus->Show(); I assume the problem might be there. FastLED.clear() instead of FastLED.show() works fine, so I guess misaligned data between NeoPixel and FastLED?

Is it because something has changed in V0.10.0 or does it work on that version for you guys as well?

jordanadania commented 4 years ago

Can I see your init?

robinzelders commented 4 years ago

Switched to the Arduino IDE and now it works on my ESP2866 but still not on my ESP32

robinzelders commented 4 years ago

Can I see your init?

void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst)
{
  if (supportWhite == _useRgbw && countPixels == _length && _skipFirstMode == skipFirst) return;
  RESET_RUNTIME;
  _useRgbw = supportWhite;
  _length = countPixels;
  _skipFirstMode = skipFirst;

  uint8_t ty = 1;
  if (supportWhite) ty = 2;
  _lengthRaw = _length;
  if (_skipFirstMode) {
    _lengthRaw += LED_SKIP_AMOUNT;
  }

  bus->Begin((NeoPixelType)ty, _lengthRaw);

  _segments[0].start = 0;
  _segments[0].stop = _length;

  setBrightness(_brightness);
#ifdef Use_FastLED

  //Pointer to NeoPixelBus led array
  leds = (CRGB*)bus->GetPixels(); //GetPixels function added to "NpbWrapper.h"

  // tell FastLED there's 284 NEOPIXEL leds on pin 12, starting at index 0 in the led array
  FastLED.addLeds<LED_TYPE, 2, COLOR_ORDER>(leds, 0, 165).setCorrection(TypicalLEDStrip);

  // tell FastLED there's 284 NEOPIXEL leds on pin 14, starting at index 284 in the led array
  FastLED.addLeds<LED_TYPE, 3, COLOR_ORDER>(leds, 165, 42).setCorrection(TypicalLEDStrip);

#endif // Use_FastLED
}
robinzelders commented 4 years ago

Also I get the following error in my compiler when trying to upload to the ESP32 in Arduino IDE. Maybe this is the problem, any idea how to fix this?

Sketch uses 1375524 bytes (104%) of program storage space. Maximum is 1310720 bytes.
text section exceeds available space in board
Global variables use 56996 bytes (17%) of dynamic memory, leaving 270684 bytes for local variables. Maximum is 327680 bytes.
Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
Error compiling for board DOIT ESP32 DEVKIT V1.
N1nja98 commented 4 years ago

@robinzelders I just tried updating mod with latest WLED code and received the same LoadProhibited exception. The latest working version I have is v0.9.0-b1. I’ll have to figure out what changed in newer code. If you still want it I can post the full list of mods necessary to get it working on ESP32.

robinzelders commented 4 years ago

@N1nja98 That would be great actually, I was rewriting the code myself but to no avail.

bjornbergenheim commented 4 years ago

I'm trying this as well, and I'm also seeing the same problems. So go N1nja98!

N1nja98 commented 4 years ago

Update:

The latest working version I have is this commit: https://github.com/Aircoookie/WLED/commit/a4e093159e788f60a1d0d9eabace51331ff92f07 made on May 24, 2020. WLED 0.10.0

Here are the mods I had to make:

This is placed at the top of "FX_fcn.cpp" under the include statements:

//toggle for multi-strip
#define Use_FastLED //FastLED already included in FX.h

#ifdef Use_FastLED

#define LED_TYPE    WS2812B
#define COLOR_ORDER RGB //Actually GRB. Explained later.
#define NUM_STRIPS 4
#define NUM_LEDS_PER_STRIP 284
//#define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS

CRGB* leds;
#endif // Use_FastLED

This is placed in same file in at the bottom of "WS2812FX::init" right under setBrightness(_brightness);:

//An example for driving 1136 leds in four different strips with 284 leds in each.
#ifdef Use_FastLED

        //Pointer to NeoPixelBus led array  
        leds = (CRGB*)bus->GetPixels(); //GetPixels function added to "NpbWrapper.h"

    // tell FastLED there's 284 NEOPIXEL leds on pin 12, starting at index 0 in the led array
    FastLED.addLeds<LED_TYPE, 12, COLOR_ORDER>(leds, 0, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);

    // tell FastLED there's 284 NEOPIXEL leds on pin 14, starting at index 284 in the led array
    FastLED.addLeds<LED_TYPE, 14, COLOR_ORDER>(leds, 1 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);

    // tell FastLED there's 284 NEOPIXEL leds on pin 27, starting at index 568 in the led array
    FastLED.addLeds<LED_TYPE, 27, COLOR_ORDER>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);

    // tell FastLED there's 284 NEOPIXEL leds on pin 26, starting at index 852 in the led array
    FastLED.addLeds<LED_TYPE, 26, COLOR_ORDER>(leds, 3 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);
#endif // Use_FastLED

bus->Show() in same file at bottom of "WS2812FX::show" is replaced with:

#ifndef Use_FastLED
    bus->Show();
#else
    FastLED.show();
#endif // Use_FastLED

This function is added into "NpbWrapper.h" unless it's already included in your version.

uint8_t* GetPixels() 
  {
      return _pGrb->Pixels();
  }

#define PIXELMETHOD NeoEsp32Rmt0Ws2812xMethod on line 56 in "NpbWrapper.h" is replaced with:

#define PIXELMETHOD NeoWs2813Method
//#define PIXELMETHOD NeoEsp32Rmt0Ws2812xMethod

Version number NeoPixelBus@2.5.7 on line 162 in "platformio.ini" is changed to NeoPixelBus@2.5.1

Version number Esp Async WebServer@1.2.0 on line 166 in "platformio.ini" is changed to Esp Async WebServer@1.2.2

Version number platform = espressif32@1.11.1 on line 233 in "platformio.ini" is changed to platform = espressif32@1.7.0

I use VS Code with PlatformIO for compiling and uploading. Here is the full version of the modified code. Let me know if it works for you.

WLED Multi-Strip Mod.zip

This works on WLED 0.10.0 up to the following commit:https://github.com/Aircoookie/WLED/commit/a4e093159e788f60a1d0d9eabace51331ff92f07

bjornbergenheim commented 4 years ago

Cool, before I go and change git around into your version, have you tried head and not get it to work? Also, the pin definition in NpbWrapper_h #define LEDPIN 2 How does that pin play into the pins defined in the WS2812FX::init method?