JSON IR improvements
Restored support for "PL=~" mistakenly removed in 2106300
This commit is contained in:
parent
1bb7e36a65
commit
c879351063
@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
### Builds after release 0.12.0
|
### Builds after release 0.12.0
|
||||||
|
|
||||||
|
#### Build 2107041
|
||||||
|
|
||||||
|
- Restored support for "PL=~" mistakenly removed in 2106300
|
||||||
|
- JSON IR improvements
|
||||||
|
|
||||||
#### Build 2107040
|
#### Build 2107040
|
||||||
|
|
||||||
- Playlist entries are now more compact
|
- Playlist entries are now more compact
|
||||||
|
@ -580,13 +580,13 @@ void decodeIRJson(uint32_t code)
|
|||||||
{
|
{
|
||||||
if (cmdStr.startsWith("!")) {
|
if (cmdStr.startsWith("!")) {
|
||||||
// call limited set of C functions
|
// call limited set of C functions
|
||||||
if (cmdStr == "!incBrightness") {
|
if (cmdStr.startsWith(F("!incBri"))) {
|
||||||
lastValidCode = code;
|
lastValidCode = code;
|
||||||
incBrightness();
|
incBrightness();
|
||||||
} else if (cmdStr == "!decBrightness") {
|
} else if (cmdStr.startsWith(F("!decBri"))) {
|
||||||
lastValidCode = code;
|
lastValidCode = code;
|
||||||
decBrightness();
|
decBrightness();
|
||||||
} else if (cmdStr == "!presetFallback") {
|
} else if (cmdStr.startsWith(F("!presetF"))) { //!presetFallback
|
||||||
uint8_t p1 = fdo["PL"] ? fdo["PL"] : 1;
|
uint8_t p1 = fdo["PL"] ? fdo["PL"] : 1;
|
||||||
uint8_t p2 = fdo["FX"] ? fdo["FX"] : random8(100);
|
uint8_t p2 = fdo["FX"] ? fdo["FX"] : random8(100);
|
||||||
uint8_t p3 = fdo["FP"] ? fdo["FP"] : 0;
|
uint8_t p3 = fdo["FP"] ? fdo["FP"] : 0;
|
||||||
@ -598,7 +598,8 @@ void decodeIRJson(uint32_t code)
|
|||||||
{
|
{
|
||||||
// repeatable action
|
// repeatable action
|
||||||
lastValidCode = code;
|
lastValidCode = code;
|
||||||
} if (effectCurrent == 0 && cmdStr.indexOf("FP=") > -1) {
|
}
|
||||||
|
if (effectCurrent == 0 && cmdStr.indexOf("FP=") > -1) {
|
||||||
// setting palette but it wont show because effect is solid
|
// setting palette but it wont show because effect is solid
|
||||||
effectCurrent = FX_MODE_GRADIENT;
|
effectCurrent = FX_MODE_GRADIENT;
|
||||||
}
|
}
|
||||||
@ -609,7 +610,10 @@ void decodeIRJson(uint32_t code)
|
|||||||
}
|
}
|
||||||
} else if (!jsonCmdObj.isNull()) {
|
} else if (!jsonCmdObj.isNull()) {
|
||||||
// command is JSON object
|
// command is JSON object
|
||||||
|
//allow applyPreset() to reuse JSON buffer, or it would alloc. a second buffer and run out of mem.
|
||||||
|
fileDoc = &irDoc;
|
||||||
deserializeState(jsonCmdObj);
|
deserializeState(jsonCmdObj);
|
||||||
|
fileDoc = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -614,9 +614,16 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
|
|||||||
pos = req.indexOf(F("PS=")); //saves current in preset
|
pos = req.indexOf(F("PS=")); //saves current in preset
|
||||||
if (pos > 0) savePreset(getNumVal(&req, pos));
|
if (pos > 0) savePreset(getNumVal(&req, pos));
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
//apply preset
|
//apply preset
|
||||||
pos = req.indexOf(F("PL="));
|
if (updateVal(&req, "PL=", &presetCycCurr, presetCycleMin, presetCycleMax)) {
|
||||||
if (pos > 0) applyPreset(getNumVal(&req, pos));
|
applyPreset(presetCycCurr);
|
||||||
|
}
|
||||||
|
|
||||||
//set brightness
|
//set brightness
|
||||||
updateVal(&req, "&A=", &bri);
|
updateVal(&req, "&A=", &bri);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2107040
|
#define VERSION 2107041
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
@ -504,6 +504,9 @@ WLED_GLOBAL bool blynkEnabled _INIT(false);
|
|||||||
//playlists
|
//playlists
|
||||||
WLED_GLOBAL unsigned long presetCycledTime _INIT(0);
|
WLED_GLOBAL unsigned long presetCycledTime _INIT(0);
|
||||||
WLED_GLOBAL int16_t currentPlaylist _INIT(0);
|
WLED_GLOBAL int16_t currentPlaylist _INIT(0);
|
||||||
|
//still used for "PL=~" HTTP API command
|
||||||
|
WLED_GLOBAL byte presetCycleMin _INIT(1), presetCycleMax _INIT(5);
|
||||||
|
WLED_GLOBAL byte presetCycCurr _INIT(presetCycleMin);
|
||||||
|
|
||||||
// realtime
|
// realtime
|
||||||
WLED_GLOBAL byte realtimeMode _INIT(REALTIME_MODE_INACTIVE);
|
WLED_GLOBAL byte realtimeMode _INIT(REALTIME_MODE_INACTIVE);
|
||||||
|
Loading…
Reference in New Issue
Block a user