Skip to content

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

Closed

Description

@zackees

Summary

Add FastLED support for the typed EL geometry segments defined by ledmapper issue #451. FastLED currently parses screenmaps into fl::ScreenMap objects containing a point LUT and one diameter, which cannot represent a filled EL panel or a thick polyline. The existing HydroPack WASM preview therefore uses fake WS2812 points instead of the actual emitting geometry.

Ledmapper contract: zackees/ledmapper#451

Current FastLED behavior

  • fl::ScreenMap::ParseJson accepts v1 and v2 screenmaps but reduces each segment to point coordinates plus one diameter.
  • examples/hydropack/hydropack.ino drives real EL gates with 50 Hz PWM on hardware, but its WASM preview is point-based.
  • examples/ElPanelReactive has the same conceptual point-preview limitation.

Proposed contract

Consume these v2 segment types without changing existing untyped LED-strip behavior:

  • type: "el_wire": parallel x/y centerline arrays, at least two vertices, open polyline, required positive thickness.
  • type: "el_panel": parallel x/y polygon vertices, at least three vertices, implicitly closed from last vertex to first, filled.
  • One frame channel per EL shape, independent of vertex count. Existing LED strips still contribute one channel per LED.
  • Preserve id, pin, group, and geometry through the public/adapter model. Reject invalid geometry with a useful error rather than silently truncating arrays.
  • Keep hardware behavior explicit: the shape is visualization/channel geometry; the assigned EL pin remains gated by the existing hardware-safe 50 Hz PWM path.

Choose the smallest compatible public API (for example, a shape-aware companion to ScreenMap or an extended screenmap geometry model) and document coordinate-array ownership/lifetime rules.

Shared acceptance fixture

Use the exact fixture from ledmapper #451 (two triangular panels and one center wire, visually < | >):

{
  "version": 2,
  "segments": [
    {
      "id": "left-panel",
      "type": "el_panel",
      "pin": "pin1",
      "group": "left-panel",
      "x": [-20, -42, -42],
      "y": [0, -24, 24]
    },
    {
      "id": "center-wire",
      "type": "el_wire",
      "pin": "pin2",
      "group": "center-wire",
      "x": [-10, 10],
      "y": [0, 0],
      "thickness": 5
    },
    {
      "id": "right-panel",
      "type": "el_panel",
      "pin": "pin3",
      "group": "right-panel",
      "x": [20, 42, 42],
      "y": [0, -24, 24]
    }
  ]
}

Acceptance criteria

  • Add parser/model tests proving v1 and untyped v2 compatibility, typed geometry preservation, deterministic channel order, and malformed-input errors.
  • Update the WASM rendering/adapter path so the fixture produces exactly three logical outputs: a filled left triangle, a 5-unit-thick center wire, and a filled right triangle. It must not render the shapes as rings or point clouds.
  • Update examples/hydropack/hydropack.ino to use the shared EL-shape fixture or an equivalent embedded fixture in its WASM preview. A deterministic test frame must show left=red, center=green, right=blue, proving that one channel controls each shape.
  • Keep the ESP32-C3 path compiling and preserve the existing two EL gate pins and 50 Hz PWM safety behavior. Do not claim hardware validation unless a board is attached; if hardware is available, run the repository's bash autoresearch workflow and record board/port evidence.
  • Compile the example with the blessed FastLED WASM command (bash compile wasm --examples hydropack, or the current equivalent documented by the repository).
  • Run the browser/WASM acceptance test and retain a screenshot or pixel/geometry assertions that prove the < | > silhouette and channel colors.
  • Cross-reference ledmapper wiki code example edit suggestion #451 and document the shared fixture location/schema.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions