|
@ -22,29 +22,13 @@ void Led::loop_confetti(void) |
|
|
fadeToBlackBy( leds, NUM_LEDS, 10); |
|
|
fadeToBlackBy( leds, NUM_LEDS, 10); |
|
|
int pos = random16(NUM_LEDS); |
|
|
int pos = random16(NUM_LEDS); |
|
|
leds[pos] += CHSV( index + random8(64), 200, 255); |
|
|
leds[pos] += CHSV( index + random8(64), 200, 255); |
|
|
|
|
|
|
|
|
leds[0] = CRGB::White; |
|
|
|
|
|
leds[1] = CRGB::White; |
|
|
|
|
|
leds[NUM_LEDS-1] = CRGB::White; |
|
|
|
|
|
leds[NUM_LEDS-2] = CRGB::White; |
|
|
|
|
|
leds[NUM_LEDS-3] = CRGB::White; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Led::loop_dispense(void) { |
|
|
void Led::loop_sweep(void) { |
|
|
// top: led 9 and 10
|
|
|
|
|
|
|
|
|
|
|
|
// a colored dot sweeping back and forth, with fading trails
|
|
|
// a colored dot sweeping back and forth, with fading trails
|
|
|
fadeToBlackBy( leds, NUM_LEDS, 20); |
|
|
fadeToBlackBy( leds, NUM_LEDS, 20); |
|
|
int pos = beatsin16( 13, 0, NUM_LEDS-1 ); |
|
|
int pos = beatsin16( 13, 0, NUM_LEDS-1 ); |
|
|
leds[pos] += CHSV( index, 255, 192); |
|
|
leds[pos] += CHSV( index, 255, 192); |
|
|
|
|
|
|
|
|
leds[0] = CRGB::White; |
|
|
|
|
|
leds[NUM_LEDS-1] = CRGB::White; |
|
|
|
|
|
leds[NUM_LEDS-2] = CRGB::White; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Led::loop_denied(void) { |
|
|
|
|
|
fill_solid(leds, NUM_LEDS, CRGB::Red); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Led::loop_steady(void) { |
|
|
void Led::loop_steady(void) { |
|
@ -55,16 +39,15 @@ void Led::changeAnimation(uint8_t num, uint16_t duration) { |
|
|
if (duration == 0) this->duration = UINT16_MAX; |
|
|
if (duration == 0) this->duration = UINT16_MAX; |
|
|
else this->duration = duration; |
|
|
else this->duration = duration; |
|
|
if (num == 0) refresh = &Led::loop_steady; |
|
|
if (num == 0) refresh = &Led::loop_steady; |
|
|
else if (num == 1) refresh = &Led::loop_dispense; |
|
|
else if (num == 1) refresh = &Led::loop_sweep; |
|
|
else if (num == 2) refresh = &Led::loop_confetti; |
|
|
else if (num == 2) refresh = &Led::loop_confetti; |
|
|
else if (num == 3) refresh = &Led::loop_rainbow; |
|
|
else if (num == 3) refresh = &Led::loop_rainbow; |
|
|
else if (num == 4) refresh = &Led::loop_denied; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Led::changeColor(uint8_t r, uint8_t g, uint8_t b) { |
|
|
void Led::changeColor(uint8_t r, uint8_t g, uint8_t b) { |
|
|
color = CRGB(r, g, b); |
|
|
color = CRGB(r, g, b); |
|
|
} |
|
|
} |
|
|
void Led::changeBrightness(uint8_t brightness) { |
|
|
void Led::setBrightness(uint8_t brightness) { |
|
|
if (brightness > 254) { // don't set first byte to 255 on tm1829
|
|
|
if (brightness > 254) { // don't set first byte to 255 on tm1829
|
|
|
FastLED.setBrightness(254); |
|
|
FastLED.setBrightness(254); |
|
|
} else { |
|
|
} else { |
|
|