Removed preset cycle
This commit is contained in:
parent
599a456c81
commit
200960899e
@ -5,6 +5,8 @@
|
||||
#### Build 2106300
|
||||
|
||||
- Version bump to 0.13.0-b0 "Toki"
|
||||
- BREAKING: Removed preset cycle (use playlists)
|
||||
- BREAKING: Removed `nl.fade`, `leds.pin` and `ccnf` from JSON API
|
||||
- Added playlist editor UI
|
||||
- Reordered segment UI and added offset field
|
||||
- Raised maximum MQTT password length to 64 (closes #1373)
|
||||
|
@ -222,15 +222,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
CJSON(turnOnAtBoot, def["on"]); // true
|
||||
CJSON(briS, def["bri"]); // 128
|
||||
|
||||
JsonObject def_cy = def[F("cy")];
|
||||
CJSON(presetCyclingEnabled, def_cy["on"]);
|
||||
|
||||
CJSON(presetCycleMin, def_cy[F("range")][0]);
|
||||
CJSON(presetCycleMax, def_cy[F("range")][1]);
|
||||
|
||||
tdd = def_cy["dur"] | -1;
|
||||
if (tdd > 0) presetCycleTime = tdd;
|
||||
|
||||
JsonObject interfaces = doc["if"];
|
||||
|
||||
JsonObject if_sync = interfaces[F("sync")];
|
||||
@ -588,17 +579,6 @@ void serializeConfig() {
|
||||
def["on"] = turnOnAtBoot;
|
||||
def["bri"] = briS;
|
||||
|
||||
//to be removed once preset cycles are presets
|
||||
if (saveCurrPresetCycConf) {
|
||||
JsonObject def_cy = def.createNestedObject("cy");
|
||||
def_cy["on"] = presetCyclingEnabled;
|
||||
|
||||
JsonArray def_cy_range = def_cy.createNestedArray(F("range"));
|
||||
def_cy_range.add(presetCycleMin);
|
||||
def_cy_range.add(presetCycleMax);
|
||||
def_cy["dur"] = presetCycleTime;
|
||||
}
|
||||
|
||||
JsonObject interfaces = doc.createNestedObject("if");
|
||||
|
||||
JsonObject if_sync = interfaces.createNestedObject("sync");
|
||||
|
@ -366,8 +366,7 @@ Reverse (rotated 180°): <input type="checkbox" name="CV${i}">
|
||||
Turn LEDs on after power up/reset: <input type="checkbox" name="BO"><br>
|
||||
Default brightness: <input name="CA" type="number" min="0" max="255" required> (0-255)<br><br>
|
||||
Apply preset <input name="BP" type="number" min="0" max="250" required> at boot (0 uses defaults)
|
||||
<br>- <i>or</i> -<br>
|
||||
Set current preset cycle setting as boot default: <input type="checkbox" name="PC"><br><br>
|
||||
<br><br>
|
||||
Use Gamma correction for color: <input type="checkbox" name="GC"> (strongly recommended)<br>
|
||||
Use Gamma correction for brightness: <input type="checkbox" name="GB"> (not recommended)<br><br>
|
||||
Brightness factor: <input name="BF" type="number" min="1" max="255" required> %
|
||||
|
@ -128,28 +128,27 @@ type="checkbox" name="RM"><span style="cursor:pointer" onclick='off("RL")'>
|
||||
Turn LEDs on after power up/reset: <input type="checkbox" name="BO"><br>
|
||||
Default brightness: <input name="CA" type="number" min="0" max="255" required>
|
||||
(0-255)<br><br>Apply preset <input name="BP" type="number" min="0" max="250"
|
||||
required> at boot (0 uses defaults)<br>- <i>or</i> -<br>
|
||||
Set current preset cycle setting as boot default: <input type="checkbox"
|
||||
name="PC"><br><br>Use Gamma correction for color: <input type="checkbox"
|
||||
name="GC"> (strongly recommended)<br>Use Gamma correction for brightness: <input
|
||||
type="checkbox" name="GB"> (not recommended)<br><br>Brightness factor: <input
|
||||
name="BF" type="number" min="1" max="255" required> %<h3>Transitions</h3>
|
||||
Crossfade: <input type="checkbox" name="TF"><br>Transition Time: <input
|
||||
name="TD" maxlength="5" size="2"> ms<br>Enable Palette transitions: <input
|
||||
type="checkbox" name="PF"><h3>Timed light</h3>Default Duration: <input
|
||||
name="TL" type="number" min="1" max="255" required> min<br>
|
||||
Default Target brightness: <input name="TB" type="number" min="0" max="255"
|
||||
required><br>Mode: <select name="TW"><option value="0">Wait and set</option>
|
||||
<option value="1">Fade</option><option value="2">Fade Color</option><option
|
||||
value="3">Sunrise</option></select><h3>Advanced</h3>Palette blending: <select
|
||||
name="PB"><option value="0">Linear (wrap if moving)</option><option value="1">
|
||||
Linear (always wrap)</option><option value="2">Linear (never wrap)</option>
|
||||
<option value="3">None (not recommended)</option></select><br><span class="wc">
|
||||
Auto-calculate white channel from RGB:<br><select name="AW"><option value="0">
|
||||
None</option><option value="1">Brighter</option><option value="2">Accurate
|
||||
</option><option value="3">Dual</option><option value="4">Legacy</option>
|
||||
</select><br></span><hr><button type="button" onclick="B()">Back</button><button
|
||||
type="submit">Save</button></form></body></html>)=====";
|
||||
required> at boot (0 uses defaults)<br><br>Use Gamma correction for color:
|
||||
<input type="checkbox" name="GC"> (strongly recommended)<br>
|
||||
Use Gamma correction for brightness: <input type="checkbox" name="GB">
|
||||
(not recommended)<br><br>Brightness factor: <input name="BF" type="number"
|
||||
min="1" max="255" required> %<h3>Transitions</h3>Crossfade: <input
|
||||
type="checkbox" name="TF"><br>Transition Time: <input name="TD" maxlength="5"
|
||||
size="2"> ms<br>Enable Palette transitions: <input type="checkbox" name="PF">
|
||||
<h3>Timed light</h3>Default Duration: <input name="TL" type="number" min="1"
|
||||
max="255" required> min<br>Default Target brightness: <input name="TB"
|
||||
type="number" min="0" max="255" required><br>Mode: <select name="TW"><option
|
||||
value="0">Wait and set</option><option value="1">Fade</option><option value="2">
|
||||
Fade Color</option><option value="3">Sunrise</option></select><h3>Advanced</h3>
|
||||
Palette blending: <select name="PB"><option value="0">Linear (wrap if moving)
|
||||
</option><option value="1">Linear (always wrap)</option><option value="2">
|
||||
Linear (never wrap)</option><option value="3">None (not recommended)</option>
|
||||
</select><br><span class="wc">Auto-calculate white channel from RGB:<br><select
|
||||
name="AW"><option value="0">None</option><option value="1">Brighter</option>
|
||||
<option value="2">Accurate</option><option value="3">Dual</option><option
|
||||
value="4">Legacy</option></select><br></span><hr><button type="button"
|
||||
onclick="B()">Back</button><button type="submit">Save</button></form></body>
|
||||
</html>)=====";
|
||||
|
||||
|
||||
#ifdef WLED_ENABLE_DMX
|
||||
|
@ -197,19 +197,10 @@ bool deserializeState(JsonObject root, byte presetId)
|
||||
|
||||
tr = root[F("tb")] | -1;
|
||||
if (tr >= 0) strip.timebase = ((uint32_t)tr) - millis();
|
||||
|
||||
int cy = root[F("pl")] | -2;
|
||||
if (cy > -2) presetCyclingEnabled = (cy >= 0);
|
||||
JsonObject ccnf = root["ccnf"];
|
||||
presetCycleMin = ccnf[F("min")] | presetCycleMin;
|
||||
presetCycleMax = ccnf[F("max")] | presetCycleMax;
|
||||
tr = ccnf[F("time")] | -1;
|
||||
if (tr >= 2) presetCycleTime = tr;
|
||||
|
||||
JsonObject nl = root["nl"];
|
||||
nightlightActive = nl["on"] | nightlightActive;
|
||||
nightlightDelayMins = nl[F("dur")] | nightlightDelayMins;
|
||||
nightlightMode = nl[F("fade")] | nightlightMode; //deprecated, remove for v0.13.0
|
||||
nightlightMode = nl[F("mode")] | nightlightMode;
|
||||
nightlightTargetBri = nl[F("tbri")] | nightlightTargetBri;
|
||||
|
||||
@ -375,20 +366,13 @@ void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segme
|
||||
if (errorFlag) root[F("error")] = errorFlag;
|
||||
|
||||
root[F("ps")] = currentPreset;
|
||||
root[F("pl")] = (presetCyclingEnabled) ? 0: -1;
|
||||
root[F("pl")] = currentPlaylist;
|
||||
|
||||
usermods.addToJsonState(root);
|
||||
|
||||
//temporary for preset cycle
|
||||
JsonObject ccnf = root.createNestedObject("ccnf");
|
||||
ccnf[F("min")] = presetCycleMin;
|
||||
ccnf[F("max")] = presetCycleMax;
|
||||
ccnf[F("time")] = presetCycleTime;
|
||||
|
||||
JsonObject nl = root.createNestedObject("nl");
|
||||
nl["on"] = nightlightActive;
|
||||
nl[F("dur")] = nightlightDelayMins;
|
||||
nl[F("fade")] = (nightlightMode > NL_MODE_SET); //deprecated
|
||||
nl[F("mode")] = nightlightMode;
|
||||
nl[F("tbri")] = nightlightTargetBri;
|
||||
if (nightlightActive) {
|
||||
@ -451,9 +435,6 @@ void serializeInfo(JsonObject root)
|
||||
leds[F("count")] = ledCount;
|
||||
leds[F("rgbw")] = strip.isRgbw;
|
||||
leds[F("wv")] = strip.isRgbw && (strip.rgbwMode == RGBW_MODE_MANUAL_ONLY || strip.rgbwMode == RGBW_MODE_DUAL); //should a white channel slider be displayed?
|
||||
JsonArray leds_pin = leds.createNestedArray("pin");
|
||||
leds_pin.add(LEDPIN);
|
||||
|
||||
leds[F("pwr")] = strip.currentMilliamps;
|
||||
leds[F("fps")] = strip.getFps();
|
||||
leds[F("maxpwr")] = (strip.currentMilliamps)? strip.ablMilliampsMax : 0;
|
||||
|
@ -296,19 +296,6 @@ void handleNightlight()
|
||||
}
|
||||
nightlightActiveOld = false;
|
||||
}
|
||||
|
||||
//also handle preset cycle here
|
||||
if (presetCyclingEnabled && (millis() - presetCycledTime > (100*presetCycleTime)))
|
||||
{
|
||||
presetCycledTime = millis();
|
||||
if (bri == 0 || nightlightActive) return;
|
||||
|
||||
if (presetCycCurr < presetCycleMin || presetCycCurr > presetCycleMax) presetCycCurr = presetCycleMin;
|
||||
applyPreset(presetCycCurr); //this handles colorUpdated() for us
|
||||
presetCycCurr++;
|
||||
if (presetCycCurr > 250) presetCycCurr = 1;
|
||||
interfaceUpdateCallMode = 0; //disable updates to MQTT and Blynk
|
||||
}
|
||||
}
|
||||
|
||||
//utility for FastLED to use our custom timer
|
||||
|
@ -117,7 +117,7 @@ void loadPlaylist(JsonObject playlistObj, byte presetId) {
|
||||
|
||||
|
||||
void handlePlaylist() {
|
||||
if (currentPlaylist < 0 || playlistEntries == nullptr || presetCyclingEnabled) return;
|
||||
if (currentPlaylist < 0 || playlistEntries == nullptr) return;
|
||||
|
||||
if (millis() - presetCycledTime > (100*playlistEntryDur)) {
|
||||
presetCycledTime = millis();
|
||||
|
@ -164,7 +164,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
|
||||
briS = request->arg(F("CA")).toInt();
|
||||
|
||||
saveCurrPresetCycConf = request->hasArg(F("PC"));
|
||||
turnOnAtBoot = request->hasArg(F("BO"));
|
||||
t = request->arg(F("BP")).toInt();
|
||||
if (t <= 250) bootPreset = t;
|
||||
@ -611,36 +610,12 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
|
||||
}
|
||||
strip.setSegment(selectedSeg, startI, stopI, grpI, spcI);
|
||||
|
||||
//set presets
|
||||
pos = req.indexOf(F("P1=")); //sets first preset for cycle
|
||||
if (pos > 0) presetCycleMin = getNumVal(&req, pos);
|
||||
|
||||
pos = req.indexOf(F("P2=")); //sets last preset for cycle
|
||||
if (pos > 0) presetCycleMax = getNumVal(&req, pos);
|
||||
|
||||
//preset cycle
|
||||
pos = req.indexOf(F("CY="));
|
||||
if (pos > 0)
|
||||
{
|
||||
char cmd = req.charAt(pos+3);
|
||||
if (cmd == '2') presetCyclingEnabled = !presetCyclingEnabled;
|
||||
else presetCyclingEnabled = (cmd != '0');
|
||||
presetCycCurr = presetCycleMin;
|
||||
}
|
||||
|
||||
pos = req.indexOf(F("PT=")); //sets cycle time in ms
|
||||
if (pos > 0) {
|
||||
int v = getNumVal(&req, pos);
|
||||
if (v > 100) presetCycleTime = v/100;
|
||||
}
|
||||
|
||||
pos = req.indexOf(F("PS=")); //saves current in preset
|
||||
if (pos > 0) savePreset(getNumVal(&req, pos));
|
||||
|
||||
//apply preset
|
||||
if (updateVal(&req, "PL=", &presetCycCurr, presetCycleMin, presetCycleMax)) {
|
||||
applyPreset(presetCycCurr);
|
||||
}
|
||||
pos = req.indexOf(F("PL="));
|
||||
if (pos > 0) applyPreset(getNumVal(&req, pos));
|
||||
|
||||
//set brightness
|
||||
updateVal(&req, "&A=", &bri);
|
||||
@ -733,7 +708,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
|
||||
}
|
||||
|
||||
//set effect parameters
|
||||
if (updateVal(&req, "FX=", &effectCurrent, 0, strip.getModeCount()-1)) presetCyclingEnabled = false;
|
||||
if (updateVal(&req, "FX=", &effectCurrent, 0, strip.getModeCount()-1)) unloadPlaylist();
|
||||
updateVal(&req, "SX=", &effectSpeed);
|
||||
updateVal(&req, "IX=", &effectIntensity);
|
||||
updateVal(&req, "FP=", &effectPalette, 0, strip.getPaletteCount()-1);
|
||||
|
@ -500,14 +500,8 @@ WLED_GLOBAL byte timerWeekday[] _INIT_N(({ 255, 255, 255, 255, 255, 255, 255, 25
|
||||
// blynk
|
||||
WLED_GLOBAL bool blynkEnabled _INIT(false);
|
||||
|
||||
// preset cycling
|
||||
WLED_GLOBAL bool presetCyclingEnabled _INIT(false);
|
||||
WLED_GLOBAL byte presetCycleMin _INIT(1), presetCycleMax _INIT(5);
|
||||
WLED_GLOBAL uint16_t presetCycleTime _INIT(12);
|
||||
//playlists
|
||||
WLED_GLOBAL unsigned long presetCycledTime _INIT(0);
|
||||
WLED_GLOBAL byte presetCycCurr _INIT(presetCycleMin);
|
||||
WLED_GLOBAL bool saveCurrPresetCycConf _INIT(false);
|
||||
|
||||
WLED_GLOBAL int16_t currentPlaylist _INIT(0);
|
||||
|
||||
// realtime
|
||||
|
@ -323,18 +323,6 @@ void loadSettingsFromEEPROM()
|
||||
strip.rgbwMode = EEPROM.read(2203);
|
||||
//skipFirstLed = EEPROM.read(2204);
|
||||
|
||||
if (EEPROM.read(2210) || EEPROM.read(2211) || EEPROM.read(2212))
|
||||
{
|
||||
presetCyclingEnabled = EEPROM.read(2205);
|
||||
presetCycleTime = EEPROM.read(2206) + ((EEPROM.read(2207) << 8) & 0xFF00);
|
||||
if (lastEEPROMversion < 21) presetCycleTime /= 100; //was stored in ms, now is in tenths of a second
|
||||
presetCycleMin = EEPROM.read(2208);
|
||||
presetCycleMax = EEPROM.read(2209);
|
||||
//was presetApplyBri = EEPROM.read(2210);
|
||||
//was presetApplyCol = EEPROM.read(2211);
|
||||
//was presetApplyFx = EEPROM.read(2212);
|
||||
}
|
||||
|
||||
bootPreset = EEPROM.read(389);
|
||||
wifiLock = EEPROM.read(393);
|
||||
utcOffsetSecs = EEPROM.read(394) + ((EEPROM.read(395) << 8) & 0xFF00);
|
||||
|
@ -61,7 +61,7 @@ void XML_response(AsyncWebServerRequest *request, char* dest)
|
||||
oappend(SET_F("</ws><ps>"));
|
||||
oappendi((currentPreset < 1) ? 0:currentPreset);
|
||||
oappend(SET_F("</ps><cy>"));
|
||||
oappendi(presetCyclingEnabled);
|
||||
oappendi(currentPlaylist > 0);
|
||||
oappend(SET_F("</cy><ds>"));
|
||||
oappend(serverDescription);
|
||||
if (realtimeMode)
|
||||
|
Loading…
Reference in New Issue
Block a user