|
@ -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) { |
|
|