|
|
@ -52,7 +52,6 @@ void Led::loop_steady(void) { |
|
|
|
} |
|
|
|
|
|
|
|
void Led::changeAnimation(uint8_t num, uint16_t duration) { |
|
|
|
change = true; |
|
|
|
if (duration == 0) this->duration = UINT16_MAX; |
|
|
|
else this->duration = duration; |
|
|
|
if (num == 0) refresh = &Led::loop_steady; |
|
|
@ -64,7 +63,6 @@ void Led::changeAnimation(uint8_t num, uint16_t duration) { |
|
|
|
|
|
|
|
void Led::changeColor(uint8_t r, uint8_t g, uint8_t b) { |
|
|
|
color = CRGB(r, g, b); |
|
|
|
change = true; |
|
|
|
} |
|
|
|
void Led::changeBrightness(uint8_t brightness) { |
|
|
|
if (brightness > 254) { // don't set first byte to 255 on tm1829
|
|
|
@ -72,7 +70,6 @@ void Led::changeBrightness(uint8_t brightness) { |
|
|
|
} else { |
|
|
|
FastLED.setBrightness(brightness); |
|
|
|
} |
|
|
|
change = true; |
|
|
|
} |
|
|
|
|
|
|
|
void Led::setup(void) { |
|
|
@ -82,9 +79,8 @@ void Led::setup(void) { |
|
|
|
FastLED.setCorrection(0xFF5050); |
|
|
|
fill_solid(leds, NUM_LEDS, CRGB::White); |
|
|
|
color = CRGB::Orange; |
|
|
|
change = true; |
|
|
|
|
|
|
|
refresh = &Led::loop_steady; |
|
|
|
refresh = &Led::loop_rainbow; |
|
|
|
delay(100); |
|
|
|
xTaskCreate( |
|
|
|
&cTaskWrapper, /* Task function. */ |
|
|
@ -99,21 +95,19 @@ void Led::animationTask(void* parameters) { |
|
|
|
while(true) { |
|
|
|
if (refresh != nullptr) { |
|
|
|
(*this.*refresh)(); |
|
|
|
if (refresh != (&Led::loop_steady) || change == true) FastLED.show(); |
|
|
|
change = false; |
|
|
|
FastLED.show(); |
|
|
|
// EVERY_N_MILLISECONDS ( 20) { index++; }
|
|
|
|
index++; |
|
|
|
if (duration == 0) { |
|
|
|
refresh = &Led::loop_steady; |
|
|
|
change = true; |
|
|
|
refresh = &Led::loop_rainbow; |
|
|
|
} else if (duration == UINT16_MAX) { |
|
|
|
} else { |
|
|
|
duration--; |
|
|
|
} |
|
|
|
EVERY_N_SECONDS(300) { |
|
|
|
EVERY_N_SECONDS(30) { |
|
|
|
// FastLED.clear();
|
|
|
|
// delay(200);
|
|
|
|
changeAnimation(3, 400); |
|
|
|
changeAnimation(2, 2000); |
|
|
|
} |
|
|
|
} |
|
|
|
vTaskDelay(50 / portTICK_PERIOD_MS); |
|
|
|