I've been working on a LED strip lately trying to create all kinds of animations. But one of them has caused quite a lot of trouble. It's meant to be a kind of firework.
It usually runs once and when the loop starts a second time the following error comes up exactly the same time.
Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400eae48 PS : 0x00060330 A0 : 0x800d133a A1 : 0x3ffb1f30
A2 : 0x0000000e A3 : 0xbffc0553 A4 : 0x9999999a A5 : 0xbfb99999
A6 : 0x7ff00000 A7 : 0x80671eb4 A8 : 0x0000000d A9 : 0x0000000e
A10 : 0x00000001 A11 : 0x00000000 A12 : 0x0000000d A13 : 0x0000000d
A14 : 0x00000039 A15 : 0x00000000 SAR : 0x00000020 EXCCAUSE: 0x0000001d
EXCVADDR: 0xbffc0553 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff
Backtrace: 0x400eae48:0x3ffb1f30 0x400d1337:0x3ffb1f50 0x400d137d:0x3ffb1f90 0x400d23b1:0x3ffb1fb0 0x40088535:0x3ffb1fd0
using the ESP Exception Decode gave the following result:
PC: 0x400eae48: hsv2rgb_rainbow(CHSV const&, CRGB&) at C:UsersTomDocumentsArduinolibrariesFastLED-3.4.0srchsv2rgb.cpp line 492
EXCVADDR: 0xbffc0553
Decoding stack results
0x400eae48: hsv2rgb_rainbow(CHSV const&, CRGB&) at C:UsersTomDocumentsArduinolibrariesFastLED-3.4.0srchsv2rgb.cpp line 492
0x400d1337: feuerwerk() at C:UsersTomDocumentsArduinolibrariesFastLED-3.4.0src/pixeltypes.h line 181
0x400d137d: loop() at C:UsersTomDesktopfastledtest/fastledtest.ino line 109
0x400d23b1: loopTask(void*) at C:UsersTomDocumentsArduinoDatapackagesesp32hardwareesp321.0.4coresesp32main.cpp line 19
0x40088535: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143
This is my function where the error has to be:
void feuerwerk() {
float gravity = 0.004;
float pos = 0;
float minmax = 0.3;
float vel = random16(sqrt((NUM_LEDS * minmax) * (2 * gravity)) * 1000, sqrt((NUM_LEDS * (1 - minmax)) * (2 * gravity)) * 1000);
vel = vel / 1000;
float startvel = vel;
uint8_t brightness = 200;
if(random8(2) == 1) {
while (vel >= -0.075) {
pos += vel;
pos = constrain(pos, 0, NUM_LEDS - 1);
vel -= gravity;
leds[int(pos)].setHSV(0, 0, brightness);
if (vel >= 1) {
leds[int(pos) - 1].setHSV(0, 0, brightness);
}
if(int(pos) % 3 == 0) brightness--;
fadeToBlackBy(leds, NUM_LEDS, 18);
FastLED.show();
}
}
else {
while (vel >= -0.2) {
pos += vel;
pos = constrain(pos, 0, NUM_LEDS - 1);
vel -= gravity;
leds[NUM_LEDS - int(pos)].setHSV(0, 0, brightness);
if (vel >= 1) {
leds[NUM_LEDS - int(pos) + 1].setHSV(0, 0, brightness);
}
if(int(pos) % 3 == 0) brightness--;
fadeToBlackBy(leds, NUM_LEDS, 18);
FastLED.show();
}
pos = NUM_LEDS - int(pos);
}
//<Sparkinitialisierung
byte faktor = 8;
for(int i = 0; i < NUM_SPARKS; i++) {
sparkpos[i] = pos;
//sparkvel[i] = random16(0.3 * startvel * 1000, 2 * startvel * 1000);
sparkvel[i] = random16(0, faktor * startvel * 1000);
sparkvel[i] = sparkvel[i] / 1000;
sparkvel[i] = sparkvel[i] - startvel * (faktor / 2);
sparklum[i] = random8(100, 255);
//Serial.println(sparkvel[i]);
}
//</Sparkinitialisierung
sparklum[0] = 255;
byte cooldown = 1;
while(sparklum[0] > 0) {
Serial.println(sparklum[0]);
for(int i = 0; i < NUM_SPARKS; i++) {
if (sparklum[i]) {
if (sparkpos[i] < NUM_LEDS && sparkpos[i] >= 0) {
sparkpos[i] += sparkvel[i];
}
if (sparkvel[i] > 0.1 ) {
sparkvel[i] -= faktor * gravity;
}
if (sparkvel[i] < -0.1) {
sparkvel[i] += faktor * gravity;
}
if (sparklum[i] < cooldown) {
sparklum[i] = 0;
}
else{
sparklum[i] -= cooldown;
}
leds[int(sparkpos[i])].setHSV(0, 0, sparklum[i]);
}
}
fadeToBlackBy(leds, NUM_LEDS, 25);
FastLED.show();
}
}
question from:
https://stackoverflow.com/questions/65644593/esp32-guru-meditation-error-core-1-paniced-storeprohibited 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…