Repository navigation
Add layout placement, whole-wall shapes and panel chain patterns (Layouts plan step 3) - #285
Conversation
… patterns
Implements Steps 3 and 5 of 'Plan: Layouts that describe panels' (stacked cleanly on panel-geometry-hub75):
- Step 3 (Per-layout placement & Layouts container transform/shape):
- Add LayoutTransform.h with shared 90-degree clockwise rotation, X/Y/XY
mirror, 2D bounding-box measurement, and exact integer inscribed
rectangle/circle/ellipse containment helpers.
- Add expert-mode placement controls (positionX, positionY, positionZ,
rotate, mirror) to LayoutBase via defineControls() final +
defineLayoutControls(), automatically covering every built-in layout
and MoonLiveLayout without name collisions (e.g. RingLayout's rotation).
- Implement LightEmitter::placePlaced(): untransformed children pay one
pass only; rotated or mirrored children measure their own box in pass 1
and emit transformed lights, gaps, and nextPanel() markers in pass 2.
- Add whole-wall rotate, mirror, and shape (rectangle/circle/ellipse)
controls in normal mode on Layouts (with affectsPrepare() and hasGaps()),
baking lights outside circle/ellipse as real-coordinate gaps so
PanelRecorder and HUB75 geometry inference keep working intact.
- Step 5 (PanelsLayout chain patterns & rotateP):
- Add named row chain patterns (top-left/top-right/bottom-left/bottom-right
serpentine and rows) alongside custom on PanelsLayout, hiding the custom
outer controls when a named chain is picked and keeping rotateP in normal
mode while forwarding nextPanel() on rotated passes.
- Regenerate docs/help/help.json and add unit tests covering placement,
single-pass vs two-pass emission, whole-wall rotate/mirror/shape,
MoonLiveLayout placement, all 8 named chain patterns + rotateP, and
end-to-end Hub75Driver chain derivation.
Gate note: zero new check_code.py regressions from this commit (1426 total
findings, 786 duplicated blocks; only the inherited name spread 23 -> 24
from panel-geometry-hub75's Hub75Driver migration entries); check_docgen.py
passes with 0 errors and 1066 warnings.
Hub75BusOutput::checkPins() previously validated all five address lines (A-E) even when the resolved scan rate only drives A-B (1/4), A-C (1/8), or A-D (1/16), refusing panels on boards where unused upper address lines sit on reserved or input-only pins even though buildPinOrder() parks them at GPIO_NUM_NC. Bound Hub75BusOutput::lines() by hub75AddressBits(geo_.scanRate) during checkPins() while keeping fixedPins() reporting all 14 soldered board lines, and add host unit tests covering 1/4, 1/8, 1/16, and explicit folded 1/4 scans.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
Thanks @GK-Triumvirate, this is a big step: placement on every layout, the whole-wall rotate, mirror and shape, and the masked walls, with the plan's tests and a run on two stacked panels. The placement core is exactly what the plan asked for: fields on LayoutBase applied when the mapping is built, nothing per frame, and defineLayoutControls() follows the Template Method DriverBase already uses. Nothing blocks. What we checked. Because this touches the walk every layout goes through, we compared it against main:
One change to our own plan. Step 5 asked for the chain patterns as one select, and that was our mistake, not yours. The per-axis controls (wiringOrderP, X++P, Y++P, snakeP) are the same system as Panel and Cube (X++, Y++, Z++, snakeX/Y/Z), which extends to 3D, and all eight of your patterns are already reachable with them. A named select would be a second way to do the same thing, stopping at 2D. So chain goes; your eight pattern tests stay, rewritten with the per-axis settings, proving every wall in mrcodetastic's list works on Panels, and the panels docs teach the per-axis controls with a picture of each, so a beginner reads the settings off their own wall. One path also ends the disagreement between the named and custom chains on a wall wired from the bottom. We finish it in a maintainer commit:
Both Known limits are real on main; we take them separately. Looking forward to the 8-panel wall on this! |
…uses The pin check reads the address lines by name rather than by table index, and the MatrixPortal pin test's rig owns the layout and layer its driver points at, so the driver never outlives them. KPI: 256lights | Host:2988KB | tick:8/8/8/8/1/8/268/8/8/8us(FPS:125000/125000/125000/125000/1000000/125000/3731/125000/125000/125000) | ESP32:2474KB | src:523(123969) | test:347(90247) | functions-over:313 Commit: src +5/-3 lines | test +35/-34 lines | duplicated lines 3413 -> 3413 (+0) - **Light domain**: `Hub75BusOutput::lines()` skips the unused address lines by `kFirstAddrLine` and `kAddrLines`, not the indexes 6 and 10. - **Tests**: `MatrixPortalRig` holds layouts, grid, layer and driver together, declared so the driver dies first; the helpers that left the driver pointing at a dead Layer go. - **Docs/CI**: prose and repo-health metrics regenerated. - **Reviews**: the maintainer review's two nits (named range, test lifetime) done; the Reviewer at commit time found nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/MIGRATING, and PR MoonModules#283 test placement
A masked wall keeps its gaps dark through the layer's own positions, one rule in place of a gap cache; Panels keeps one way to walk its panels, which counts passes from where the data enters; MoonLive layouts take the same placement controls as every layout. Mappings of today's setups stay byte for byte as on main (41 setups compared) and a C3 cube's tick, heap and fps match main. KPI: 256lights | Host:2990KB | tick:8/8/8/8/1/8/271/8/8/8us(FPS:125000/125000/125000/125000/1000000/125000/3690/125000/125000/125000) | ESP32:2477KB | src:524(124314) | test:347(90838) | functions-over:313 Commit: src +138/-382 lines | test +146/-229 lines | duplicated lines 3413 -> 3412 (-1) - **Light domain**: `Layer::wiringSource()` gives no one-copy path on a layout with gaps, so a sender-mapped frame takes `placeByLayout`, which drops them; the gap-run cache, the eviction ladder, the empty-LUT fallback, `MappingLUT::setEmpty`/`firstDestination` and the ChannelDataSink flags go, and ChannelDataSink and Drivers are main's again. The overflow and oversized-box guards stay. - **Light domain**: `chain` goes; PanelsLayout walks its panels with `wiringOrderP`, `X++P`, `Y++P` and `snakeP`, the system Panel and Cube use. Serpentine (`PanelLayout::forEachCell`) and `rotateP` count passes from the start corner, so the first pass follows its increment and stays upright on any row count, as Cube already did. - **Light domain**: the empty-run guard lives in `PanelRecorder` alone; `LightEmitter` and the relay forward every marker. - **Light domain**: `LightEmitter::placePlaced()` takes a child's whole counted range, as `place()` does. - **Light domain**: `LayoutBase::kPlacementControls` names the placement controls; a MoonLive layout declaring one is refused with an error status, in place of a second set of names. - **Core**: the host test seam `setTestAllocRefusedOnce` goes. - **Tests**: the eight wall patterns with per-axis settings, plus an even-row wall from the bottom-left, a columns-first wall from the right and an even-height serpentine panel; one masked-frame test for the ladder's four; two panels for a Grid before a script's leading marker; a short layout keeping the next one's index; a refused MoonLive layout; zero channels per light. - **Docs/CI**: placement in moonlight.md and the one-copy wording there and in adding-a-stream-source.md; reading the panel order off a wall in panel-cards.md and the Panels guide; MIGRATING for the pass-counted serpentine and the refused placement names; the plan's steps 3 and 5 done, its index regenerated; help and metrics regenerated. - **Reviews**: the maintainer review: second topic (masked frames, kept in its smallest form), two control-name sets, `chain` beside the `…P` controls, three empty-run guards, `placePlaced` padding, stale docs, untested guards, done; Codex authorship moved to the contributor. The Reviewer at commit time: serpentine and `rotateP` keyed on row parity (fixed by counting passes, the product owner's call A), the static_assert pinning nothing, the MoonLive card, the clash test's reach, the `placePlaced` doc, MIGRATING's reach and YX wording, the `rotateP` guide line, the YX far-start test, a negative card sentence, done. - **Docs/CI**: the KPI's ESP32 +3 KB is placement; a C3 build grows 3.2 KB against main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SP32 pin check GK-Triumvirate's fix, finished by the maintainer commit 6370f76, merged here so main's CI runs once for MoonModules#284 and MoonModules#285. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/reference/metrics/prose.json # docs/reference/metrics/repo-health.json # docs/reference/metrics/repo-health.md
7bc488b to
0d30a12
Compare
|
Merged, thanks @GK-Triumvirate! Placement on every layout and the whole-wall rotate, mirror and shape are in, and #284 rode along. What our maintainer commit changed, and why:
Before merging we checked it against main: every light, gap, panel record and mapping table over 41 setups came out byte for byte the same, and on an ESP32-C3 cube the tick, heap and fps matched. Looking forward to the 8-panel wall on this, and to the HTTPS idea when you get to it! |
What it changes, and why
This builds steps 3 and 5 of "Layouts that describe panels". Today every layout starts at (0, 0), so two layouts overlap. With this change they sit side by side on one wall.
Layoutsgetsrotate,mirrorandshape(rectangle, circle, ellipse). Lights outside the shape stay dark and keep their place on the wire, so HUB75 panel detection still works.PanelsLayoutgets eight named row patterns pluscustom.rotatePworks with all of them.Masked and very large walls also need these safety fixes:
Custom C++ layouts need one edit: rename
defineControls()todefineLayoutControls(). Saved settings and MoonLive scripts carry over.MIGRATING.mdand the tutorial cover this.Size
The diff is 42 files, +1733/−154, over the 400-line and ten-file guide. Of those, 273 changed lines are the generated
docs/help/help.json. Composition is one pull request because the plan says to split by topic, not by size. It also includes the chain patterns from step 5.What agents wrote and audited
cc404c9,49d2acfand07bf68d. Rebasedlayout-compositiononto77481a8, reviewed the mask and cache fixes with Codex, and ran the host test and doc/prose checks.1a9275a,cba664b,4867b02,9e77fd7and6e74f44. Compared the Pi and ESP32 HUB75 output in the code this builds on (972 of 972 cases match) and audited the rebased branch, finding the 32-bit overflow fixed in07bf68d.cc404c9and49d2acfaddress its P1/P2/P3 findings). Drafted this PR description.6ffead0,7387247,d1fc0b1: initial step 3 implementation and complexity/Vale fixes authored onGK-Triumvirate/MoonLight.Tested
On a Linux host at
07bf68d, based onmainat77481a8:mm_testsmm_scenarioscheck_docgen, changedsrc/filescheck_prose, changeddocs/filesgit diff --checkHardware (tested on Adafruit MatrixPortal S3,
esp32s3-qspi, ESP32-S3 rev v0.2, 8 MB QIO flash, 2 MB quad PSRAM, SDK v6.1.1):2× 128×64HUB75 panels stacked vertically (128×128,16,384lights) flashed via/firmware(7.1.0-dev.203, build07bf68de).Hub75reported256x64 (2x 128x64), 1/32 scan, 4-bit (LCD_CAM)at592 Hzrefresh onMatrixPortal S3with no errors or warnings.Panelsnamed chain (top-left serpentinehides custom per-axis controls,customrestores them),rotateP, whole-wallrotate/mirror/shape(circledarkens all 4 corners across both panels while keeping256x64 (2x 128x64), 1/32 scanintact), and Expert-mode multi-layout composition (Panelat(0, 0)+Panel-2at(0, 64),4 µs/2 µs).23m 35swith no resets:29 FPS,75 KBfree internal RAM (31 KBmax block),1.5 MBfree PSRAM.run_gates.py: not yet run.Follow-up commit:
7bc488bis acheck_codecleanup (simplifies layout/sink helpers and deduplicates masked-frame tests). CI passes on it: 16 checks passed, 9 skipped.Known limits
Codex noted two FSEQ issues that also exist on
mainat77481a8: