Skip to content

Ignore unused HUB75 address pins during ESP32 pin checks - #284

Merged
ewowi merged 3 commits into
MoonModules:mainfrom
GK-Triumvirate:hub75-unused-addr-pins
Dec 3, 2026
Merged

ewowi merged 3 commits into
MoonModules:mainfrom
GK-Triumvirate:hub75-unused-addr-pins

Conversation

@GK-Triumvirate

@GK-Triumvirate GK-Triumvirate commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What it changes, and why

A HUB75 panel uses fewer address lines at a narrower scan: A-B at 1/4, A-C at 1/8, A-D at 1/16. buildPinOrder() in platform_esp32_hub75.cpp already follows this: it limits the address lines with hub75AddressBits(scanRate) and parks the rest at GPIO_NUM_NC.

Hub75BusOutput::checkPins() checked all five lines (A-E) at every scan rate. An unused upper address line on a reserved or input-only GPIO made it refuse the panel before init.

  • Check only the active address lines. checkPins() now uses the same hub75AddressBits() limit. This covers explicit folded-scan overrides too.
  • Active lines are still refused. An active line on a reserved or input-only GPIO still stops the panel, and the status names it.
  • Board pins stay reported. fixedPins() still reports all 14 soldered lines on published boards.

New unit tests cover 1/4, 1/8, 1/16 and a 16-row panel set to a folded 1/4 scan. The 1/8 and 1/16 cases also check that a bad active pin is refused.

Size

The diff is 2 files, +80/−8: src/light/drivers/Hub75BusOutput.h and test/unit/light/unit_Hub75Driver_pins.cpp.

What agents wrote and audited

  • OpenAI Codex: found this P2 mismatch in the geometry/HUB75 audit (ML-002). Verified the fix at b9f1249 against platform_esp32_hub75.cpp (PASS).
  • Antigravity: wrote the fix and regression tests in b9f1249, and ran the host tests and static checks.
  • Claude Code: drafted this PR description.

Tested

On a Linux host at b9f1249, based on main at 77481a8:

Check Result
mm_tests 4,281 of 4,281 passed (874,312 assertions)
HUB75 cases in mm_tests 187 of 187 passed (2,768 assertions)
mm_scenarios 18 of 18 passed; 19 live-only scenarios skipped
JavaScript tests 582 of 582 passed
check_docgen.py, changed files 0 errors, 0 warnings
check_code.py, changed files 0 errors, 0 warnings
git diff --check clean

Hardware (tested on Adafruit MatrixPortal S3, esp32s3-qspi, ESP32-S3 rev v0.2, 8 MB QIO flash, 2 MB quad PSRAM, SDK v6.1.1):

  • Flashed via /firmware (7.1.0-dev.193, build b9f1249d) with 2× 128×64 HUB75 panels stacked vertically (256x64 (2x 128x64), 4-bit (LCD_CAM) at 579 Hz).
  • Tested reserved flash pin GPIO 26 across scan modes on Custom (pre-filled from MatrixPortal S3):
    • scan = auto (1/32), e = 26: refused with e on GPIO 26 is wired to flash/PSRAM on this chip.
    • scan = 1/16, e = 26: accepted (256x64 (2x 128x64), 1/16 scan, 4-bit (LCD_CAM), 579 Hz).
    • scan = 1/16, d = 26: refused with d on GPIO 26 is wired to flash/PSRAM on this chip.
    • scan = 1/8, d = 26: accepted (256x64 (2x 128x64), 1/8 scan, 4-bit (LCD_CAM)).
    • scan = 1/8, c = 26: refused with c on GPIO 26 is wired to flash/PSRAM on this chip.

run_gates.py: not yet run. The individual host, docgen and code checks above passed.

Follow-up commit: 70b6e0a is a check_code cleanup (deduplicates the MatrixPortal S3 pin test helpers). CI passes on it: 16 checks passed, 9 skipped.

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.
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@ewowi

ewowi commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Thanks @GK-Triumvirate, a clean fix: the pin check now follows the same hub75AddressBits() as buildPinOrder(), and your MatrixPortal runs per scan back the tests. Nothing blocks.

We finish it in a maintainer commit with two small things:

  • lines() picks the address range by table index (i >= 6 && i <= 10); named constants keep it right if the table is ever reordered.
  • prepareMatrixPortal() leaves the driver pointing at a Layer that dies when the helper returns. Nothing reads it today, but a fixture struct owning layouts, grid, layer and driver is the safer shape for the next test.

Merging after that.

…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>
@ewowi
ewowi merged commit 0d30a12 into MoonModules:main Dec 3, 2026
25 of 26 checks passed
@ewowi

ewowi commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Merged, thanks @GK-Triumvirate! It went in together with #285, so main's CI ran once for both.

Our maintainer commit named the address-line range (kFirstAddrLine, kAddrLines) instead of the table indexes, and gave the pin test a rig that owns the layout and layer its driver points at. Your MatrixPortal runs per scan made this one easy to trust.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants