commit
21fe2c5f8f
@ -410,6 +410,44 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
|
|||||||
|
|
||||||
main = strip.getMainSegmentId();
|
main = strip.getMainSegmentId();
|
||||||
|
|
||||||
|
//set presets
|
||||||
|
pos = req.indexOf("P1="); //sets first preset for cycle
|
||||||
|
if (pos > 0) presetCycleMin = getNumVal(&req, pos);
|
||||||
|
|
||||||
|
pos = req.indexOf("P2="); //sets last preset for cycle
|
||||||
|
if (pos > 0) presetCycleMax = getNumVal(&req, pos);
|
||||||
|
|
||||||
|
//preset cycle
|
||||||
|
pos = req.indexOf("CY=");
|
||||||
|
if (pos > 0)
|
||||||
|
{
|
||||||
|
presetCyclingEnabled = (req.charAt(pos+3) != '0');
|
||||||
|
presetCycCurr = presetCycleMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = req.indexOf("PT="); //sets cycle time in ms
|
||||||
|
if (pos > 0) {
|
||||||
|
int v = getNumVal(&req, pos);
|
||||||
|
if (v > 49) presetCycleTime = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = req.indexOf("PA="); //apply brightness from preset
|
||||||
|
if (pos > 0) presetApplyBri = (req.charAt(pos+3) != '0');
|
||||||
|
|
||||||
|
pos = req.indexOf("PC="); //apply color from preset
|
||||||
|
if (pos > 0) presetApplyCol = (req.charAt(pos+3) != '0');
|
||||||
|
|
||||||
|
pos = req.indexOf("PX="); //apply effects from preset
|
||||||
|
if (pos > 0) presetApplyFx = (req.charAt(pos+3) != '0');
|
||||||
|
|
||||||
|
pos = req.indexOf("PS="); //saves current in preset
|
||||||
|
if (pos > 0) savePreset(getNumVal(&req, pos));
|
||||||
|
|
||||||
|
//apply preset
|
||||||
|
if (updateVal(&req, "PL=", &presetCycCurr, presetCycleMin, presetCycleMax)) {
|
||||||
|
applyPreset(presetCycCurr, presetApplyBri, presetApplyCol, presetApplyFx);
|
||||||
|
}
|
||||||
|
|
||||||
//set brightness
|
//set brightness
|
||||||
updateVal(&req, "&A=", &bri);
|
updateVal(&req, "&A=", &bri);
|
||||||
|
|
||||||
@ -574,44 +612,6 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
|
|||||||
if (countdownTime - now() > 0) countdownOverTriggered = false;
|
if (countdownTime - now() > 0) countdownOverTriggered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set presets
|
|
||||||
pos = req.indexOf("P1="); //sets first preset for cycle
|
|
||||||
if (pos > 0) presetCycleMin = getNumVal(&req, pos);
|
|
||||||
|
|
||||||
pos = req.indexOf("P2="); //sets last preset for cycle
|
|
||||||
if (pos > 0) presetCycleMax = getNumVal(&req, pos);
|
|
||||||
|
|
||||||
//preset cycle
|
|
||||||
pos = req.indexOf("CY=");
|
|
||||||
if (pos > 0)
|
|
||||||
{
|
|
||||||
presetCyclingEnabled = (req.charAt(pos+3) != '0');
|
|
||||||
presetCycCurr = presetCycleMin;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = req.indexOf("PT="); //sets cycle time in ms
|
|
||||||
if (pos > 0) {
|
|
||||||
int v = getNumVal(&req, pos);
|
|
||||||
if (v > 49) presetCycleTime = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = req.indexOf("PA="); //apply brightness from preset
|
|
||||||
if (pos > 0) presetApplyBri = (req.charAt(pos+3) != '0');
|
|
||||||
|
|
||||||
pos = req.indexOf("PC="); //apply color from preset
|
|
||||||
if (pos > 0) presetApplyCol = (req.charAt(pos+3) != '0');
|
|
||||||
|
|
||||||
pos = req.indexOf("PX="); //apply effects from preset
|
|
||||||
if (pos > 0) presetApplyFx = (req.charAt(pos+3) != '0');
|
|
||||||
|
|
||||||
pos = req.indexOf("PS="); //saves current in preset
|
|
||||||
if (pos > 0) savePreset(getNumVal(&req, pos));
|
|
||||||
|
|
||||||
//apply preset
|
|
||||||
if (updateVal(&req, "PL=", &presetCycCurr, presetCycleMin, presetCycleMax)) {
|
|
||||||
applyPreset(presetCycCurr, presetApplyBri, presetApplyCol, presetApplyFx);
|
|
||||||
}
|
|
||||||
|
|
||||||
//cronixie
|
//cronixie
|
||||||
#ifndef WLED_DISABLE_CRONIXIE
|
#ifndef WLED_DISABLE_CRONIXIE
|
||||||
//mode, 1 countdown
|
//mode, 1 countdown
|
||||||
|
@ -67,6 +67,9 @@ bool deserializeState(JsonObject root)
|
|||||||
strip.applyToAllSelected = false;
|
strip.applyToAllSelected = false;
|
||||||
bool stateResponse = root["v"] | false;
|
bool stateResponse = root["v"] | false;
|
||||||
|
|
||||||
|
int ps = root["ps"] | -1;
|
||||||
|
if (ps >= 0) applyPreset(ps);
|
||||||
|
|
||||||
bri = root["bri"] | bri;
|
bri = root["bri"] | bri;
|
||||||
|
|
||||||
bool on = root["on"] | (bri > 0);
|
bool on = root["on"] | (bri > 0);
|
||||||
@ -87,9 +90,6 @@ bool deserializeState(JsonObject root)
|
|||||||
jsonTransitionOnce = true;
|
jsonTransitionOnce = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ps = root["ps"] | -1;
|
|
||||||
if (ps >= 0) applyPreset(ps);
|
|
||||||
|
|
||||||
int cy = root["pl"] | -2;
|
int cy = root["pl"] | -2;
|
||||||
if (cy > -2) presetCyclingEnabled = (cy >= 0);
|
if (cy > -2) presetCyclingEnabled = (cy >= 0);
|
||||||
JsonObject ccnf = root["ccnf"];
|
JsonObject ccnf = root["ccnf"];
|
||||||
|
Loading…
Reference in New Issue
Block a user