You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sparse map followed by trailing strip is not supported #5529
My setup is the following:
I have matrix with a sparse map, and a strip. Both are on different pin.
I attached my json file: ledmap (3).json
The matrix is followed by a strip.
However if I want to add new segment for the strip started 756 to 817 (as my map has lot of dummy pixels), it is not allowed, I cannot click on the thick to create a segment.
I found a workaround. extend my strip in the led config settings to 817, and this way I am able to create the segment, But that is unitutive, and I feel I deceived wled, so it is not an intended use case.
To Reproduce Bug
upload the attached json
create the strips as the image shows. (second stip lenght should be 61 and not 694)
- create 2d matrix 28x27
- create a second segment started from 756 to 817. It is not allowed, as the strip starts from 123 if I count in real pixels. but If I set it to 123 the segment box doesnt change to stip mode.
Expected Behavior
I would like to create sparse map matrix followed by a strip.
Install Method
Binary from WLED.me
What version of WLED?
WLED version 17.0.0-dev (But it is the same on other releases as well)
Which microcontroller/board are you seeing the problem on?
I don't understand.
To me led & hardware page should be about the physical part of the setup. To be able to use my strip, I have to "fake" the led setup, like I did on the screenshot.
Also this mixup confuses ledfx, because it thinks that I actually have that amount of pixel.
Don't mix WLED's ability to create "fake" matrix using ledmap with what actual matrices are.
If you think WLED should handle your configuration, please explain how should it do it in the following scenario:
4 outputs configured with 100 LEDSs each
ledmap with 25x25 dimensions and 625 entries
4th output is intended to be used as a trailing strip
IMO if you want to use trailing strip your matrix has to be "full" (populated with LEDs and gapfile used to exclude some LEDs from displaying). Otherwise WLED can't determine which LED is the starting LED for strip.
Maybe I am using WLED in a wrong way but if that is the case then tell me how should I configure my setup then.
I attach few pictures of my setup (party printer), which explains why I want to set it up this way. I know it is not the most serious use case, kinda pointless, but probably wled is not about seriosness. :)
Am also avaible for short call if that would help to clarify things. Maybe we misscomunicating smth.
I think LED & Hardware menu section should be about the actual hardware setup, number of physical pixels.
And the 2D config screen should be where I configure the layout of these pixels and extend with virtual ones as well.
When I create a new segment after the 2d matrix the limit should be the number of real pixels, but the total number of pixels.
4 outputs configured with 100 LEDSs each -> This is what I would setup in the LED & Hardware menu
ledmap with 25x25 dimensions and 625 entries -> I would create the matrixs, in settings, and upload the maps.
4th output is intended to be used as a trailing strip -> this should start after the last led (which should be higher then the total physical number of LEDs )
The current issue is that I cannot create segment above the number of physical pixels, even though my setup contains "virtual" pixels as well. The limit should be coming from the total number of pixels, not the physical pixels.
#!/bin/bashset -euo pipefail
sed -n '1,130p' wled00/FX_2Dfcn.cpp
Length of output: 6231
Analysis: Can sparse ledmap + trailing strip be supported?
@DedeHai, confirmed — this can be supported, but it does need a real (if scoped) structural change, not a one-line fix.
The root cause is exactly what you suspected: WS2812FX::getLengthTotal() in wled00/FX_fcn.cpp (lines 1909-1912) grants trailing-strip addressing only when
if (isMatrix && _length > len) len = _length; // len = Segment::maxWidth*Segment::maxHeight
i.e., only when total physical LEDs (_length) exceeds the full logical grid size (width*height). For a sparse setup, _length is smaller than the grid size by design (that's the point of sparsity), so this condition never triggers — the extra bus's LEDs never get exposed as a trailing range.
This same limitation shows up in two places:
WS2812FX::setUpMatrix() (wled00/FX_2Dfcn.cpp, ~lines 20-110): it already tracks a pix counter that counts only the actually-used physical LEDs while walking panels/gaps, skipping -1 gap entries. But the trailing-fill loop (for (i = matrixSize; i < getLengthTotal(); i++) customMappingTable[i] = i;) is keyed off matrixSize (logical cell count), not off pix (actual physical LEDs consumed) — so it never runs when matrixSize >= getLengthTotal().
WS2812FX::deserializeMap() (wled00/FX_fcn.cpp, ~lines 2156-2183): for manually uploaded ledmap.json, the mapping buffer is allocated with size getLengthTotal()before the file is read, and entries beyond that are explicitly discarded (if (customMappingSize >= getLengthTotal()) break;). So even a user-crafted map with extra trailing indices gets truncated whenever _length <= matrixSize.
A feasible fix would decouple "trailing capacity" from the raw _length vs. matrixSize product comparison, and instead base it on "physical LEDs not consumed by the matrix mapping":
Persist the pix (used-LED) count from setUpMatrix() as a stored value.
Redefine getLengthTotal() as matrixSize + (_length - usedMatrixLeds).
Start the identity-mapped trailing range at usedMatrixLeds instead of matrixSize inside setUpMatrix().
For manually-uploaded ledmaps, this info isn't known until the file is parsed, so it'd need either a two-pass parse of the map array or an explicit "total length" field in ledmap.json rather than deriving it implicitly.
This is scoped to FX_fcn.cpp/FX_2Dfcn.cpp addressing logic and doesn't require reworking the segment/bus model overall, so it's a legitimate enhancement rather than a redesign — consistent with it being filed as a feature request rather than a bug.
Happy to draft a concrete implementation plan if you want to move forward with it.
Activity
DedeHai commentedon Apr 23, 2026
Confirmed, the issue is that for trailing to work, total leds currently must be larger than matrix size, which is not fulfilled for sparse setups
blazoncek commentedon Apr 25, 2026
FYI that was intentional and by design when I implemented it. KB also mentions tha all LEDS must be accounted for in matrix.
This is not a bug but request for enhancement.
ttadam commentedon Apr 25, 2026
I don't understand.
To me led & hardware page should be about the physical part of the setup. To be able to use my strip, I have to "fake" the led setup, like I did on the screenshot.
Also this mixup confuses ledfx, because it thinks that I actually have that amount of pixel.
blazoncek commentedon Apr 26, 2026
Indeed you faked it.
Don't mix WLED's ability to create "fake" matrix using ledmap with what actual matrices are.
If you think WLED should handle your configuration, please explain how should it do it in the following scenario:
IMO if you want to use trailing strip your matrix has to be "full" (populated with LEDs and gapfile used to exclude some LEDs from displaying). Otherwise WLED can't determine which LED is the starting LED for strip.
ttadam commentedon Apr 26, 2026
Maybe I am using WLED in a wrong way but if that is the case then tell me how should I configure my setup then.
I attach few pictures of my setup (party printer), which explains why I want to set it up this way. I know it is not the most serious use case, kinda pointless, but probably wled is not about seriosness. :)
Am also avaible for short call if that would help to clarify things. Maybe we misscomunicating smth.
I think LED & Hardware menu section should be about the actual hardware setup, number of physical pixels.
And the 2D config screen should be where I configure the layout of these pixels and extend with virtual ones as well.
When I create a new segment after the 2d matrix the limit should be the number of real pixels, but the total number of pixels.
4 outputs configured with 100 LEDSs each -> This is what I would setup in the LED & Hardware menu
ledmap with 25x25 dimensions and 625 entries -> I would create the matrixs, in settings, and upload the maps.
4th output is intended to be used as a trailing strip -> this should start after the last led (which should be higher then the total physical number of LEDs )
The current issue is that I cannot create segment above the number of physical pixels, even though my setup contains "virtual" pixels as well. The limit should be coming from the total number of pixels, not the physical pixels.
DedeHai commentedon Apr 29, 2026
you are not doing anything wrong, it is simply not supported at this point.
DedeHai commentedon Jul 9, 2026
@coderabbitai please check if sparse map with trailing strip can be supported in current structure
coderabbitai commentedon Jul 9, 2026
🧩 Analysis chain
🏁 Script executed:
Length of output: 399
🏁 Script executed:
Length of output: 1093
🏁 Script executed:
Length of output: 684
🏁 Script executed:
Length of output: 4795
🏁 Script executed:
Length of output: 6952
🏁 Script executed:
Length of output: 1184
🏁 Script executed:
Length of output: 4691
🏁 Script executed:
Length of output: 1683
🏁 Script executed:
Length of output: 6231
Analysis: Can sparse ledmap + trailing strip be supported?
@DedeHai, confirmed — this can be supported, but it does need a real (if scoped) structural change, not a one-line fix.The root cause is exactly what you suspected:
WS2812FX::getLengthTotal()inwled00/FX_fcn.cpp(lines 1909-1912) grants trailing-strip addressing only wheni.e., only when total physical LEDs (
_length) exceeds the full logical grid size (width*height). For a sparse setup,_lengthis smaller than the grid size by design (that's the point of sparsity), so this condition never triggers — the extra bus's LEDs never get exposed as a trailing range.This same limitation shows up in two places:
WS2812FX::setUpMatrix()(wled00/FX_2Dfcn.cpp, ~lines 20-110): it already tracks apixcounter that counts only the actually-used physical LEDs while walking panels/gaps, skipping-1gap entries. But the trailing-fill loop (for (i = matrixSize; i < getLengthTotal(); i++) customMappingTable[i] = i;) is keyed offmatrixSize(logical cell count), not offpix(actual physical LEDs consumed) — so it never runs whenmatrixSize >= getLengthTotal().WS2812FX::deserializeMap()(wled00/FX_fcn.cpp, ~lines 2156-2183): for manually uploadedledmap.json, the mapping buffer is allocated with sizegetLengthTotal()before the file is read, and entries beyond that are explicitly discarded (if (customMappingSize >= getLengthTotal()) break;). So even a user-crafted map with extra trailing indices gets truncated whenever_length <= matrixSize.A feasible fix would decouple "trailing capacity" from the raw
_lengthvs.matrixSizeproduct comparison, and instead base it on "physical LEDs not consumed by the matrix mapping":pix(used-LED) count fromsetUpMatrix()as a stored value.getLengthTotal()asmatrixSize + (_length - usedMatrixLeds).usedMatrixLedsinstead ofmatrixSizeinsidesetUpMatrix().ledmap.jsonrather than deriving it implicitly.This is scoped to
FX_fcn.cpp/FX_2Dfcn.cppaddressing logic and doesn't require reworking the segment/bus model overall, so it's a legitimate enhancement rather than a redesign — consistent with it being filed as a feature request rather than a bug.Happy to draft a concrete implementation plan if you want to move forward with it.
ttadam commentedon Jul 19, 2026
Thank you! :)