Merge branch '0_14' of https://github.com/aircoookie/WLED into merge-0_14
This commit is contained in:
commit
8d372bee67
@ -114,8 +114,8 @@ class Animated_Staircase : public Usermod {
|
||||
|
||||
// We may need to copy mode and colors from segment 0 to make sure
|
||||
// changes are propagated even when the config is changed during a wipe
|
||||
// segments->mode = mainsegment.mode;
|
||||
// segments->colors[0] = mainsegment.colors[0];
|
||||
// seg.setMode(mainsegment.mode);
|
||||
// seg.setColor(0, mainsegment.colors[0]);
|
||||
} else {
|
||||
seg.setOption(SEG_OPTION_ON, false);
|
||||
}
|
||||
|
@ -531,11 +531,11 @@ public:
|
||||
for (byte i=0; i<strip.getSegmentsNum(); i++) {
|
||||
Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive()) continue;
|
||||
strip.setMode(i, effectCurrent);
|
||||
seg.setMode(effectCurrent);
|
||||
}
|
||||
} else {
|
||||
//Segment& seg = strip.getSegment(strip.getMainSegmentId());
|
||||
strip.setMode(strip.getMainSegmentId(), effectCurrent);
|
||||
Segment& seg = strip.getSegment(strip.getMainSegmentId());
|
||||
seg.setMode(effectCurrent);
|
||||
}
|
||||
lampUdated();
|
||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||
@ -661,11 +661,11 @@ public:
|
||||
for (byte i=0; i<strip.getSegmentsNum(); i++) {
|
||||
Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive()) continue;
|
||||
seg.palette = effectPalette;
|
||||
seg.setPalette(effectPalette);
|
||||
}
|
||||
} else {
|
||||
Segment& seg = strip.getSegment(strip.getMainSegmentId());
|
||||
seg.palette = effectPalette;
|
||||
seg.setPalette(effectPalette);
|
||||
}
|
||||
lampUdated();
|
||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||
|
@ -397,6 +397,7 @@ void Segment::setOption(uint8_t n, bool val) {
|
||||
}
|
||||
|
||||
void Segment::setMode(uint8_t fx, bool loadDefaults) {
|
||||
// if we have a valid mode & is not reserved
|
||||
if (fx < strip.getModeCount() && strncmp_P("RSVD", strip.getModeData(fx), 4)) {
|
||||
if (fx != mode) {
|
||||
startTransition(strip.getTransition()); // set effect transitions
|
||||
@ -429,10 +430,12 @@ void Segment::setMode(uint8_t fx, bool loadDefaults) {
|
||||
}
|
||||
|
||||
void Segment::setPalette(uint8_t pal) {
|
||||
if (pal < strip.getPaletteCount()) {
|
||||
if (pal != palette) {
|
||||
if (strip.paletteFade && !transitional) startTransition(strip.getTransition());
|
||||
if (strip.paletteFade) startTransition(strip.getTransition());
|
||||
palette = pal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2D matrix
|
||||
|
@ -174,18 +174,16 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
||||
byte fx = seg.mode;
|
||||
if (getVal(elem["fx"], &fx, 0, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 0-255 exact value)
|
||||
if (!presetId && currentPlaylist>=0) unloadPlaylist();
|
||||
if (fx != seg.mode) {
|
||||
seg.setMode(fx, elem[F("fxdef")]);
|
||||
}
|
||||
if (fx != seg.mode) seg.setMode(fx, elem[F("fxdef")]);
|
||||
}
|
||||
|
||||
//getVal also supports inc/decrementing and random
|
||||
getVal(elem["sx"], &seg.speed);
|
||||
getVal(elem["ix"], &seg.intensity);
|
||||
|
||||
uint8_t pal = seg.palette;
|
||||
if (getVal(elem["pal"], &pal, 1, strip.getPaletteCount())) {
|
||||
seg.setPalette(pal);
|
||||
}
|
||||
if (getVal(elem["pal"], &pal, 1, strip.getPaletteCount())) seg.setPalette(pal);
|
||||
|
||||
getVal(elem["c1"], &seg.custom1);
|
||||
getVal(elem["c2"], &seg.custom2);
|
||||
uint8_t cust3 = seg.custom3;
|
||||
|
@ -888,17 +888,10 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
|
||||
for (uint8_t i = 0; i < strip.getSegmentsNum(); i++) {
|
||||
Segment& seg = strip.getSegment(i);
|
||||
if (i != selectedSeg && (singleSegment || !seg.isActive() || !seg.isSelected())) continue; // skip non main segments if not applying to all
|
||||
if (fxModeChanged) {
|
||||
seg.startTransition(strip.getTransition());
|
||||
seg.mode = effectIn;
|
||||
// TODO: we should load defaults here as well
|
||||
}
|
||||
if (fxModeChanged) seg.setMode(effectIn, req.indexOf(F("FXD="))>0); // apply defaults if FXD= is specified
|
||||
if (speedChanged) seg.speed = speedIn;
|
||||
if (intensityChanged) seg.intensity = intensityIn;
|
||||
if (paletteChanged) {
|
||||
if (strip.paletteBlend) seg.startTransition(strip.getTransition());
|
||||
seg.palette = paletteIn;
|
||||
}
|
||||
if (paletteChanged) seg.setPalette(paletteIn);
|
||||
}
|
||||
|
||||
//set advanced overlay
|
||||
|
Loading…
Reference in New Issue
Block a user