1

I'm trying to adapt the MeteorRain animation from Tweaking4All to work on segments of my light string (vs using the entire string) and I'm getting an error in FastLED.show() (on a line that is used repeatedly with the same variables before it crashes the "ESP32 DEVKIT V1"). The decode of the ESP32 shows an error in clockless_rmt_esp32.h (which is about as far as I have visibility and ability to troubleshoot the problem.)

Looking through Google results, I find people who have the same error, usually related to memory allocation, but I can't make a connection to FastLED.

The code:

#define FASTLED_INTERNAL // add this before including FastLED.h
#include <FastLED.h>

#define LED_PIN     12
#define COLOR_ORDER RGB
#define CHIPSET     WS2811
#define PIXELSECTIONS 2     // there are two segments of christmas lights
#define HORZPIXELS 5        // with 5 lights across connected to
#define VERTPIXELS 12       // 7 lights that hang vertically
#define NUM_LEDS (HORZPIXELS + VERTPIXELS) * PIXELSECTIONS
#define NUM_COLS PIXELSECTIONS
#define NUM_ROWS VERTPIXELS + HORZPIXELS
#define BRIGHTNESS  50

CRGB rawleds[NUM_LEDS];
CRGBSet leds(rawleds, NUM_LEDS);

unsigned long animationsCycleStartTime = millis();
int genericCounter=0;

void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(115200);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500); 

  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(rawleds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness( BRIGHTNESS );
}

void loop() {  
   meteorRain(0xff,0xff,0xff,10, 64, true, 30); 
}

void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {  

  int metaNUM_LEDS = (HORZPIXELS + VERTPIXELS);
  for(int i = 0; i < metaNUM_LEDS+metaNUM_LEDS; i++) {
   
    // fade brightness all LEDs one step
    for(int j=0; j<metaNUM_LEDS; j++) {
      if( (!meteorRandomDecay) || (random(10)>5) ) {
        metaFadeToBlack(j, meteorTrailDecay );        
      }
    }
   
    // draw meteor
    for(int j = 0; j < meteorSize; j++) {
      if( ( i-j <metaNUM_LEDS) && (i-j>=0) ) {
Serial.print("i=" + String(i) + ";j=" + String(j) + ";i-j=" + String(i-j));
        metaSetPixel(i-j, red, green, blue);
Serial.println(" done");
      }
    }
Serial.println("to show");
    FastLED.show();
Serial.println("to wait");
    delay(SpeedDelay);
  }
  genericCounter = (genericCounter>=PIXELSECTIONS) ? 0 : genericCounter+1 ;
}

void fadeToBlack(int ledNo, byte fadeValue) {
 #ifdef ADAFRUIT_NEOPIXEL_H
    // NeoPixel
    uint32_t oldColor;
    uint8_t r, g, b;
    int value;
   
    oldColor = strip.getPixelColor(ledNo);
    r = (oldColor & 0x00ff0000UL) >> 16;
    g = (oldColor & 0x0000ff00UL) >> 8;
    b = (oldColor & 0x000000ffUL);

    r=(r<=10)? 0 : (int) r-(r*fadeValue/256);
    g=(g<=10)? 0 : (int) g-(g*fadeValue/256);
    b=(b<=10)? 0 : (int) b-(b*fadeValue/256);
   
    strip.setPixelColor(ledNo, r,g,b);
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   leds[ledNo].fadeToBlackBy( fadeValue );
 #endif  
}

// this method transposes the relative pixel to the actual pixel
// for example, on the second pass of loop the code says to use
// pixels 0-16 but since the genericCounter is at 1 this method 
// activates pixels 17-33
void metaSetPixel(int metaPixel, byte red, byte green, byte blue) {
  int actualPixel = (genericCounter * (HORZPIXELS + VERTPIXELS)) + metaPixel;
  setPixel( actualPixel, red, green, blue);
}

void metaFadeToBlack (int metaPixel, byte meteorTrailDecay) {
  int actualPixel = (genericCounter * (HORZPIXELS + VERTPIXELS)) + metaPixel;  
  fadeToBlack(actualPixel, meteorTrailDecay );
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
   // FastLED
   rawleds[Pixel].r = red;
   rawleds[Pixel].g = green;
   rawleds[Pixel].b = blue;
}

void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i < NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue);
  }
  FastLED.show();
}

The raw error from Serial console trace:

13:50:53.499 -> ⸮⸮�⸮�⸮⸮⸮�@#P#⸮N⸮1h⸮0,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
13:50:53.499 -> mode:DIO, clock div:1
13:50:53.499 -> load:0x3fff0018,len:4
13:50:53.499 -> load:0x3fff001c,len:1044
13:50:53.499 -> load:0x40078000,len:10124
13:50:53.499 -> load:0x40080400,len:5856
13:50:53.499 -> entry 0x400806a8
13:50:55.042 -> i=0;j=0;i-j=0 done
13:50:55.042 -> to show
13:50:55.076 -> to wait
13:50:55.076 -> i=1;j=0;i-j=1 done
13:50:55.076 -> i=1;j=1;i-j=0 done
13:50:55.076 -> to show
13:50:55.110 -> to wait
...[snip]...
13:51:01.299 -> to show
13:51:01.299 -> to wait
13:51:01.334 -> i=0;j=0;i-j=0 done
13:51:01.334 -> to show
13:51:01.334 -> /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:1443 (xQueueGenericReceive)- assert failed!
13:51:01.334 -> abort() was called at PC 0x40085e41 on core 1
13:51:01.334 -> 
13:51:01.334 -> ELF file SHA256: 0000000000000000
13:51:01.334 -> 
13:51:01.334 -> Backtrace: 0x40084e74:0x3ffb1df0 0x400850e9:0x3ffb1e10 0x40085e41:0x3ffb1e30 0x400d1371:0x3ffb1e70 0x400d171d:0x3ffb1e90 0x400d1801:0x3ffb1ed0 0x400d11bb:0x3ffb1f10 0x400d125b:0x3ffb1f80 0x400d2231:0x3ffb1fb0 0x400860f9:0x3ffb1fd0
13:51:01.372 -> 
13:51:01.372 -> Rebooting...
13:51:01.372 -> ets Jun  8 2016 00:22:57
13:51:01.372 -> 
13:51:01.372 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
13:51:01.372 -> configsip: 0, SPIWP:0xee
13:51:01.372 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
13:51:01.372 -> mode:DIO, clock div:1
13:51:01.372 -> load:0x3fff0018,len:4
13:51:01.408 -> load:0x3fff001c,len:1044
13:51:01.408 -> load:0x40078000,len:10124
13:51:01.408 -> load:0x40080400,len:5856
13:51:01.408 -> entry 0x400806a8

The decoded error:

Decoding stack results
0x40084e74: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 156
0x400850e9: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 171
0x40085e41: xQueueGenericReceive at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 1443
0x400d1371: ClocklessController12, 77, 77, 154, (EOrder)10, 0, false, 5>::showPixels(PixelController(EOrder)10, 1, 4294967295u>&) at /Users/jaireaux/Documents/Arduino/libraries/FastLED/platforms/esp/32/clockless_rmt_esp32.h line 288
0x400d171d: CPixelLEDController(EOrder)10, 1, 4294967295u>::show(CRGB const*, int, CRGB) at /Users/jaireaux/Documents/Arduino/libraries/FastLED/controller.h line 408
0x400d1801: CFastLED::show(unsigned char) at /Users/jaireaux/Documents/Arduino/libraries/FastLED/controller.h line 90
0x400d11bb: meteorRain(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, bool, int) at /Users/jaireaux/Documents/Arduino/libraries/FastLED/FastLED.h line 500
0x400d125b: loop() at /Users/jaireaux/Documents/Arduino/temp/temp.ino line 33
0x400d2231: loopTask(void*) at /Users/jaireaux/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/cores/esp32/main.cpp line 23
0x400860f9: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.