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
Reset Segments does not respect 'Make a segment for each output' #4136
#!/bin/bash# Look at PR `#4287` that was referenced
gh pr view 4287 --repo wled/WLED --json title,body,files | jq '.'
Length of output: 699
🏁 Script executed:
#!/bin/bash# Search for reset segments functionality
rg -n "resetSegments\|makeSegmentDefault\|segmentBounds\|autoSegments\|autoCreateSegments" --type cpp -C3
# Also search for the "Make a segment for each output" setting
rg -n "autoSegments\|auto_segments\|e131Multicast\|multistrip\|autoCreateSeg" --type cpp -C3
Length of output: 559
🏁 Script executed:
#!/bin/bash# Search for the reset segments UI action / function
rg -n -i "resetSeg\|reset.*seg\|seg.*reset" --type cpp -C5
Length of output: 366
🏁 Script executed:
#!/bin/bash# Try searching without --type flag
rg -n "resetSegments\|autoSegments\|autoCreateSeg" -C3
rg -n -i "reset.*seg\|seg.*reset" -C3
Length of output: 384
🏁 Script executed:
#!/bin/bash# Find what source files exist
fd -e cpp -e h -e ino | head -50
Length of output: 2056
🏁 Script executed:
#!/bin/bash# List files in wled00
fd -e cpp -e h -e ino . wled00/
# Search for reset segment logic in wled00
grep -rn "resetSegments\|autoSeg\|makeSegment\|segmentsFrom\|Segment_Output\|each.*output\|output.*seg" wled00/ -C3
Length of output: 11191
🏁 Script executed:
#!/bin/bash# Search for the specific functionality - "Make a segment for each output"
grep -rn "autoSeg\|makeEachSeg\|each_seg\|eachSeg\|auto_seg" wled00/ -C3
# Search for reset/default segment functions
grep -rn "resetSeg\|defaultSeg\|initSeg" wled00/ -C3
Length of output: 7177
🏁 Script executed:
#!/bin/bash# Get the full resetSegments and makeAutoSegments functions
sed -n '1960,2060p' wled00/FX_fcn.cpp
Length of output: 4070
🏁 Script executed:
#!/bin/bash# Find where "Reset Segments" is called from the UI / JSON API
grep -rn "resetSeg\|RST\|\"rs\"\|resetpresets\|clearSegs\|reloadsegs" wled00/ -C3 | grep -v "ota_update\|wled.cpp\|FX_fcn\|FX_2D\|FX.h"
Length of output: 10881
🏁 Script executed:
#!/bin/bash# Find where the "Reset Segments" button calls from - look in json.cpp and the segment UI
grep -n "resetSeg\|\"seg\"\|clearSeg\|seg.*clear\|\"on\"\|rSeg\|rs\"" wled00/json.cpp | head -60
# Also look for where segments are reset via JSON API (the main segment reset endpoint)
grep -n "resetSegments\|makeAutoSegments" wled00/json.cpp wled00/led.cpp wled00/wled.cpp wled00/cfg.cpp
Length of output: 1718
🏁 Script executed:
#!/bin/bash# Look for the "Reset" segment button in the UI HTML
grep -n -i "reset\|\"rs\"\|rseg\|reset_seg" wled00/data/index.htm | head -30
Length of output: 618
🏁 Script executed:
#!/bin/bash# Find the rSegs() JS function
grep -n "rSegs\|function rS" wled00/data/index.htm | head -20
# Get the surrounding context of rSegs
grep -n -A 15 "function rSegs" wled00/data/index.htm
Length of output: 526
🏁 Script executed:
#!/bin/bash# Search all files for rSegs function definition
grep -rn "function rSegs\|rSegs\s*=" wled00/data/
# Also check if there's a separate JS file
fd -e js . wled00/data/
Length of output: 553
🏁 Script executed:
#!/bin/bash# Look at the full index.htm for rSegs context (the function may be inline but minified)
grep -n "rSegs" wled00/data/index.htm
# Check the JavaScript section around line 284
sed -n '270,300p' wled00/data/index.htm
Length of output: 1642
🏁 Script executed:
#!/bin/bash# Get the rSegs function from index.js
sed -n '2805,2830p' wled00/data/index.js
Length of output: 664
🏁 Script executed:
#!/bin/bash# Look at json.cpp around the segment processing / suspension area
grep -n "suspend\|resume\|makeAuto\|resetSeg\|seg\b" wled00/json.cpp | head -40
# Get segment processing context in deserializeState
sed -n '450,530p' wled00/json.cpp
Length of output: 5709
@DedeHai — yes, this is still present in current main. Here's the full picture:
Root cause
rSegs() in wled00/data/index.js (line 2810) manually constructs a JSON payload that always resets to a single full-strip segment:
varobj={"seg":[{"start":0,"stop":ledCount,"sel":true}]};// ...for(leti=1;i<=lSeg;i++)obj.seg.push({"stop":0});// delete all othersrequestJson(obj);
It completely bypasses strip.autoSegments. The backend function makeAutoSegments(true) already does the right thing for both cases:
autoSegments = true → creates one segment per bus
autoSegments = false → calls resetSegments() → single full-strip segment
But rSegs() never calls it.
Simplest fix — two small changes
1. wled00/json.cpp — add a "rSeg" key handler in deserializeState() (after the existing segVar block, around line ~510):
if (root[F("rSeg")] | false) {
strip.suspend();
strip.waitForIt();
strip.makeAutoSegments(true); // respects autoSegments flag
strip.resume();
stateChanged = true;
}
2. wled00/data/index.js — simplify rSegs() to use the new key (removes the manual segment construction entirely):
Activity
softhack007 commentedon Nov 22, 2024
Might be good to unterstand what's going on before we release 0.15.0-RC1 #4287
blazoncek commentedon Nov 25, 2024
This behaviour is present since introduction of multistrip in 2021.
netmindz commentedon Nov 27, 2024
If this isn't a regression, then I would vote to remove this as a blocking issue for the 0.15.0 release
softhack007 commentedon Nov 27, 2024
I agree
blazoncek commentedon Nov 27, 2024
reset.mov
If you decide you need it.
DedeHai commentedon Jun 21, 2026
@coderabbitai is this still an issue in current main code? if so what is the simplest fix?
coderabbitai commentedon Jun 21, 2026
🧩 Analysis chain
🏁 Script executed:
Length of output: 4567
🏁 Script executed:
Length of output: 699
🏁 Script executed:
Length of output: 559
🏁 Script executed:
Length of output: 366
🏁 Script executed:
Length of output: 384
🏁 Script executed:
Length of output: 2056
🏁 Script executed:
Length of output: 11191
🏁 Script executed:
Length of output: 7177
🏁 Script executed:
Length of output: 4070
🏁 Script executed:
Length of output: 10881
🏁 Script executed:
Length of output: 1718
🏁 Script executed:
Length of output: 618
🏁 Script executed:
Length of output: 526
🏁 Script executed:
Length of output: 553
🏁 Script executed:
Length of output: 1642
🏁 Script executed:
Length of output: 664
🏁 Script executed:
Length of output: 5709
@DedeHai— yes, this is still present in current main. Here's the full picture:Root cause
rSegs()inwled00/data/index.js(line 2810) manually constructs a JSON payload that always resets to a single full-strip segment:It completely bypasses
strip.autoSegments. The backend functionmakeAutoSegments(true)already does the right thing for both cases:autoSegments = true→ creates one segment per busautoSegments = false→ callsresetSegments()→ single full-strip segmentBut
rSegs()never calls it.Simplest fix — two small changes
1.
wled00/json.cpp— add a"rSeg"key handler indeserializeState()(after the existingsegVarblock, around line ~510):2.
wled00/data/index.js— simplifyrSegs()to use the new key (removes the manual segment construction entirely):Why this is safe
makeAutoSegments(true)whenautoSegments=truecreates per-bus segments directly without callingresetSegments().strip.resetSegments()directly.deserializeState()already usesstrip.suspend()/strip.waitForIt()/strip.resume()for segment mutations — same pattern applies here.