Repository navigation
feat(screenmap): add v2 schema parser alongside v1, auto-detect by shape - #3051
Conversation
Adds support for the screenmap v2 format (zackees/ledmapper#92) inside the existing ScreenMap::ParseJson(const char*, flat_map<string, ScreenMap>*). Auto-detect rules (top to bottom): 1. Explicit "version": 2 -> v2 parser 2. Explicit "version": 1 -> v1 parser 3. Has top-level "segments" array (and no "map") -> v2 parser 4. Falls through to the existing "map" path The v2 parser flattens each segment into one ScreenMap entry keyed by the segment's `id`. UI/wiring metadata (pin, group, parent, offset, z, groups[]) is intentionally ignored at this layer — firmware just needs the per-LED positions. A future ScreenMapV2 type can preserve the richer structure for editor / video-tool consumers; this PR is the minimal flatten path. Backward compat: all existing v1 fixtures and the existing test case "ScreenMap JSON parsing" stay green. The public API is unchanged. Tests added: - v2 basic segments parsing - v2 auto-detect without explicit "version" - v2 with a fork (parent + offset) — both entries materialize independently - v1 file with explicit "version": 1 still routes through the v1 path - v2 malformed segment surfaces a clean error string and returns false Closes the FastLED-side scope of #3050.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds v2 JSON segment-array parsing support to ChangesScreenMap v2 JSON parsing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Closes #3050.
Adds support for the screenmap v2 format (zackees/ledmapper#92) inside the existing
ScreenMap::ParseJson(const char*, flat_map<string, ScreenMap>*).Dispatch (top to bottom)
Flatten policy (Proposal A from #3050)
Each v2 segment becomes one `ScreenMap` entry keyed by the segment's `id`. Fork twins each get their own entry (e.g. `a`, `b` where `b` has `parent: "a"`). UI/wiring metadata (`pin`, `group`, `parent`, `offset`, `z`, `groups[]`) is intentionally ignored — firmware just needs per-LED positions. A future `ScreenMapV2` type (Proposal B from #3050) can preserve the richer structure for editor / video tool consumers; this PR is the minimal flatten path.
Backward compat
Tests added
Verified
`uv run test.py --cpp screenmap --no-pch` → all tests pass.
Summary by CodeRabbit
New Features
Tests