Browse Source

fix FastLED crashing due to stack size being to small

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

9
software/platformio.ini

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

10
software/src/led.cpp

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

Loading…
Cancel
Save