41#define LED_TYPE WS2811
42#define COLOR_ORDER GRB
44#define CHIP_SELECT_PIN 5
48#define MATRIX_WIDTH 32
49#define MATRIX_HEIGHT 32
50#define NUM_VIDEO_FRAMES 2
53#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
54#define IS_SERPINTINE true
58fl::UIDescription description(
"fl::Video data is streamed off of a SD card and displayed on a LED strip. The video data is mapped to the LED strip using a fl::ScreenMap embedded in the FLED file (with a sidecar screenmap.json fallback for legacy .rgb files).");
86 FL_WARN(
"Screenmap from " << source <<
" has "
88 <<
" — mapping would silently corrupt playback.");
97 const char *sidecarScreenmapPath,
105 FL_WARN(
"FLED embedded screenmap parse failed: " << parseErr.
c_str());
115 FL_WARN(
"Failed to open " << rgbPath <<
" (and no " << fledPath <<
" either)");
119 if (!
filesystem.readScreenMap(sidecarScreenmapPath,
"strip1", outScreenMap)) {
120 FL_WARN(
"Failed to read sidecar " << sidecarScreenmapPath);
130 Serial.println(
"Sketch setup");
133 Serial.println(
"Failed to initialize file system.");
140 "data/video.fled",
"data/video.rgb",
145 "data/color_line_bubbles.fled",
"data/color_line_bubbles.rgb",
154 Serial.println(
"FastLED setup done");
158 static bool s_first =
true;
161 Serial.println(
"First loop.");
166 FL_WARN(
"No loop because an error occured.");
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::Video video(NUM_LEDS, 2.0f)
fl::Video openVideoEitherFormat(const char *fledPath, const char *rgbPath, const char *sidecarScreenmapPath, fl::ScreenMap *outScreenMap)
fl::FileSystem filesystem
fl::UITitle title("SDCard Demo - Mapped fl::Video")
fl::UISlider videoSpeed("fl::Video Speed", 1.0f, -1, 2.0f, 0.01f)
static bool validateScreenMapSize(const fl::ScreenMap &m, const char *source)
fl::UIDescription description("fl::Video data is streamed off of a SD card and displayed on a LED strip. The video data is mapped to the LED strip using a fl::ScreenMap embedded in the FLED file (with a sidecar screenmap.json fallback for legacy .rgb files).")
UINumberField whichVideo("Which fl::Video", 0, 0, 1)
u32 getLength() const FL_NOEXCEPT
static bool ParseJson(const char *jsonStrScreenMap, fl::flat_map< string, ScreenMap > *segmentMaps, string *err=nullptr) FL_NOEXCEPT
void draw(DrawContext context) override
void setTimeScale(float timeScale)
bool hasEmbeddedScreenMap() const FL_NOEXCEPT
const fl::string & embeddedScreenMapJson() const FL_NOEXCEPT
const char * c_str() const FL_NOEXCEPT
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
Demonstrates how to mix noise generation with color palettes on a 2D LED matrix.
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Aggregator header for the fl/ui/ family of per-element UI types.