Repository navigation
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is trying to achieve
Allow HUB75 panels to be arranged in something other than a single horizontal row — for
example four 64x32 panels stacked vertically into a 64x128 display.
Today this is not possible. A HUB75 chain is electrically always horizontal, so N panels
always form an area of
(panel width * N) x panel height. Declaring a different layout inthe 2D panel configuration only changes the logical area —
BusHub75Matrix::show()stillwalks the buffer using
display->width():So the same linear buffer is written with the logical width and read with the physical one,
and the image gets wrapped onto the chain. Measured on hardware: two 64x64 panels declared
as 64x128 with the upper half red showed red on the top half of both panels, instead of
red on the left panel and blue on the right.
Note the built-in preview (WebSocket live view) shows the logical area and therefore looks
correct — it is not usable as evidence for what actually reaches the panels.
How the code works
VirtualMatrixPanelfrom the DMA library already performs the logical-to-physical mapping,including all the chain-type variants. WLED-MM only ever creates it for four-scan panels, and
there hard-coded as
(1, chain_length, …)— always a single row.bus_manager.cpp— adefault:branch in the panel type switch now creates aVirtualMatrixPanelfor normal panel types too, as soon as rows or columns exceed 1.rows * columnsmust equal the chain length; otherwise the arrangement is ignored and awarning is printed.
bus_manager.h— the arrangement is carried in the existing buspinfield:[0][1][2][3]PANEL_CHAIN_TYPE(0 =CHAIN_NONE, 1..4 = the plain variants, 5..8 = the ZigZag variants)nPinsfor HUB75 goes from 1 to 4 andgetPins()reports the arrangement back — otherwiseonly the chain length survives a config save and the arrangement is silently lost.
Example for four 64x32 panels stacked vertically, chained bottom-left up in a zigzag:
pin: [4, 4, 1, 8].Backwards compatibility: unset values are normalised to 1, so an existing
pin: [2]becomes
[2, 1, 1, 0]. The arrangement stays dormant and behaviour is unchanged for everyexisting configuration.
wled.cpp— safety fuse. A bad arrangement could in theory stall during panelinitialisation; the web server would never come up and a device without USB access would be
unreachable. So
/vpanel_try.txtis written beforebeginStrip()and removed once the mainloop has been running for 20 s. If the marker is still present at boot, the arrangement is
skipped and the device boots normally. Deleting the file from the
/editpage arms it again.Both
wled.cppblocks are inside#ifdef WLED_ENABLE_HUB75MATRIX.Testing performed
adafruit_matrixportal_esp32s3_tinyUF2(HUB75 enabled) andesp32dev(HUB75 not enabled) both compile clean.
pin: [2, 2, 1, 8]): WLEDdistributes the logical image onto the correct chain positions. The panels are physically
mounted side by side, so this shows up as left/right — stacked it would be top/bottom.
21 s; a boot with the marker left in place skips the arrangement as intended.
Known limitations / where I'd like a second opinion
being built. Verified so far is the two-panel case above, which exercises the same code
path.
getCoords(), not by tryingthem on physical hardware. All eight stay within the area bounds (no out-of-range
writes), but I cannot claim from measurement which one matches a given physical wiring.
Only type 8 has actually been on a panel.
pinarray; there is no UI for it. I didnot want to touch the settings pages without knowing whether you'd want it there at all,
and if so, in what form. Happy to add it if you point me at the preferred place.
_vRows/_vColsasuint8_tto fit the existing pin array. That caps thearrangement at 255 in each direction, which seems far beyond anything practical, but say
the word if you'd rather have it typed differently.
AI assistance
Parts of this change were drafted with AI assistance. The relevant blocks are marked as such
in the code. I have gone through the result line by line, verified the behaviour on hardware
as described above, and left the surrounding existing comments untouched.
Summary by CodeRabbit