Repository navigation
Play FSEQ shows from any mount, flash or SD alike - #148
Conversation
FseqPlayerEffect plays pre-rendered FSEQ animations (the xLights/Falcon
Player format) from anywhere the file manager reaches, as a playlist with
shuffle/loop modes and a full transport (play/pause/stop/previous/next).
Zlib-compressed files decode on ESP32 only; zstd isn't decoded by any
target yet.
KPI: 256lights | Desktop:3093KB | tick:5/6/471/8/5/13/5/4/18/5us(FPS:200000/166666/2123/125000/200000/76923/200000/250000/55555/200000) | src:332(84020) | test:245(56823) | functions-over:350
Commit: src +979/-32 lines | test +874/-27 lines | duplicated lines 3586 -> 3586 (+0)
**Core**
- `platform::zlibInflateAll`: ESP32 decodes via the ROM's `tinfl_decompress` at zero flash cost; desktop and Teensy stub it to false, since neither links a decoder.
- `module_types.cpp` registers `FseqPlayerEffect`.
**Light domain**
- `src/light/util/FseqFile.h`: a pure, platform-agnostic FSEQ v1/v2 header and sparse-range-table parser, no I/O of its own.
- `src/light/effects/FseqPlayerEffect.h`: the player. Scans the generic filesystem root with no special case for `/sd` or any other mount, so a flash file plays exactly like an SD one. Decodes off the render tick (`tick20ms`, the same split `HttpServerModule::driveSdTransfers` uses for SD reads); `tick()` only blits the already-decoded frame. The playlist is `ListSource`/`EditableListSource`-backed, with shuffle, loop modes, and a file-authored or manual fps rate, capped at `tick20ms()`'s own 50 Hz.
**Tests**
- `unit_FseqFile.cpp`: the parser against hand-built and real xLights-exported bytes, including crafted headers pinning every validated bound (a non-advancing or past-`frameCount` block entry, a `channelDataOffset` inside the header's own tables, an overflow-adjacent block size).
- `unit_FseqPlayerEffect.cpp`: scan/playlist/decode/transport against real `.fseq` bytes on a test filesystem root, mounted-card and plain-flash-root alike.
**Docs/CI**
- `test/CMakeLists.txt` registers `unit_FseqFile.cpp`.
- `docs/assets/light/effects/FseqPlayerEffect.{gif,png}` refreshed to the current card.
- Generated metrics (`repo-health.json/.md`, `docgen.md`) deliberately left uncommitted per review item 4 below.
**Reviews** (🐇 CodeRabbit / 🧑 ewowi, from PR MoonModules#145)
1. Two PRs, player first → done: this commit is the player alone; the zstd compression commit stays on its own branch for its own PR.
2. Teensy build needs `zlibInflateAll`/`zstdInflateAll` stubs → done for `zlibInflateAll` (the only one this commit's code calls); `zstdInflateAll` belongs to the zstd commit.
3. A corrupt file must not write past a buffer → done: `validateBlockRange` refuses a non-advancing or past-`frameCount` block entry and guards the `channelCount` multiply against overflow before any buffer is sized; `channelDataOffset` is refused when it lands inside the header's own tables; `frameBuf_`'s allocation is checked for success rather than bounded, a deliberate degrade-not-crash choice documented in the header.
4. Leave out generated files → done: `repo-health.json/.md`, `code.md`, `docgen.md` and scenario observation blocks excluded from this commit.
5. Small (prose, `fileIndexOf`) → done: "currently" reworded, `fileIndexOf` returns -1 on no match with the UI showing no selection rather than the first file.
6. SD-only flash-read restriction (originally added after a hardware crash matching upstream espressif/esp-idf#5924) → removed: real-hardware reproduction (11,200+ continuous flash reads, then five real playback sessions over the network via the device's own web-UI API, including a full 180s/35fps real show) found no repeat of the crash. Flash and SD now play identically; the underlying ESP-IDF cache-disable-during-flash-read behavior remains a known architectural fact of this chip family, not something this effect special-cases around.
Pre-commit checks:
PASS check_specs
PASS check_prose (1 real finding fixed in added lines; the repo-wide prose.md ROSE is a stale-baseline artifact from vale only just being available this session, not a regression — prose.md left reverted)
PASS check_code --module FseqPlayerEffect (1 accepted finding: raw heap allocation in scanDir, a deliberate heap-per-level recursion documented in the header's own @technical section, matching FilesystemModule::removeTree's precedent)
PASS build_desktop (0 errors; 19 pre-existing GCC-16.2.1/Clang-23 warnings already accepted on misc_fix, none in these files)
PASS build_desktop --tests + test_desktop (2637/2637 cases, 146698/146698 assertions)
PASS check_docgen (1 pre-existing environmental error: help.json/libclang version mismatch, unrelated; both new test files fully clean; the two new headers carry only the "unreferenced appendix section" warning, a pattern already unfixed on several unrelated existing files, left as-is rather than forcing artificial @Xref links)
PASS check_esp32_built (recompiled and reflashed after this message's own docgen edits; confirmed fresh)
SKIP build_docs --strict, test_host --python/--js, check_devices, check_firmwares, improv_smoke_test (no .md, src/ui, moondeck/moonlive, or provisioning files touched)
Real-hardware verification: ESP32-P4-ETH (esp32p4rev1-eth), flashed and monitored clean (no panic) after every rebuild in this cycle; functional playback confirmed live over the network via the device's own web-UI API, both from internal flash and from a real SD-mounted xLights show.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Here the first FSEQ player commit, with just the player without zstd support. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @TouchMyLight, thanks for the second round! Splitting out zstd made this one much easier to review. The parser is careful and well pinned (every truncation offset, the block-table advance, the overflow guard), and the playlist on Three things to fix before we merge, in order of importance:
Worth doing, here or in a follow-up PR, your choice:
We'll finish these ourselves, nothing needed from you:
On size: it's over our 400-line guideline, but it's one topic and already the second round, so no need to split it. Thanks again, this is a big step toward playing xLights shows on MoonLight! |
|
Either way works for us: if you'd rather we take any of the three, say which and we'll do it on your branch, and if you want to do our list too, go ahead. |
|
Thanks for the feedback. I'll try to tackle all recommendations today/tomorrow and will let you know. I'll do them in separate commits on this branch for easier identification. |
FseqPlayerEffect copied its decoded frame into the layer's regular buffer, so the layout mapped it a second time: a serpentine panel, a projection, or a multi-panel wall would have shown every other row reversed. An FSEQ frame is already in wiring order, the same shape NetworkReceiveEffect's sender-mapped frames take, so it now goes through a ChannelDataSink instead and is handed to the output unmapped when the effect is alone on its layer, exactly like Network Receive. KPI: 256lights | tick:5/6/449/8/5/14/5/4/17/5us(FPS:200000/166666/2227/125000/200000/71428/200000/250000/58823/200000) | src:332(84035) | test:245(57054) | functions-over:350 Commit: src +45/-30 lines | test +55/-2 lines | duplicated lines 3586 -> 3586 (+0) **Light domain** - `FseqPlayerEffect.h`: holds a `ChannelDataSink`, sized in `prepare()`. `tick20ms()`'s decode writes the frame straight into the sink (with the sparse-channel expansion folded into the same step); `tick()` is now just `sink_.tick()`. `deliversWiringOrder()`/`copyWiringFrame()` delegate to the sink. Stopping writes one black frame into the sink on the transition instead of a per-tick `memset`; `blitFrameBuf()` is gone. **Tests** - `unit_FseqPlayerEffect.cpp`: added the serpentine-layout regression test this review asked for — a numbered frame on a serpentine `GridLayout`, read back through `copyWiringFrame`, pinning that light k shows what was authored for k, not the layout's remap. Verified it actually catches the bug: run against the pre-fix code first (checked out separately), where it failed as expected, then restored and confirmed green. The existing dense-frame decode test now reads the frame via `copyWiringFrame` too, since the fix no longer writes through `layer.buffer()`. **Reviews** (🧑 ewowi, from PR MoonModules#148, item 1 of 3) 1. Keep the frame in wiring order → done, as above. The other two "must fix" items (the zlib decoder's stack, and the three "unusual rather than broken" file cases) are separate, deliberately not touched here — each lands as its own commit. Pre-commit checks: PASS check_code --module FseqPlayerEffect (1 accepted finding, pre-existing: the documented heap-per-level scanDir recursion, unrelated to this change) PASS build_desktop --tests + test_desktop (2646/2646 cases, 147908/147908 assertions) PASS check_docgen (0 new errors; the one remaining error, help.json/libclang version mismatch, is the same pre-existing environmental issue noted on the prior commit) SKIP check_specs, check_prose, build_docs --strict, check_esp32_built, test_host --python/--js, check_devices, check_firmwares, improv_smoke_test (no .md, src/ui, moondeck/moonlive, or provisioning files touched; ESP32 binary staleness not re-checked, no ESP32 build run this cycle) Generated metrics (repo-health.json/.md, docgen.md) deliberately left uncommitted, regenerated centrally at merge per this PR's own review.
tinfl_decompress_mem_to_mem keeps its own tinfl_decompressor instance on the caller's stack. Reusing one heap-allocated instance instead removes that cost entirely, since every call already re-inits it from scratch. Core: platform_esp32_sdmmc.cpp's zlibInflateAll now calls tinfl_init + tinfl_decompress directly against one platform::alloc'd decompressor (PSRAM-backed on this board), allocated once and reused, rather than through the convenience wrapper's own stack-local instance. Reviews (🧑 ewowi, from PR MoonModules#148, item 2 of 3): done. Verified live on the real board (esp32p4rev1-eth): built a genuine zlib-compressed FSEQ v2 file (144000 raw bytes, 1454 compressed, 3000 frames), played it through to completion over the device's own web-UI API, and polled the main task's stack high-water mark throughout — flat at 7248 bytes free the entire time, no drop. Desktop build unaffected (this file is ESP32-only). Pre-commit checks: PASS check_docgen (0 new errors; same pre-existing help.json/libclang environmental error as the prior two commits) PASS check_esp32_built (rebuilt after the doc-wrap fix, confirmed fresh) SKIP check_specs, check_prose, build_desktop/test_desktop (this file is not compiled into the desktop target), build_docs --strict, test_host --python/--js, check_devices, check_firmwares, improv_smoke_test (no .md, src/ui, moondeck/moonlive, or provisioning files touched) Generated metrics (docgen.md) regenerated during checking and reverted, per this PR's own review (regenerated centrally at merge).
A show with 0 channels/frames, a path longer than the scan can hold, or a compressed file this build cannot decode each used to surface as a vague read failure or silent truncation. Each now gets its own named status. KPI: 256lights | tick:6/6/471/8/5/14/5/4/18/5us(FPS:166666/166666/2123/125000/200000/71428/200000/250000/55555/200000) | src:332(84088) | test:245(57156) | functions-over:350 Commit: src +50/-14 lines | test +107/-5 lines | duplicated lines 3586 -> 3586 (+0) **Core** - `FseqFile.h`: `ParseError::Empty` for 0 channels or 0 frames, checked before version-specific parsing so it covers both v1 and v2. **Light domain** - `FseqPlayerEffect.h`: `loadTrack` maps `Empty` to a named status; checks `platform::hasZlibInflate` so a zlib file on a platform without a real decoder is refused up front rather than failing mid-decode; refuses a zlib file whose compression block table is empty by name too (found during the corner-case sweep, not one of ewowi's three named items). Unified `kPathCap` (192, matching `FilesystemModule::removeTree`'s own budget) across `Track::file`, the scanned-file table and the scan's per-level buffer; `joinPath` now returns whether it truncated. A name or path that doesn't fit is skipped, not silently truncated into a different file, and `rescanFiles` reports one warning naming it. - `platform_config.h` (esp32/desktop/teensy): new `hasZlibInflate` flag (`= hasSdCard` on ESP32, pending the decoder's planned move out of the SD-card file; `false` on desktop/Teensy). **Tests** - `unit_FseqFile.cpp`: 0-channel and 0-frame headers, v1 and v2, each reporting `Empty`. - `unit_FseqPlayerEffect.cpp`: the empty-show status, the zlib-unsupported status, the zlib-no-blocks status, and the oversized-name skip+warning; `joinPathForTest`'s truncation return is now asserted too. **Reviews** (🧑 ewowi, from PR MoonModules#148, item 3 of 3): done, plus the explicit request to sweep for further corner cases (the empty compression block table). 🐇 CodeRabbit: none pending on this item. Pre-commit checks: PASS build_desktop --tests + test_desktop (2653/2653 cases, 147942/147942 assertions) PASS check_specs PASS check_prose (clean in added lines; the one flagged sentence fixed) PASS check_docgen (the two touched headers hold at their already-committed warning counts, both "unreferenced appendix section"; one new test-comment warning found and fixed, so that file now carries zero; the one remaining error, help.json/libclang, is the same pre-existing environmental issue noted on the prior two commits) PASS check_code (no regression attributable to this diff; the "raw allocation in light" drift traces to the prior two commits' already- committed code, not this one; code.md unmeasurable on this host, no Clang 20+) FAIL check_esp32_built (no firmware binary built for esp32s3-n16r8 this session) SKIP test_host --python/--js, check_devices, check_firmwares, improv_smoke_test (no src/ui, moondeck/moonlive, or provisioning files touched) Generated metrics (docgen.md, prose.md, repo-health.json/.md) regenerated during checking and reverted, per this PR's own review (regenerated centrally at merge).
A whole compressed block was read and decoded inside the same tick that needed it, stalling that tick for the block's full read cost. tick20ms now renders what decodeCurrentFrame() decoded last call before decoding the next one, so an expensive decode lands a tick early rather than on the tick whose render it would otherwise delay. KPI: 256lights | tick:5/7/493/10/6/15/6/5/19/6us(FPS:200000/142857/2028/100000/166666/66666/166666/200000/52631/166666) | src:332(84100) | test:245(57167) | functions-over:350 Commit: src +19/-7 lines | test +12/-1 lines | duplicated lines 3586 -> 3586 (+0) **Light domain** - `FseqPlayerEffect.h`: `decodeCurrentFrame()` only decodes into `frameBuf_` now, for either format; `tick20ms()` renders the previous call's frame (`aheadFrameReady_`) before checking end-of-file or decoding the next one. The end-of-file check moved ahead of the decode so the track's real last frame always gets its own full tick of visibility before the track switches, rather than being overwritten by the switch in the same call. `handleStop()` discards a pending frame (about to black out anyway); `loadTrack()`/`setHeaderForTest()` reset it on track (re)load. **Tests** - `unit_FseqPlayerEffect.cpp`: the four existing decode-sequence tests each gained one priming `decodeOneFrameForTest()` call; every subsequent frame-by-frame assertion holds unchanged. No new test for the zlib path specifically: it still can't run end-to-end on desktop (`hasZlibInflate` is false there), so this needed real hardware instead. **Reviews** (🧑 ewowi, from PR MoonModules#148, follow-up: "decoding one block ahead would remove the hitch"): done, as a one-frame pipeline rather than a block-ahead double buffer — simpler, and bounded to one extra frame of memory rather than a whole second compression block. Verified live on the real board (esp32p4rev1-eth): flashed, then let the board's own two-track playlist (a ~3000-frame zlib-compressed track and a ~6300-frame uncompressed SD track) run through two full loops under loopAll, polling position/status/task-stack over the HTTP API throughout. Both tracks completed and the track switch fired cleanly in both directions (zlib→uncompressed and back); no error status, no stall in position, no reboot (uptime climbed continuously to 5:09). main task stack free held flat per track (8240 → 7904 → 7792, each drop tied to a track switch's own buffer sizing, not a continuous decline). Pre-commit checks: PASS build_desktop --tests + test_desktop (2653/2653 cases, 147942/147942 assertions; same counts as before this change, confirming no behavior drift beyond the intended one-tick render shift) PASS check_specs PASS check_prose (clean in added lines) PASS check_docgen (the touched header holds at its already-committed warning count of 7, all pre-existing "unreferenced appendix section"; the one remaining error, help.json/libclang, is the same pre-existing environmental issue noted on every commit so far on this branch) PASS check_esp32_built (rebuilt and flashed this cycle, confirmed fresh) SKIP check_code (host lacks Clang 20+; code.md left unmeasured, as on every prior commit this session) SKIP test_host --python/--js, check_devices, check_firmwares, improv_smoke_test (no src/ui, moondeck/moonlive, or provisioning files touched) Generated metrics (repo-health.json/.md) regenerated during checking and reverted, per this PR's own review (regenerated centrally at merge).
Every FSEQ track change called rebuildControls() to refresh the position gauge's total, and since that total rode the schema hash, it tripped a full control resync to every browser on almost every track change. A Progress total is a value, not a schema trait, exactly like the value its own ptr already carries unhashed. KPI: 256lights | tick:4/5/423/7/4/11/5/4/15/5us(FPS:250000/200000/2364/142857/250000/90909/200000/250000/66666/200000) | src:332(84101) | test:245(57187) | functions-over:350 Commit: src +3/-2 lines | test +22/-2 lines | duplicated lines 3586 -> 3586 (+0) **Core** - `MoonModule.h`: `mixSchema()` excludes `ControlType::Progress` from the generic aux hash. `rebuildControls()` is unchanged: it still refreshes the total via `defineControls()`'s `addProgress`, it just no longer reads that refresh as a schema change. Every other `addProgress` caller (SystemModule, FirmwareUpdateModule, FileManagerModule, SdCardService) benefits the same way, though their totals rarely change in practice. **Tests** - `unit_MoonModule.cpp`: pins the fix directly against the `loadTrack()` pattern (change the total, `rebuildControls()`, check the signature holds and the total did refresh). Verified it fails against the pre-fix code (checked out separately via `git stash`) and passes with the fix. Two pre-existing over-long comments in the same file, now touched, were tightened to clear it from the docgen warning list. **Reviews** (🧑 ewowi, from PR MoonModules#148, follow-up: "every track change calls rebuildControls(), which pushes a full control resync to every browser"): done. The comment's other half, filtering file-upload rescans to `.fseq`, is a separate item, left for its own commit. Pre-commit checks: PASS build_desktop --tests + test_desktop (2654/2654 cases, 147944/147944 assertions) PASS check_specs PASS check_prose (clean in added lines, one wording fix) PASS check_docgen (both touched files carry zero findings; the one remaining error, help.json/libclang, is the same pre-existing environmental issue noted on every commit so far on this branch) SKIP check_code (host lacks Clang 20+; identical counts to the last commit, no new regression) FAIL check_esp32_built (MoonModule.h is newer than the last flashed binary; not rebuilt this cycle) SKIP test_host --python/--js, check_devices, check_firmwares, improv_smoke_test (no src/ui, moondeck/moonlive, or provisioning files touched) Generated metrics (repo-health.json/.md) regenerated during checking and reverted, per this PR's own review (regenerated centrally at merge).
onFileChanged() rescanned the whole filesystem tree on every file change, config writes and palette scripts included. Only a .fseq upload or delete can actually change the playlist's file options, so every other change now costs nothing. KPI: 256lights | tick:5/6/448/7/5/13/5/4/15/5us(FPS:200000/166666/2232/142857/200000/76923/200000/250000/66666/200000) | src:332(84104) | test:245(57191) | functions-over:350 Commit: src +5/-2 lines | test +15/-11 lines | duplicated lines 3586 -> 3586 (+0) **Light domain** - `FseqPlayerEffect.h`: `onFileChanged` skips `rescanFiles()` unless the changed path ends in `.fseq` (reusing the existing `hasExtension` helper), or the path is null (the conservative default, though no caller passes one today). Added a `@technical` line noting this. Known accepted gap: deleting a whole show folder (a path with no `.fseq` extension of its own) doesn't trigger an immediate rescan; it catches up on the next real `.fseq` change, the same graceful handling already in place for any file that stops scanning. **Tests** - `unit_FseqPlayerEffect.cpp`: replaced the old "any path reaches the playlist" test, whose premise this change makes false, with one that demonstrates the filter directly: an unrelated path first (the new file stays unseen in the option list), then the show's own path (it appears). Verified it fails against the pre-fix code (checked out separately via `git stash`) and passes with the fix. **Reviews** (🧑 ewowi, from PR MoonModules#148, follow-up: "any file upload rescans the whole tree; a filter on `.fseq` keeps that to shows"): done. This was the second half of the rebuildControls() comment; the first half (the resync itself) landed in the prior commit. Pre-commit checks: PASS build_desktop --tests + test_desktop (2654/2654 cases, 147943/147943 assertions) PASS check_specs PASS check_prose (clean in added lines) PASS check_docgen (the touched header holds at its already-committed warning count of 7; the one remaining error, help.json/libclang, is the same pre-existing environmental issue noted on every commit so far on this branch) SKIP check_code (host lacks Clang 20+; identical counts to the last commit, no new regression) FAIL check_esp32_built (FseqPlayerEffect.h is newer than the last flashed binary; not rebuilt this cycle) SKIP test_host --python/--js, check_devices, check_firmwares, improv_smoke_test (no src/ui, moondeck/moonlive, or provisioning files touched) Generated metrics (repo-health.json/.md) regenerated during checking and reverted, per this PR's own review (regenerated centrally at merge).
|
Here all changes except "We'll finish these ourselves". |
|
Thanks @TouchMyLight, this round is excellent: the frame goes through the sink in wiring order with a serpentine test to pin it, the decompressor lives on the heap with the P4 stack measured, and odd files are refused cleanly, each in its own commit, which made it easy to follow. As you offered, we'll add one maintainer commit on your branch and then merge. Two things in it are corrections rather than polish:
The rest is what we said we'd finish: the decoder moved to |
The FSEQ player now costs only its playlist while disabled: its frame and block buffers, the file header and the zlib workspace are taken when a track opens, the folder scan while it is enabled, and all of them are freed when it is disabled, and the player object shrinks from about 30 KB to 2 KB. A corrupt compressed block can no longer hang the device, and zlib shows play on every ESP32, not only boards with an SD card. - **Core**: reverts cfcaf46, since a Progress total travels only in the schema, so leaving it out of the hash kept an open browser on the previous total; a `ProgressUnit::Count` for a gauge that counts things rather than bytes. - **Platform**: the zlib decoder moves from the SD-card file into platform_esp32.cpp, unconditional, and inflates a block in one call that fails on anything but done; its workspace is the caller's (`zlibWorkspaceBytes()`), so no global stays allocated. - **Light domain**: FseqPlayerEffect keeps each playlist path sized to its content, takes the header and the block buffers as ScratchBuffers sized once per track and the scan cache as one held while enabled, shows the fps slider when manual is chosen, seeds its shuffle, and labels its position as a count; the block-table read moves into FseqFile.h; help lines for every control and `@attribution FPP`. - **UI**: a count gauge shows a plain number. - **Tests**: the fps slider, the playlist through add, move, delete and release, the block-table entry; the three refusal cases share one helper; cfcaf46's test goes with it. - **Docs/CI**: help.json regenerated; both appendices cut into member lines; backlog: a Progress total that rides the value patch. check_code rises by 8 over main, each named: the three file reads and frame writes in tick20ms, the third copy of the list-restore block (a core helper is a follow-up), the scan and playlist-path allocations, and the large test file main already carries. - **Reviews**: 👾 maintainer review of round two: the zlib loop, cfcaf46, the fps slider, per-block reallocation, the decoder's home, the ratchets, the disabled player's memory → done. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A zlib track that stops mid-file now names the cause: an invalid block table entry, a failed read, or a block that does not inflate to its declared size, where every case used to read "file read failed mid-file". Verified on a P4 with a block that inflates past its size. - **Light domain**: `loadNextBlock` returns the failure's message, which `frameFromCompressedBlock` hands to the status. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main moved on with MoonModules#151, so the pull request no longer merged and CI could not run. The code merges cleanly; the four generated files are regenerated on the merged tree: help.json from the headers, and the code, docgen and prose reports. Tested before this commit: the desktop build, 2652 unit tests and the JS tests pass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A directory lists its entries in an order the filesystem chooses, alphabetical on macOS and not on Linux, so the picker showed files in a different order per board and a playlist test passed on one and failed on the other. The player now sorts the scanned files, the same everywhere; the playlist keeps each row's path, so its rows do not move. - **Light domain**: `rescanFiles` sorts the scan with `std::qsort`. - **Tests**: the playlist test writes `b.fseq` before `a.fseq`, so it shows the sort rather than the filesystem's order. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged, thank you @TouchMyLight! FSEQ playback from any mount is a real feature, and your round two made it easy to finish. Besides what we announced, the maintainer commits added a few things, mostly from one rule we're tightening across MoonLight: a module that doesn't run costs flash, nothing else. Disabled, it keeps only its settings; removed, it leaves nothing behind. It also takes no tick time while disabled, which the scheduler already guarantees. Here is what that meant for the player:
Together that takes the player object from about 30 KB to about 2 KB (1.3 KB on a P4), and a disabled player holds 0 bytes of buffers. Also new:
Verified on a P4 (the MHC-WLED shield): a zlib show plays at its 25 ms step, a file whose block inflates past its declared size stops with that message and the board keeps running, and a disabled player holds no buffers. For zstd, the same shapes will make it a short review:
Looking forward to it! |
|
@TouchMyLight, one question before you start on zstd: what's the case for it? It would ship on every board: the decoder's flash in each image, and about 150 KB of RAM for zstd's workspace while a track plays. Too much for a classic ESP32 without PSRAM, and a real cost even where it fits. As far as we know, xLights can save FSEQ as zlib (its preferences have a default save type), and zlib already plays on every board. So a zstd show only needs a re-export to play. If there's a reason a zlib export doesn't cover, for example shows only available as zstd, a size or speed difference that matters on the device, or a player you want to stay compatible with, we'd like to hear it. Otherwise we'd rather make the player's status say "zstd FSEQ: save as zlib in xLights" and keep one compression for every board. |
|
@TouchMyLight, a correction to my question above, now that we've measured it: zstd is cheaper than I made it sound.
So if we take it, it would be built only into the PSRAM variants (S3 N8R8/N16R8/N32R16, the P4 and the S31). Boards without PSRAM keep zlib and say "zstd FSEQ: save as zlib in xLights" for a zstd file. The question stays: do real shows need it? If your xLights exports or the shows you play arrive as zstd by default, that's a good enough reason, and we'd welcome the PR in that shape: the decoder behind the platform seam with a workspace the player owns (like zlib's), PSRAM variants only, and failures that name their cause. |
|
I only added it for completeness and ease of use sake, so the user doesn't have to re-encode it, if they have hardware supporting this capability. But I actually don't use it myself, and don't plan to use it (to stay compatible). |
|
We can have it in our back pocket when there is a need to use it / users request it. Post pics and vids and setup instructions when you have it running. We could share it with other users if they want to use it Are you on discord We are here, might be handy to chat about this with others as well |
… the report, CI on pull requests Every check now records its findings in one shape, and the test page is where they are read: each check's rules, every file it found something in, and the errors in full. The three report pages are gone. Pull requests, a fork's included, get their failing tests and their checks' errors as annotations, and our own branches upload the findings to code scanning. A data race between the render loop and the encode task is fixed. KPI: 256lights | Desktop:2366KB | tick:7/7/7/2/8/7/268/7/7/10us(FPS:142857/142857/142857/500000/125000/142857/3731/142857/142857/100000) | src:333(84514) | test:247(57522) | functions-over:349 Commit: src +15/-12 lines | test +209/-135 lines | code findings 1622 -> 1672 (#define used as a constant +1, double in firmware code +2, duplicated block +4, large file -1, mutable static state +44) | duplicated lines 3363 -> 3379 (+16) Flash split: esp32 +12.7 KB, esp32s3-n16r8 +11.1 KB, esp32p4rev3-eth +12.6 KB against the snapshot of bc70297, which predates the merged FSEQ player (PR #148); this branch's own src changes are the atomic counter, two comments and help.js. The counts move to JSON files with this commit, so the ratchets record rather than compare once. Rises against the last report pages: the three new code rules start at their first counts (mutable static state 44, double in firmware code 2, #define used as a constant 1); duplicated block +4 is the import header `import _findings` makes identical across check scripts, a script's standard import shape rather than repeated logic; prose's new rules start at VagueClose 28, LinkText 7, TonePadding 1, and every other prose rule fell (total 2409 -> 2357); docgen fell (warnings 3077 -> 3051, appendix 4388 -> 4376). **Core** - MoonModule::accumUs_ is a std::atomic, added with a relaxed fetch_add and reset with exchange: the drivers tick on the encode task and on the main loop, and ThreadSanitizer found the two writing the same counter. **Light domain** - A comment no longer dates itself ("currently" in Hub75Driver.h). **UI** - A control's test links read the scenario's name as the registry spells it, and an unsafe address gets no link rather than one to "#". **Scripts/MoonDeck** - Every check script writes its findings through moondeck/check/_findings.py; check_module and check_footprint have none of their own, and a test names them. - check_code, check_docgen and check_prose keep their counts in docs/reference/metrics/{code,docgen,prose}.json, read back from HEAD by _ratchet; the four parsers of the old pages' tables are gone, with check_docgen's DOC_AREAS and the page writers. - A rule a host cannot measure is left out of the record rather than recorded as zero (check_code's compiler rules, check_nonblocking's render path, check_docgen's help freshness). - check_code links each rule to its own standards section; its file rules share one firmware test and one code-of-a-line helper, so a `//` inside a string no longer cuts a line. - check_prose records the tree's debt as warnings, so "error" means "fails the check"; a base passed on the command line is used as given. - check_esp32_built keeps every firmware's last verdict. - run_scenario --name runs as a suite of one, so it records its run and honors --update-observed; --no-write goes, as a run no longer writes the file. - _observed loses the sample compaction, the empty block and the old window shapes. - test_host removes the last JUnit file before a run, so a run that writes none records none. - gen_tests: an instance has the type its last state document gave it, so a swapped instance is read as it is at each step, and `instances` declares only what a step uses before a document creates it; the unused full writer goes, one anchor and one readable title serve the help and the map; the registry is read once per docs build. - generate_test_docs.py is perf_table.py, named for what it does. - The VagueClose rule no longer matches "etc" inside a word or the path /etc/, nor "and more" in a comparison: 424 findings were 28. **Tests** - New: the SARIF export, the annotations, the prose ratchet, every check writing findings, a firmware's verdict kept beside the others, an instance swapped mid-scenario, a subcase counted for its longest case, a `//` in a string. - Fixed: the live test pins its size, the groups are named rather than counted, a test example matches the tree. **Docs/CI** - The test page replaces the code, docgen and prose reports, which redirect to their checks; a card lists every file with its errors, falls back to the committed counts where a check never ran, and the tree has a file level with counts on every node. - The test page mounts on Material's instant navigation, links files on the branch it was built from, and knows the Python, JS and check kinds. - test.yml annotates failing tests from JUnit through workflow commands, which need no token, so a fork's pull request gets them; findings.yml runs each check as a step, annotates error findings in the changed files and uploads SARIF on our own branches. - tests.schema.json describes only what the registry emits. **Reviews** - Reviewer (2313b88) tests.js mounted once, empty after instant navigation: done, mounted per page through document$, its page-wide listeners removed on the next mount. - Reviewer (2313b88) moonwalk.md linked ../tests.md: done, tests.md. - Reviewer (2313b88) `instances` a second home for a type the documents carry: done, and it found a real one: the Layers scenario read its GridLayout steps as WheelLayout. Types now follow the documents step by step; 15 scenarios lost their redundant declarations. - Reviewer (2313b88) two slug algorithms for one anchor: done, gen_tests.anchor. - Reviewer (2313b88) registry parsed four times per build: done, once. - Reviewer (2313b88) gen_tests.write a second publisher nobody runs: done, removed; the script writes only the step files the preview server reads. - Reviewer (2313b88) schema describes what does not exist: done, cut to the registry. - Reviewer (2313b88) the live test never pins the size, a magic group range: done. - Reviewer (2313b88) help.js comment above the wrong function, an unsafe link to "#": done. - Reviewer (2313b88) the readable scenario name derived twice: done, gen_tests.readable. - Reviewer (2313b88) stale "test inventory" docs, generate_test_docs.py misnamed: done, six sentences and the rename to perf_table.py. - Reviewer (2313b88) KINDS lacks python, js and check: done. - Reviewer (2313b88) `states` dead: done, removed. - Reviewer (2313b88) quadratic whitespace skip: done, one regex. - Reviewer (2313b88) a subcase's parent by set order: done, the longest prefix, pinned. - Reviewer (2313b88) the page links main's files: done, the index names the branch built. - Reviewer (4a76f17) run_scenario --name ignored --update-observed and recorded no run: done. - Reviewer (4a76f17) the runner's docs said a run writes the file: done; --no-write goes, as nothing is left for it to prevent. - Reviewer (4a76f17) _observed dead code and stale docs: done. - Reviewer (4a76f17) a stale JUnit file recorded as this tree's run: done. - Reviewer (4a76f17) prose rules outside the style lose their counts, a `%s` in the reasons: done, an "other" rule and the placeholder spelled. - Reviewer (4a76f17) the empty .mm-tests-card styles, `states`, the header line: done. - Reviewer (4a76f17) every code rule linked #static-checks: done, each to its section. - Reviewer (4a76f17) the vendor exclusion repeated, a `//` in a string cutting the line: done, one firmware test and one helper, pinned. - Reviewer (4a76f17) VagueClose's comment and "and more" at a line's end: done, pinned. - Reviewer (4a76f17) a test example contradicting the tree: done. - Reviewer (4a76f17) an unused variable in a test: done. - Reviewer (4a76f17) the live runner's duplicate window comment: done. - Reviewer (4a76f17) "this run's statistics" for a window's: done, the runners and testing.md. - Reviewer (4a76f17) findings read twice per build: done, with the registry. - Reviewer (4a76f17) the merge kept main's longer NDI exit comment: done, condensed with main's content. - Reviewer (tree) a process note that the tree moved during the review: accepted, the review ran while the other findings were being fixed; the gates ran on the final tree. - Reviewer (tree) check_prose recorded Vale's severity, so the tree's debt read as 1352 errors: done, recorded as warnings. - Reviewer (tree) two prose annotators on a pull request: done by the fix above, as the findings annotations carry errors only. - Reviewer (tree) in CI the added-lines prose gate checked nothing: done, the pull request's base is passed. - Reviewer (tree) the ratchet rolls over silently at this commit: accepted, the rises are named above. - Reviewer (tree) an unmeasured rule recorded as zero: done, in check_code, check_nonblocking and check_docgen. - Reviewer (tree) docgen's rules named two ways: done, by label in both. - Reviewer (tree) check_esp32_built kept one firmware: done, every firmware's, pinned. - Reviewer (tree) workflow-command properties unescaped: done, pinned. - Reviewer (tree) read_all ignores its directory for the committed half: done, a metrics argument. - Reviewer (tree) an empty list under every subject, the error rule twice: done. - Reviewer (tree) LABELLED: done. - Reviewer (tree) "report" left in a test name and a docstring: done. - Reviewer (tree) leftover links to the removed pages: done, in the backlog and a past plan; repo-health.md regenerates with the KPI run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
OK, then let's wait until there is a user request before adding zstd support. You can see here the LED cube which was running before and completed its main task. I'm not on discord, mainly due to lack of time. I then can spend it on building the next installation :). |
FseqPlayerEffect plays pre-rendered FSEQ animations (the xLights/Falcon Player format) from anywhere the file manager reaches, as a playlist with shuffle/loop modes and a full transport (play/pause/stop/previous/next). Zlib-compressed files decode on ESP32 only; zstd isn't decoded by any target yet.
KPI: 256lights | Desktop:3093KB | tick:5/6/471/8/5/13/5/4/18/5us(FPS:200000/166666/2123/125000/200000/76923/200000/250000/55555/200000) | src:332(84020) | test:245(56823) | functions-over:350
Commit: src +979/-32 lines | test +874/-27 lines | duplicated lines 3586 -> 3586 (+0)
Core
platform::zlibInflateAll: ESP32 decodes via the ROM'stinfl_decompressat zero flash cost; desktop and Teensy stub it to false, since neither links a decoder.module_types.cppregistersFseqPlayerEffect.Light domain
src/light/util/FseqFile.h: a pure, platform-agnostic FSEQ v1/v2 header and sparse-range-table parser, no I/O of its own.src/light/effects/FseqPlayerEffect.h: the player. Scans the generic filesystem root with no special case for/sdor any other mount, so a flash file plays exactly like an SD one. Decodes off the render tick (tick20ms, the same splitHttpServerModule::driveSdTransfersuses for SD reads);tick()only blits the already-decoded frame. The playlist isListSource/EditableListSource-backed, with shuffle, loop modes, and a file-authored or manual fps rate, capped attick20ms()'s own 50 Hz.Tests
unit_FseqFile.cpp: the parser against hand-built and real xLights-exported bytes, including crafted headers pinning every validated bound (a non-advancing or past-frameCountblock entry, achannelDataOffsetinside the header's own tables, an overflow-adjacent block size).unit_FseqPlayerEffect.cpp: scan/playlist/decode/transport against real.fseqbytes on a test filesystem root, mounted-card and plain-flash-root alike.Docs/CI
test/CMakeLists.txtregistersunit_FseqFile.cpp.docs/assets/light/effects/FseqPlayerEffect.{gif,png}refreshed to the current card.repo-health.json/.md,docgen.md) deliberately left uncommitted per review item 4 below.Reviews (🐇 CodeRabbit / 🧑 ewowi, from PR #145)
zlibInflateAll/zstdInflateAllstubs → done forzlibInflateAll(the only one this commit's code calls);zstdInflateAllbelongs to the zstd commit.validateBlockRangerefuses a non-advancing or past-frameCountblock entry and guards thechannelCountmultiply against overflow before any buffer is sized;channelDataOffsetis refused when it lands inside the header's own tables;frameBuf_'s allocation is checked for success rather than bounded, a deliberate degrade-not-crash choice documented in the header.repo-health.json/.md,code.md,docgen.mdand scenario observation blocks excluded from this commit.fileIndexOf) → done: "currently" reworded,fileIndexOfreturns -1 on no match with the UI showing no selection rather than the first file.Pre-commit checks:
PASS check_specs
PASS check_prose (1 real finding fixed in added lines; the repo-wide prose.md ROSE is a stale-baseline artifact from vale only just being available this session, not a regression — prose.md left reverted) PASS check_code --module FseqPlayerEffect (1 accepted finding: raw heap allocation in scanDir, a deliberate heap-per-level recursion documented in the header's own @technical section, matching FilesystemModule::removeTree's precedent) PASS build_desktop (0 errors; 19 pre-existing GCC-16.2.1/Clang-23 warnings already accepted on misc_fix, none in these files) PASS build_desktop --tests + test_desktop (2637/2637 cases, 146698/146698 assertions) PASS check_docgen (1 pre-existing environmental error: help.json/libclang version mismatch, unrelated; both new test files fully clean; the two new headers carry only the "unreferenced appendix section" warning, a pattern already unfixed on several unrelated existing files, left as-is rather than forcing artificial @Xref links) PASS check_esp32_built (recompiled and reflashed after this message's own docgen edits; confirmed fresh) SKIP build_docs --strict, test_host --python/--js, check_devices, check_firmwares, improv_smoke_test (no .md, src/ui, moondeck/moonlive, or provisioning files touched) Real-hardware verification: ESP32-P4-ETH (esp32p4rev1-eth), flashed and monitored clean (no panic) after every rebuild in this cycle; functional playback confirmed live over the network via the device's own web-UI API, both from internal flash and from a real SD-mounted xLights show.