Merge branch 'bugfix' into 0_15

This commit is contained in:
Blaz Kristan 2023-10-01 13:27:18 +02:00
commit 76e0e935f0
6 changed files with 1543 additions and 1535 deletions

View File

@ -2276,7 +2276,7 @@ uint16_t mode_meteor() {
}
// draw meteor
for (int j = 0; j < meteorSize; j++) {
for (unsigned j = 0; j < meteorSize; j++) {
uint16_t index = in + j;
if (index >= SEGLEN) {
index -= SEGLEN;
@ -2315,7 +2315,7 @@ uint16_t mode_meteor_smooth() {
}
// draw meteor
for (int j = 0; j < meteorSize; j++) {
for (unsigned j = 0; j < meteorSize; j++) {
uint16_t index = in + j;
if (index >= SEGLEN) {
index -= SEGLEN;

View File

@ -1535,7 +1535,7 @@ void WS2812FX::purgeSegments(bool force) {
}
if (deleted) {
_segments.shrink_to_fit();
if (_mainSegment >= _segments.size()) setMainSegmentId(0);
/*if (_mainSegment >= _segments.size())*/ setMainSegmentId(0);
}
}

View File

@ -1034,6 +1034,7 @@ textarea {
/*padding: 1px 0 1px 20px;*/
display: var(--sgp);
width: 100%;
position: relative;
}
.pname {

View File

@ -845,7 +845,7 @@ function populateSegments(s)
}
if (segCount < 2) {
gId(`segd${lSeg}`).classList.add("hide");
gId(`segp0`).classList.add("hide");
if (parseInt(gId("seg0bri").value)==255) gId(`segp0`).classList.add("hide");
}
if (!isM && !noNewSegs && (cfg.comp.seglen?parseInt(gId(`seg${lSeg}s`).value):0)+parseInt(gId(`seg${lSeg}e`).value)<ledCount) gId(`segr${lSeg}`).classList.remove("hide");
gId('segutil2').style.display = (segCount > 1) ? "block":"none"; // rsbtn parent

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@ bool deserializeSegment(JsonObject elem, byte it, byte presetId)
byte id = elem["id"] | it;
if (id >= strip.getMaxSegments()) return false;
bool newSeg = false;
int stop = elem["stop"] | -1;
// append segment
@ -27,6 +28,7 @@ bool deserializeSegment(JsonObject elem, byte it, byte presetId)
if (stop <= 0) return false; // ignore empty/inactive segments
strip.appendSegment(Segment(0, strip.getLengthTotal()));
id = strip.getSegmentsNum()-1; // segments are added at the end of list
newSeg = true;
}
//DEBUG_PRINTLN("-- JSON deserialize segment.");
@ -118,8 +120,12 @@ bool deserializeSegment(JsonObject elem, byte it, byte presetId)
// do not call seg.setUp() here, as it may cause a crash due to concurrent access if the segment is currently drawing effects
// WS2812FX handles queueing of the change
strip.setSegment(id, start, stop, grp, spc, of, startY, stopY);
if (newSeg) seg.refreshLightCapabilities(); // fix for #3403
if (seg.reset && seg.stop == 0) return true; // segment was deleted & is marked for reset, no need to change anything else
if (seg.reset && seg.stop == 0) {
if (id == strip.getMainSegmentId()) strip.setMainSegmentId(0); // fix for #3403
return true; // segment was deleted & is marked for reset, no need to change anything else
}
byte segbri = seg.opacity;
if (getVal(elem["bri"], &segbri)) {