Anyone using my clone of FastLED for ESP32 support: please pull the latest version.

Anyone using my clone of FastLED for ESP32 support: please pull the latest version. I fixed a few subtle errors in the synchronization code that could cause problems for parallel output (the default), particularly if the strips are of different lengths.

https://github.com/samguyer/FastLED

Thanks @Sam_Guyer , I was getting some random crashes on my hat, it has 4 strips of 74 SK9822s (296 in total), but it seems rock solid now :)))

@Jeremy_Spencer Glad to hear that!

@Sam_Guyer , I’ve got some kind of conflict between running FastLED on core 0 and the MPU9250 code that I’m using.

If I run FastLED on core 0 I get random data from the MPU9250.

If I run FastLED on core 1, the MPU9250 works perfectly.

What are the downsides to running FastLED on core1?

Can you suggest any better fixes?

The MPU9250 sketch is here

https://github.com/kriswiner/ESP32/blob/master/MPU9250_MS5637/MPU9250_MS5637_AHRS.ino

I use this version of the wire.h and wire.cpp in the sketch folder as there are still issues with the I2C code on the main release.

https://github.com/stickbreaker/arduino-esp32/tree/master/libraries/Wire

Thank you for all of your hard work on this :slight_smile:

@Jeremy_Spencer That’s interesting. It sounds like an interrupt conflict issue – or maybe an interrupt priority issue. Many of the libraries for accelerometers and gyros using interrupts to signal a change in the orientation. One option would be to use polling instead of interrupts if the latency is not super-important for your application.

I don’t think there is any major problem with running the ESP32 FastLED support on Core 1. I used Core 0 mainly because it avoids conflicts with the WiFi support, and because it otherwise goes unused!

I’ll take a look at that library and see if anything jumps out at me.

@Sam_Guyer Thank you, I’ll have a look through for interupts. I haven’t added any.

@Jeremy_Spencer The library itself uses an interrupt to find out when new data is available. But that shouldn’t cause any major problems.

@Sam_Guyer Stickbreaker has updated his fork of the ESP32 core, with more I2C improvements and all of the changes from the main core.

FastLED now runs on core 0 while running an I2C accelerometer :)))

https://github.com/stickbreaker/arduino-esp32

@Jeremy_Spencer Sweet! That’s great news

Stupendous, thanks.
Which example can I use to connect 6000 LEDs with 6 outputs?
I do not use the radio part.
DemoReelESP32 it is very complex.

Red and green are exchanged.
Be used “leds[i] = CRGB::Red” or “leds[i] = CRGB( 255, 0, 0)”
https://pastebin.com/SzN4Th6E

@Giorgio_GEVA , run this example to determine and set the RGB order for your particular strips.

@Jeremy_Spencer This code not compile if i don’t add “FASTLED_USING_NAMESPACE”
Color is, first led green, two led red, last 3 leds blue.

I have another serious problem that is all day that I can not solve.

This function crash library:
void DrawCubetto( int Pos, CRGB Col){
for( int f = 0; f < 25; f++){
if( f < 7 ) leds[Pos+f] += (Col % (255/(7-f)));
else if( f > 17 ) leds[Pos+f] += (Col % (255/(f-18)));
else leds[Pos+f] += Col;
}
}

At the beginning I thought it was the % function
I rewrote the function but crashes the same.
It can be a color combination that crashes

Same function work well with arduino zero SAMD

Also this crash library:
void loop()
{
for( int f = 0; f < 255; f++){
leds[f] = CRGB(f, f, f);
}
delay(1000);
FastLED.show();
FastLED.clearData();
delay(1000);
FastLED.show();
}

Define your LEDs as GRB, that’ll solve the colour mix up.

From your gist, it looks like you only have 80 LEDs. If you try to write data to more than 80, the MCU will crash.

@Giorgio_GEVA and you’ve got a divide by zero error in this line if f=18
else if( f > 17 ) leds[Pos+f] += (Col % (255/(f-18)));

@Jeremy_Spencer No, i Have 500 led, this not crash:
void loop()
{
for( int f = 0; f < 160; f++){
leds[f] = CRGB(f, f, f);
}
delay(100);
FastLED.show();
FastLED.clearData();
delay(100);
FastLED.show();
}

for( int f = 0; f < 170; f++){ Crash

The previous function wrote 25 LEDs
Crash if I define 500leds, 100leds

These are some RGB values ​​that send incrash

I can not use GRB, I will try to study.
I have always used CRGB with SAMD

This code, 160 not crash, 170 crash.
If I do not solve in the week I’m in trouble.

https://pastebin.com/ev7mZD1N

Perhaps, it first crashed by division by zero, and then by too much current on the LEDs. I’m investigating.