Repository navigation
feat(screenmap): flip remaining ledmapper emitters to v2 (Bucket A+B+C for #143) - #144
Merged
Merged
Conversation
Partial close of #143 (ledmapper side; FastLED side lands separately). Bucket B — emitters now write v2: - `src/screenmap-store.ts::buildScreenmapMultiStripJson()` — the canonical emitter that backs Save As, shapeeditor autosave, and the JSON embedded in every recorded .fled video. Now writes `{ version: 2, groups, segments: [...] }`. Each strip gets its own group keyed by name with a color from a small palette; `pin` is unconditional (defaults to 'pin1' to match v1's implicit default). - `saveScreenmapPoints()` — routed through the canonical emitter so the single-strip persistence path also emits v2. Bucket C — bilingual readers: - `_countMap()` in screenmap-store.ts now detects v2 (segments / version) before the v1 `.map` fallback, so backup-meta stays correct as the store transitions from v1 to v2 content. - `scripts/inspect-fled.mjs` now walks v2 segments when present, reporting "screenmap shape: v2" and the correct LED count. Verified against FastLED's freshly-converted examples/Fx/FxSdCard/data/video.fled which was reporting "0 LEDs" before this change. Bucket A — fixtures: - `tests/fixtures/test-screenmap.json` and `test-screenmap-multi.json` re-emitted as v2. Callers go through `parseScreenmapMultiStrip` which is bilingual, so no test-code changes were required for the format flip itself. Round-trip fix: - `src/screenmap-v2.ts` + `src/types/domain.ts`: `ScreenmapV2Segment` now optionally carries `video_offset` + `video_offset_override` (a ledmapper-specific extension — not part of canonical v2). The v2→strips adapter (`v2ToMultiStripResult`) honours them so a videoOffsetOverride strip round-trips cleanly through the emitter and parser. Lock-in: - New `tests/unit/shipped-json-is-v2.test.ts` scans `public/screenmaps/` and `tests/fixtures/` and asserts every shipped *.json screenmap is v2. Prevents v1 drift in future PRs. Test assertions updated: - The buildScreenmapMultiStripJson + pin-emission test suites in `tests/unit/multistrip-parsing.test.ts` now assert against the v2 shape (`parsed.version`, `parsed.segments`) and the v2 semantics ("pin is unconditional" replaces "pin omitted when default"). Verification: - npm run lint — clean - npm test — 448/448 pass (one new lock-in test) - npm run build — succeeds Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
zackees
added a commit
to FastLED/FastLED
that referenced
this pull request
Jun 15, 2026
…1 samples (#3100) Closes ledmapper#143 on the FastLED side. (Ledmapper-side emitter + fixture migration shipped in zackees/ledmapper#144.) ScreenMap::toJson / toJsonStr now emit the v2 shape (`{ version: 2, groups, segments: [...] }`) instead of `{ map: { name: {...} } }`. ScreenMap::ParseJson is already bilingual, so: - C++ → JS WASM bridge keeps working (ledmapper reads v2 natively). - Round-trip test (toJson → ParseJson same flat_map) still passes: the parser dispatches on shape, the JSON shape just changed. - Any existing on-disk v1 JSON continues to load via the v1 path — we are not breaking third-party files in the wild. Sample data converted: - examples/Fx/FxSdCard/data/screenmap.json — the legacy sidecar fallback path. The FLED happy path was already embedding v2 since PR #3074; this just makes the .rgb fallback exercise v2 too. - examples/Chromancer/screenmap.json.h — 4-segment inline JSON literal that the sketch feeds to ScreenMap::ParseJson at setup. - examples/Chromancer/output.json — output blob, same 4 segments. Out of scope: - examples/Chromancer/gary_woos_wled_port/gary_woos_wled_ledmap.h uses `{"map": [array of indices]}` which is the WLED ledmap format, not a v1 ScreenMap. Coincidentally shares the "map" key name but the value type is wrong for a screenmap — left untouched. Verification: bash test --cpp screenmap → 1/1 pass bash test --cpp fx_video → 1/1 pass bash test --examples FxSdCard → compiles clean bash test --examples Chromancer → compiles clean Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Closed
13 tasks
This was referenced Jul 8, 2026
zackees
added a commit
that referenced
this pull request
Jul 8, 2026
#234) multistrip-compat.spec.ts still read the v1 `map` key from the multi-strip fixture at module scope; the fixture moved to the v2 `segments` schema in #144, so loading the file threw and killed the entire Playwright run before any test executed - including the first gpu-nightly dispatch, which failed at collection without running a single @gpu spec. Extract a shared v2-or-v1 counting helper (tests/helpers/ screenmap-count.ts), use it for the fixture read and the two store-round-trip assertions, and dedupe moviemaker-recording.spec.ts's local copy onto it. Deeper rot remains in multistrip-compat.spec.ts (movieplayer #btn_upload_screenmap no longer exists, .rgb uploads were removed in #133, shapeeditor save assertions still expect v1) - runtime-only failures outside the @gpu grep, left for a dedicated cleanup. Co-authored-by: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the ledmapper side of #143. (FastLED side lands in a separate PR —
ScreenMap::toJsonflip + sample data re-emission.)Summary
buildScreenmapMultiStripJsonandsaveScreenmapPointsnow write the v2 shape ({ version: 2, groups, segments: [...] }). This is the canonical emitter that backs Save As, shapeeditor autosave, AND the JSON embedded in every recorded.fled. Each strip gets its own group keyed by name with a palette color;pinis unconditional (defaults topin1to match v1's implicit default)._countMap()in screenmap-store.ts now detects v2 before the v1.mapfallback (silently returning 0 LEDs on v2 input was the blocker).scripts/inspect-fled.mjswalks v2 segments when present — verified against FastLED's freshly-convertedexamples/Fx/FxSdCard/data/video.fledwhich previously reportedLED count: 0.tests/fixtures/test-screenmap.jsonandtest-screenmap-multi.jsonre-emitted as v2. Test code didn't need to change —parseScreenmapMultiStripis bilingual.ScreenmapV2Segmentoptionally carriesvideo_offset+video_offset_override(ledmapper-specific extension, not part of canonical v2). The v2→strips adapter (v2ToMultiStripResult) reads them so an override strip round-trips cleanly.tests/unit/shipped-json-is-v2.test.tsscanspublic/screenmaps/andtests/fixtures/and asserts every shipped*.jsonscreenmap is v2. Prevents v1 drift in future PRs.Tests
npm run lint— cleannpm test— 448/448 pass (one new lock-in test). ExistingbuildScreenmapMultiStripJson+ pin-emission assertions rewritten against v2 shape (parsed.version,parsed.segments) and v2 semantics ("pin is unconditional" replaces "pin omitted when default").npm run build— succeeds.What is NOT in this PR
ScreenMap::toJsonstill emits v1, and FastLED'sexamples/Fx/FxSdCard/data/screenmap.json+examples/Chromancer/*.{json,h}are still v1. Tracked in Meta: complete the v1 → v2 screenmap migration (all remaining emitters / parsers / data files) #143; separate PR in the FastLED repo.🤖 Generated with Claude Code