Files
bgrolleman ab2c1b34b4 Replace example shows with numbered production shows and add sparkle flag
- Rename all show .txt files with NNN_ numeric prefix so order is explicit
  and controlled by filename (001_heartbeat_red through 006_party)
- Drop HOME_SHOW special-casing from convert_all.py; show 0 is simply the
  lowest-numbered file
- Add SHOW_FLAG_SPARKLE support: shows can declare '// flags: sparkle' to
  overlay random white flashes on top of the base color each frame
- Wire sparkle into led_controller and config.h (SPARKLE_CHANCE/FRAMES)
- Replace old placeholder/example shows with the six production shows

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 13:59:25 +02:00

33 lines
904 B
C++

// SPDX-License-Identifier: BSD-2-Clause
#include "led_controller.h"
// Internal LED buffer — FastLED writes to this array, then pushes it to the strip.
static CRGB leds[NUM_LEDS];
void leds_begin() {
FastLED.addLeds<LED_TYPE, LED_DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(MAX_BRIGHTNESS);
FastLED.clear(true); // clear + show: strip starts fully off
}
void leds_apply_color(CRGB color, bool sparkle) {
#if ACTIVE_PATTERN == PATTERN_SOLID
fill_solid(leds, NUM_LEDS, color);
#endif
if (!sparkle) return;
static uint8_t sparkle_timer[NUM_LEDS];
if (random8() < SPARKLE_CHANCE) {
sparkle_timer[random8(NUM_LEDS)] = SPARKLE_FRAMES;
}
for (uint8_t i = 0; i < NUM_LEDS; i++) {
if (sparkle_timer[i] > 0) {
leds[i] = CRGB::White;
sparkle_timer[i]--;
}
}
}
void leds_show() {
FastLED.show();
}