Repository navigation
feat: add EL wire and panel screenmap geometry - #3694
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChangesTyped EL geometry pipeline
Meson archive wrapper path resolution
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
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
src/fl/math/screenmap.h (1)
100-101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
fl::spanfor 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 tofl::span<const vec2f> vertices(and optionally removecount).src/fl/math/screenmap.cpp.hpp#L604-L614: Update the definition to match and adapt the loop oververticesusing 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 valueUse camelCase for property names.
As per the coding guidelines, use camelCase for variable and function names in TypeScript. Consider renaming
vertices_xandvertices_ytoverticesXandverticesY.♻️ 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 valueConsider 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 valueReduce duplication by extracting the shape-processing logic.
The logic for processing shapes is nearly identical between the
group.stripsandelsebranches. 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
📒 Files selected for processing (9)
ci/meson/meson_markers.pyexamples/hydropack/data/el-shapes-triangles-wire.jsonexamples/hydropack/hydropack.inosrc/fl/math/screenmap.cpp.hppsrc/fl/math/screenmap.hsrc/platforms/wasm/compiler/modules/graphics/graphics_manager_gfx.tssrc/platforms/wasm/compiler/types/index.tssrc/platforms/wasm/js_bindings.cpp.hpptests/fl/math/screenmap.cpp
| # 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() |
There was a problem hiding this comment.
🩺 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.
|
Additional validation on commit 4486d9d: �ash test --clean --cpp passed 355/355; test linking completed successfully (13.84s). |
|
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. |
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