Closed Jfox99 closed 4 years ago
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.
Hardware: Board: DOIT ESP32 DEVKIT V1 Core Installation version: 1.0.4 IDE name: Arduino IDE Flash Frequency: 80Mhz Upload Speed: 115200 Computer OS: Windows 10 PRO
Description: Hi guys I'm using blynk with the menu interface tool to select various patterns for my ws2812b led strip. The problem is that with one particular pattern, the music reactive pattern, the ESP crashes, reporting then the guru meditation error (LoadProhibited). With the other patterns I don't have any issue. Flashing only the music reactive void the code runs great without problems. I've tried to increase stack in the main.cpp but same results
Sketch:
include
include
include
include
char auth[] = "***";
// Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "***"; char pass[] = "**";
// LED LIGHTING SETUP
define DATA_PIN 4
define NUM_LEDS 60
define LED_TYPE WS2812B
define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
define UPDATES_PER_SECOND 100
// AUDIO INPUT SETUP int audio = 34; //other variables int mapDiv; int audio_input; int audmap; //voids void solid(); void rainbow(); void sinelon(); void music_reactive(); typedef void (*SimplePatternList[])(); SimplePatternList gPatterns = { solid, rainbow, music_reactive , sinelon }; uint8_t gHue = 0; // rotating "base color" used by many of the patterns
// define custom variables to hold incoming data from Blynk widgets uint8_t sliderBrightness; //output: V1, slider uint8_t zeRGBa[3]; //output: V2, zeRGBa data (set to "merge") boolean buttonA; //output: V3, button (set as "switch") uint8_t pattern; //output: V4, current pattern number uint8_t sliderDivider; //output: V5, slider
// STANDARD VISUALIZER VARIABLES int midway = NUM_LEDS / 2; // CENTER MARK FROM DOUBLE LEVEL VISUALIZER int loop_max = 0; int k = 255; // COLOR WHEEL POSITION int decay = 0; // HOW MANY MS BEFORE ONE LIGHT DECAY int decay_check = 0; long pre_react = 0; // NEW SPIKE CONVERSION long react = 0; // NUMBER OF LEDs BEING LIT long post_react = 0; // OLD SPIKE CONVERSION
// RAINBOW WAVE SETTINGS int wheel_speed = 1;
//BLYNK//
BLYNK_WRITE(V1) //slider value 0-255 { sliderBrightness = param.asInt(); // assigning incoming value from pin V1 to a variable }
BLYNK_WRITE(V2) //set as "merge" in zeRGBa widget { zeRGBa[0] = param[0].asInt(); //red zeRGBa[1] = param[1].asInt(); //green zeRGBa[2] = param[2].asInt(); //blue }
BLYNK_WRITE(V3) //toggles pixel display On/Off, set as "switch" { buttonA = param.asInt(); //value is either 0 or 1 }
BLYNK_WRITE(V4) { switch (param.asInt()) { case 1: { pattern = 1; //rainbow break; } case 2: { pattern = 2; //music reactive rainbow break; } case 3: { pattern = 3; //sinelon (color selected by zeRGBa picker) break; } case 4: { pattern = 0; //solid (color selected by zeRGBa picker) break; } default: pattern = 0; //run if no pattern selected } }
BLYNK_WRITE(V5) //slider value { sliderDivider = param.asInt(); // assigning incoming value from pin V5 to a variable }
void setup() { // LED LIGHTING AND BLYNK SETUP Serial.begin(9600); Blynk.begin(auth, ssid, pass); FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
// CLEAR LEDS for (int i = 0; i < NUM_LEDS; i++) leds[i] = CRGB(0, 0, 0); FastLED.show();
// SERIAL AND INPUT SETUP Serial.begin(115200); pinMode(audio, INPUT); Serial.println("\nListening..."); }
// FUNCTION TO GENERATE COLOR BASED ON VIRTUAL WHEEL // https://github.com/NeverPlayLegit/Rainbow-Fader-FastLED/blob/master/rainbow.ino CRGB Scroll(int pos) { pos = abs(pos); CRGB color (0, 0, 0); if (pos < 85) { color.g = 0; color.r = ((float)pos / 85.0f) 255.0f; color.b = 255 - color.r; } else if (pos < 170) { color.g = ((float)(pos - 85) / 85.0f) 255.0f; color.r = 255 - color.g; color.b = 0; } else if (pos < 256) { color.b = ((float)(pos - 170) / 85.0f) * 255.0f; color.g = 255 - color.b; color.r = 1; }
return color; }
void loop() { Blynk.run(); EVERY_N_MILLISECONDS(10) { if (buttonA == 1) { //strip is ON. gPatterns[pattern]();
}//end_EVERY_N
EVERY_N_MILLISECONDS( 20 ) { gHue++; // slowly cycle the "base color" through the rainbow }
}//end_main_loop
void rainbow() { // FastLED's built-in rainbow generator fill_rainbow( leds, NUM_LEDS, gHue, NUM_LEDS / 8); }
void music_reactive() { audio_input = analogRead(audio); audmap = map(audio_input, 0, 1800, 0, 1023); mapDiv=map(sliderDivider,0,254,1000,3000);
if (audmap > 0) { pre_react = ((long)NUM_LEDS * (long)audmap) / mapDiv; // TRANSLATE AUDIO LEVEL TO NUMBER OF LEDs
}
k = k - wheel_speed; // SPEED OF COLOR WHEEL if (k < 0) // RESET COLOR WHEEL k = 255;
for (int i = NUM_LEDS; i >= midway; i--) { if (i < react + midway) {
} FastLED.show();
//REMOVE LEDs decay_check++; if (decay_check > decay) { decay_check = 0; if (react > 0) react--; } delay(1); }
void sinelon() { // a colored dot sweeping back and forth, with fading trails fadeToBlackBy( leds, NUM_LEDS, 15); int pos = beatsin16( 13, 0, NUM_LEDS - 1 ); leds[pos] += CRGB(zeRGBa[0], zeRGBa[1], zeRGBa[2]); }
void solid() { // fill entire strip with a solid color fill_solid(leds, NUM_LEDS, CRGB(zeRGBa[0], zeRGBa[1], zeRGBa[2]) ); }
Debug Messages: Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled. Core 1 register dump: PC : 0x4013f07e PS : 0x00060630 A0 : 0x800d188f A1 : 0x3ffb3f10
A2 : 0x3f000000 A3 : 0x00000000 A4 : 0x00004dc4 A5 : 0x00007540
A6 : 0x00000001 A7 : 0x00007776 A8 : 0x00000000 A9 : 0x3ffb3ef0
A10 : 0x00000081 A11 : 0x00000000 A12 : 0x00004dc4 A13 : 0x00007880
A14 : 0x00000000 A15 : 0x00000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000081 LBEG : 0x400d45a1 LEND : 0x400d45ad LCOUNT : 0x00000000
Backtrace: 0x4013f07e:0x3ffb3f10 0x400d188c:0x3ffb3f30 0x400d1f05:0x3ffb3f50 0x400d2323:0x3ffb3f90 0x400d5781:0x3ffb3fb0 0x40088f49:0x3ffb3fd0
Rebooting...
Backtrace decode: Decoding stack results 0x4013f07e: BlynkArduinoClientGen ::disconnect() at C:\Users\IonPo\Documents\Arduino\libraries\Blynk\src/Adapters/BlynkArduinoClient.h line 68 0x400d188c: BlynkProtocol >::internalReconnect() at C:\Users\IonPo\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkProtocol.h line 99 0x400d1f05: BlynkProtocol >::run(bool) at C:\Users\IonPo\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkProtocol.h line 187 0x400d2323: loop() at C:\Users\IonPo\Desktop\music_reactive_leds_blynkv3/music_reactive_leds_blynkv3.ino line 145 0x400d5781: loopTask(void*) at C:\Users\IonPo\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32\main.cpp line 19 0x40088f49: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143
music_reactive_leds_blynkv3.zip