GridLayout¶
A regular 3D grid layout that declares a
width × height × depthpixel extent to its parentDriverLayer. Introduced in Release 3, Sprint 3b as the first concreteLayoutimplementation — it decouples the driver's pixel-buffer size from hard-coded props so that layouts own the coordinate space.
What it does¶
GridLayout is a child module of a DriverLayer. When the DriverLayer's onChildrenReady() fires (after all children have finished setup()), it reads the layout's extent and sizes its pixel buffer accordingly. A grid layout maps each logical pixel at (x, y, z) to a sequential index z * w * h + y * w + x — the same layout used internally by EffectsLayer.
GridLayout::loop() is a no-op. The coordinate mapping primitives (addLight(), nextPin(), requestMappings()) are deferred to Sprint 6.
Props¶
| Parameter | Source | Default | Description |
|---|---|---|---|
width |
setProps |
10 | Grid width in pixels |
height |
setProps |
10 | Grid height in pixels |
depth |
setProps |
1 | Grid depth in pixels (1 = flat 2D panel) |
Wiring¶
Add as a child of a DriverLayer via parent_id. The DriverLayer automatically picks up the layout's extent in onChildrenReady().
{ "type": "DriverLayer", "id": "driver1", "props": {} }
{ "type": "GridLayout", "id": "grid1", "parent_id": "driver1",
"props": { "width": 16, "height": 16, "depth": 1 } }
Multiple GridLayout children are supported; the DriverLayer takes the union (per-axis max) of all extents.
Lifecycle¶
| Phase | Action |
|---|---|
setProps() |
Sets width, height, depth |
setup() |
Logs dimensions |
loop() |
No-op |
teardown() |
Logs teardown |
Layout interface¶
void extent(uint16_t& w, uint16_t& h, uint16_t& d) const override;
Called by DriverLayer::onChildrenReady() to query this layout's pixel extent.
Source¶
Test coverage¶
→ Effect and Driver Layers — extent reporting, setProps sizing, saveState/loadState round-trip, straight and serpentine requestMappings.
Live pipeline: test3 — GridLayout resize (depth 1→5, width 10→20) on real hardware without crashing.