Skip to content

feat: add EL wire and panel screenmap geometry - #3694

Merged
zackees merged 2 commits into
masterfrom
feat/el-screenmap-geometry
Jul 16, 2026
Merged

zackees merged 2 commits into
masterfrom
feat/el-screenmap-geometry

Conversation

@zackees

@zackees zackees commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

Closes #3691\nCloses #3693\n\nAdds typed el_wire and el_panel screenmap v2 geometry to ScreenMap and WASM bindings, updates gfx conversion, and changes HydroPack to render two triangular panels with a center wire as < | >. Includes the shared acceptance fixture and parser coverage.\n\nValidation:\n- �ash test --clean --cpp — 355/355 passed.\n- �ash compile wasm hydropack --no-interactive --no-parallel — passed, including link.\n- �ash compile esp32c3 --examples hydropack --no-interactive --no-parallel — compilation/link stages completed successfully in fbuild daemon; client timed out waiting for daemon completion.\n- �ash lint JavaScript/Python/Meson stages passed; C++ Rust-backed linter could not bootstrap because this host lacks the x86_64-pc-windows-msvc Rust std target.

Summary by CodeRabbit

  • New Features
    • Added support for EL wire/panel “shape” segments in screen maps (v2), including per-shape geometry and wire thickness, plus shape-aware APIs and exports.
    • Updated the Hydropack example to add a dedicated EL wire output and refreshed the preview/LED mapping and rendering.
    • Added a new triangular wire-and-panel sample layout.
  • Bug Fixes
    • Improved build reliability by using absolute, resolved paths for archive-related wrapper and build outputs.
  • Tests
    • Added unit coverage to verify EL geometry parsing and shape preservation for v2 JSON.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a232014d-b599-4a5f-89de-318ed088c107

📥 Commits

Reviewing files that changed from the base of the PR and between 2ab6ddd and 4486d9d.

📒 Files selected for processing (1)
  • tests/data/esp32s3_bloat_baseline.txt

📝 Walkthrough

Walkthrough

Changes

Typed EL geometry pipeline

Layer / File(s) Summary
ScreenMap shape model and parsing
src/fl/math/screenmap.h, src/fl/math/screenmap.cpp.hpp, tests/fl/math/screenmap.cpp
ScreenMap stores typed wire and panel shapes, parses v2 geometry and thickness metadata, preserves shape state across copies and moves, and tests the parsed result.
WASM shape transport and package generation
src/platforms/wasm/compiler/types/index.ts, src/platforms/wasm/js_bindings.cpp.hpp, src/platforms/wasm/compiler/modules/graphics/graphics_manager_gfx.ts
WASM bindings serialize shape vertices and wire thickness, while graphics conversion emits version 2 shape segments and retains the legacy coordinate-map path.
HydroPack EL outputs and preview
examples/hydropack/data/el-shapes-triangles-wire.json, examples/hydropack/hydropack.ino
HydroPack adds a wire channel, computes and writes three duty values, and renders two panel shapes plus one wire shape in the preview.

Meson archive wrapper path resolution

Layer / File(s) Summary
Resolve archive optimization paths
ci/meson/meson_markers.py
Archive optimization injection now uses absolute resolved paths for the wrapper script and build.ninja.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ScreenMap
  participant JSBindings
  participant GfxCompiler
  participant HydroPack
  ScreenMap->>JSBindings: expose typed EL shapes
  JSBindings->>GfxCompiler: serialize shape vertices and thickness
  GfxCompiler->>HydroPack: provide version 2 screenmap segments
  HydroPack-->>HydroPack: render panel, wire, and panel channels
Loading

Possibly related PRs

  • FastLED/FastLED#3621: Both changes extend the WASM graphics screenmap pipeline for version 2 EL shapes.
  • FastLED/FastLED#3686: Both changes modify toGfxScreenmap input handling and screenmap startup behavior.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding EL wire and panel screenmap geometry.
Linked Issues check ✅ Passed The changes align with #3691 and #3693 by adding typed EL geometry support and resolving the Meson archive-wrapper path.
Out of Scope Changes check ✅ Passed The ESP32-S3 bloat baseline update is tied to the new EL geometry functionality, so no unrelated changes stand out.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/el-screenmap-geometry

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
src/fl/math/screenmap.h (1)

100-101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use fl::span for function parameters instead of raw pointers.

As per the C++ coding guidelines, prefer using fl::span<T> for passing array views into functions rather than raw pointers and size counts. This provides bounds checking and a cleaner interface.

  • src/fl/math/screenmap.h#L100-L101: Change the parameter signature to fl::span<const vec2f> vertices (and optionally remove count).
  • src/fl/math/screenmap.cpp.hpp#L604-L614: Update the definition to match and adapt the loop over vertices using the span.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fl/math/screenmap.h` around lines 100 - 101, Replace the raw vertices
pointer and count in ScreenMap::setShape with fl::span<const vec2f> vertices in
src/fl/math/screenmap.h lines 100-101, optionally removing count; update the
matching definition in src/fl/math/screenmap.cpp.hpp lines 604-614 to iterate
over the span while preserving existing shape construction behavior.

Source: Coding guidelines

src/platforms/wasm/compiler/types/index.ts (1)

20-23: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use camelCase for property names.

As per the coding guidelines, use camelCase for variable and function names in TypeScript. Consider renaming vertices_x and vertices_y to verticesX and verticesY.

♻️ Proposed refactor
   type?: 'el_wire' | 'el_panel';
-  vertices_x?: number[];
-  vertices_y?: number[];
+  verticesX?: number[];
+  verticesY?: number[];
   thickness?: number;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/platforms/wasm/compiler/types/index.ts` around lines 20 - 23, Rename the
TypeScript properties vertices_x and vertices_y to verticesX and verticesY in
the relevant type definition, and update all references to those properties so
the API remains consistent.

Source: Coding guidelines

src/platforms/wasm/js_bindings.cpp.hpp (1)

126-140: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting shape serialization to a helper function.

This exact shape serialization block is duplicated in _jsSetCanvasSize (lines 307-321). Extracting it into a helper function would reduce duplication and improve maintainability.

♻️ Proposed refactor

Define a helper function:

static fl::json serializeShapes(const fl::ScreenMap& screenMap) {
    fl::json shapes = fl::json::array();
    for (fl::u32 shapeIndex = 0; shapeIndex < screenMap.getShapeCount(); ++shapeIndex) {
        const auto &shape = screenMap.getShape(shapeIndex);
        fl::json shapeObj = fl::json::object();
        shapeObj.set("type", shape.type == fl::ScreenMap::Shape::EL_WIRE ? "el_wire" : "el_panel");
        fl::json vx = fl::json::array();
        fl::json vy = fl::json::array();
        for (const auto &vertex : shape.vertices) { 
            vx.push_back(fl::json(vertex.x)); 
            vy.push_back(fl::json(vertex.y)); 
        }
        shapeObj.set("x", vx); 
        shapeObj.set("y", vy);
        if (shape.type == fl::ScreenMap::Shape::EL_WIRE) {
            shapeObj.set("thickness", shape.thickness);
        }
        shapes.push_back(shapeObj);
    }
    return shapes;
}

Then replace the duplicate blocks with:

        if (screenMap.hasShapes()) {
            stripMapObj.set("shapes", serializeShapes(screenMap));
        }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/platforms/wasm/js_bindings.cpp.hpp` around lines 126 - 140, Extract the
duplicated shape JSON construction into a shared serializeShapes helper near the
existing bindings, preserving the current type, vertex, and wire-thickness
fields. Replace the inline serialization blocks in both the surrounding
strip-map serialization and _jsSetCanvasSize with calls to this helper, while
retaining each existing hasShapes guard and output assignment.
src/platforms/wasm/compiler/modules/graphics/graphics_manager_gfx.ts (1)

36-58: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reduce duplication by extracting the shape-processing logic.

The logic for processing shapes is nearly identical between the group.strips and else branches. You can extract it into a small inline helper to reduce duplication and improve readability.

♻️ Proposed refactor
  const processShapes = (targetId, targetShapes, groupIdStr) => {
    hasShapes = true;
    groups[groupIdStr] = { color: '`#ffffff`' };
    for (const [shapeIndex, shape] of targetShapes.entries()) {
      segments.push({
        id: `${targetId}:shape${shapeIndex}`,
        type: shape.type,
        pin: groupIdStr,
        group: groupIdStr,
        x: shape.x ?? [],
        y: shape.y ?? [],
        ...(shape.thickness !== undefined ? { thickness: shape.thickness } : {})
      });
    }
  };

  for (const [groupId, group] of Object.entries(screenMaps ?? {})) {
    const groupIdStr = String(groupId);
    if (group?.strips && typeof group.strips === 'object') {
      for (const [stripId, strip] of Object.entries(group.strips)) {
        if (Array.isArray(strip?.shapes)) {
          processShapes(`${groupIdStr}:${stripId}`, strip.shapes, groupIdStr);
          continue;
        }
        const coords = stripCoords(strip);
        if (coords) map[`${groupIdStr}:${stripId}`] = coords;
      }
    } else {
      if (Array.isArray(group?.shapes)) {
        processShapes(groupIdStr, group.shapes, groupIdStr);
        continue;
      }
      const coords = stripCoords(group);
      if (coords) map[groupIdStr] = coords;
    }
  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/platforms/wasm/compiler/modules/graphics/graphics_manager_gfx.ts` around
lines 36 - 58, Extract the duplicated shape handling from the group.strips and
direct-group branches into a local processShapes helper. Have it set hasShapes,
initialize groups, and append segments while accepting the target ID, shapes,
and group ID; replace both existing loops with calls to this helper and preserve
their current IDs and control flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ci/meson/meson_markers.py`:
- Around line 159-166: Update the idempotency and rewrite logic in the
build.ninja patching flow that uses ar_wrapper_script so it recognizes the
resolved absolute wrapper invocation as canonical, while also detecting and
replacing legacy relative ar_content_preserving.py commands. Ensure
already-canonical absolute commands are left unchanged and legacy commands are
rewritten exactly once without double-wrapping.

---

Nitpick comments:
In `@src/fl/math/screenmap.h`:
- Around line 100-101: Replace the raw vertices pointer and count in
ScreenMap::setShape with fl::span<const vec2f> vertices in
src/fl/math/screenmap.h lines 100-101, optionally removing count; update the
matching definition in src/fl/math/screenmap.cpp.hpp lines 604-614 to iterate
over the span while preserving existing shape construction behavior.

In `@src/platforms/wasm/compiler/modules/graphics/graphics_manager_gfx.ts`:
- Around line 36-58: Extract the duplicated shape handling from the group.strips
and direct-group branches into a local processShapes helper. Have it set
hasShapes, initialize groups, and append segments while accepting the target ID,
shapes, and group ID; replace both existing loops with calls to this helper and
preserve their current IDs and control flow.

In `@src/platforms/wasm/compiler/types/index.ts`:
- Around line 20-23: Rename the TypeScript properties vertices_x and vertices_y
to verticesX and verticesY in the relevant type definition, and update all
references to those properties so the API remains consistent.

In `@src/platforms/wasm/js_bindings.cpp.hpp`:
- Around line 126-140: Extract the duplicated shape JSON construction into a
shared serializeShapes helper near the existing bindings, preserving the current
type, vertex, and wire-thickness fields. Replace the inline serialization blocks
in both the surrounding strip-map serialization and _jsSetCanvasSize with calls
to this helper, while retaining each existing hasShapes guard and output
assignment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 68faa209-2e93-435d-bd0f-d0aa07c875a3

📥 Commits

Reviewing files that changed from the base of the PR and between 82a0686 and 2ab6ddd.

📒 Files selected for processing (9)
  • ci/meson/meson_markers.py
  • examples/hydropack/data/el-shapes-triangles-wire.json
  • examples/hydropack/hydropack.ino
  • src/fl/math/screenmap.cpp.hpp
  • src/fl/math/screenmap.h
  • src/platforms/wasm/compiler/modules/graphics/graphics_manager_gfx.ts
  • src/platforms/wasm/compiler/types/index.ts
  • src/platforms/wasm/js_bindings.cpp.hpp
  • tests/fl/math/screenmap.cpp

Comment thread ci/meson/meson_markers.py
Comment on lines +159 to +166
# Ninja runs archive commands with the build directory as cwd. Keep the
# wrapper absolute even when the caller supplied a relative source/build
# path; otherwise Ninja resolves it under `.build/meson-quick/ci/meson`
# and the first archive link fails before tests can start (FastLED#3693).
ar_wrapper_script = (
source_dir / "ci" / "meson" / "ar_content_preserving.py"
).resolve()
build_ninja_path = (build_dir / "build.ninja").resolve()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Migrate existing relative wrapper invocations to the absolute path.

Resolving the new path is not sufficient for incremental builds: the later idempotency check matches only ar_content_preserving.py, so a previously patched build.ninja containing a relative wrapper is treated as active and never rewritten. Those builds can continue failing when Ninja runs from its build directory. Detect the exact absolute invocation and explicitly normalize/rewrite legacy relative wrapper commands without double-wrapping them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ci/meson/meson_markers.py` around lines 159 - 166, Update the idempotency and
rewrite logic in the build.ninja patching flow that uses ar_wrapper_script so it
recognizes the resolved absolute wrapper invocation as canonical, while also
detecting and replacing legacy relative ar_content_preserving.py commands.
Ensure already-canonical absolute commands are left unchanged and legacy
commands are rewritten exactly once without double-wrapping.

@zackees

zackees commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

Additional validation on commit 4486d9d: �ash test --clean --cpp passed 355/355; test linking completed successfully (13.84s).

@zackees

zackees commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

CI infrastructure follow-up filed: #3697 (ESP32-S3 required job remains in-progress without runner updates). The feature branch independently passes �ash test --clean --cpp 355/355 and HydroPack WASM compile; PR remains unmerged pending the required target check.

@zackees
zackees merged commit 03698b6 into master Jul 16, 2026
10 of 11 checks passed
@zackees
zackees deleted the feat/el-screenmap-geometry branch July 16, 2026 10:19
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(screenmap): render typed EL wire and EL panel geometry in HydroPack

1 participant