Skip to content

Add FSEQ Player effect#1

Draft
netmindz wants to merge 9 commits into
Danit2:mainfrom
netmindz:danit2-fseq
Draft

Add FSEQ Player effect#1
netmindz wants to merge 9 commits into
Danit2:mainfrom
netmindz:danit2-fseq

Conversation

@netmindz
Copy link
Copy Markdown

Add FSEQ Player effect
Remove HTTP api for playback control in favour of segment name

Danit2 and others added 9 commits February 23, 2026 19:32
Introduce a new FSEQ usermod that enables playing .fseq animations from an SD card with a web UI and FPP/UDP synchronization. Adds core components: FSEQ player (fseq_player.cpp/.h), SD manager (sd_manager.*), web/UI & upload/FPP handling (usermod_fpp.h, web_ui_manager.*), registration (register_usermod.cpp), library metadata and auto-build script (library.json, auto_fseq_sd.py) and a README. Also includes helpers for buffered uploads and FPP ping/sync packets. Small updates in existing wled00 files (const.h, json.cpp) are included to integrate the usermod.
Added additional author credit and improved project description.
Multiple cleanups and feature changes across the FSEQ usermod:

- fseq_player: Add a bool loop parameter to loadRecording(), use file_header.channel_data_offset when seeking, avoid prematurely closing recordingFile, and open files via WLED_FS.open for FS paths. Set recordingRepeats from the new loop flag instead of using secondsElapsed heuristics.
- fseq_player.h: Update loadRecording signature and remove unused REALTIME_MODE_FSEQ define.
- sd_manager: Add compile-time check that an SD backend is enabled (SPI or MMC) and remove the listFiles implementation/API; keep deleteFile. Corresponding header prototype removed.
- web_ui_manager: Switch FSEQ/SD endpoints to POST with application/x-www-form-urlencoded bodies (start, startloop, stop, delete). Replace manual string-based SD file listing with a JSON response using DynamicJsonDocument. Improve file upload handling by storing a File pointer on the request and cleaning up on completion. Return status/info endpoints as JSON.
- usermod_fpp/usermod_fseq: Various robustness and modernizations — null-buffer check in write(), inline constexpr and inline variables for UDP and timing, use snprintf for time formatting, suppress noisy debug hex dump, add override annotations, and rework SD reinit to accept and deallocate old pins before reinitializing.

Overall these changes improve robustness of file handling, enforce SD backend presence at compile time, reduce string concatenation overhead by using JSON, and standardize the web API to POST for mutating actions.
…ks & UI

Widen FSEQ frame size counters to 32-bit and make frame buffer reads safe (fixed 48-byte buffer and proper length casts). Add stricter UDP packet length checks for sync packets. Replace raw SD file ops with SD_ADAPTER (exists/remove/open) and add upload open-failure handling/cleanup. Refactor web UI SD list to emit proper JSON via ArduinoJson, fix JS loop-state bug, and adjust loadRecording loop parameter. Remove stale backup file.
Update FSEQ usermod and docs to new API routes and add FPP endpoints; adjust usermod IDs and fix minor web UI handling.

Changes:
- README: revise endpoints (use /api/ prefix, switch some endpoints to POST, rename /sd/ui to /fsequi) and add FPP control endpoints (system info/status and multisync). Merge author line.
- const.h: add USERMOD_ID_FSEQ (59) and USERMOD_ID_FPP (60).
- usermod_fpp.h: change getId() to return USERMOD_ID_FPP instead of USERMOD_ID_SD_CARD.
- web_ui_manager.cpp: store file.name() in a temporary String before use, fix upload handler brace/formatting, and remove an outdated comment about loop mode.

Notes: API route and usermod ID changes may require updates elsewhere that reference the old routes or IDs.
Update README to correct and standardize API paths (/api/...), add FPP endpoints and format SPI pin block. In usermod_fpp.h remove unused helpers, parse versionString into major/minor, change typeId to 195, and harden UDP sync handling with length checks and safe filename extraction to avoid buffer overruns (also remove an old commented sendSyncMessage). In web_ui_manager.cpp only update UI buttons after successful server response and add JSON overflow handling when returning file lists. These changes improve correctness, safety, and UX.
Replace unsafe reinterpret_cast of UDP sync packet with explicit parsing of sync action, frame number and seconds elapsed, and pass those parsed values to ProcessSyncPacket. Add a concurrent-upload guard (returns 409) and make UsermodFPP::_name inline. In the web UI manager add UploadContext for safer upload state handling, rework /api/sd/upload to use the context (better error handling, proper cleanup and file close), write chunks only when the file is valid, and return appropriate responses. Also check JSON overflow when serializing file lists and return 507 if the buffer is too small.
Replace the human-readable hostname with a deterministic unique device ID built from "WLED-" + MAC (colons removed) and use this ID consistently across all FPP payloads.

This change prevents conflicts in FPP when multiple WLED devices share the same default hostname (e.g. multiple devices left as "WLED"). FPP requires unique host identifiers; duplicate hostnames can cause device collisions, sync issues, or undefined behavior in the player.

The new unique ID is now used in:

advancedView

sys.id

FPP ping packet hostname field (truncated to 64 bytes)

The human-readable device name is preserved in HostDescription.
Remove HTTP api for playback control in favour of segment name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants