Browse Source

fix FastLED crashing due to stack size being to small

main
Hendrik Langer 6 years ago
parent
commit
02679f4e80
  1. 9
      software/platformio.ini
  2. 12
      software/src/led.cpp

9
software/platformio.ini

@ -9,19 +9,20 @@
; http://docs.platformio.org/page/projectconf.html
[env:esp32dev]
;platform = https://github.com/platformio/platform-espressif32.git#feature/stage
platform = espressif32
platform = https://github.com/platformio/platform-espressif32.git#feature/stage
;platform = espressif32
board = esp32dev
framework = arduino
;build_flags = -DASYNC_TCP_SSL_ENABLED=1
build_flags = -fexceptions
lib_deps =
https://github.com/me-no-dev/ESPAsyncWebServer.git
https://github.com/me-no-dev/AsyncTCP.git
; ESP Async WebServer
; AsyncTCP
FS
FastLED
; https://github.com/samguyer/FastLED.git
; FastLED
https://github.com/samguyer/FastLED.git
; AsyncMqttClient
https://github.com/marvinroger/async-mqtt-client.git
lib_ignore = ESPAsyncTCP

12
software/src/led.cpp

@ -53,9 +53,10 @@ void Led::changeAnimation(uint8_t num, uint16_t duration) {
}
void Led::setup(void) {
pinMode(LED_PIN, OUTPUT);
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(96);
FastLED.setCorrection(TypicalLEDStrip);
FastLED.setCorrection(0xFF60C0);
fill_solid(leds, NUM_LEDS, CRGB::White);
FastLED.show();
@ -63,7 +64,7 @@ void Led::setup(void) {
xTaskCreate(
&cTaskWrapper, /* Task function. */
"ledAnimationTask", /* String with name of task. */
1024, /* Stack size in words. */
2048, /* Stack size in words. */
this, /* Parameter passed as input of the task */
1, /* Priority of the task. */
&ledTaskHandle); /* Task handle. */
@ -73,7 +74,12 @@ void Led::animationTask(void* parameters) {
while(true) {
if (refresh != nullptr) {
(*this.*refresh)();
FastLED.show();
try {
FastLED.show();
} catch(...) {
Serial.println("FastLED error");
this->setup();
}
// EVERY_N_MILLISECONDS ( 20) { index++; }
index++;
if (duration == 0) {

Loading…
Cancel
Save