Add live property to state, allowing toggling of realtime (not incl. in state resp.) ( #1308 )

This commit is contained in:
cschwinne 2020-11-26 10:54:37 +01:00
parent b25e22bca4
commit adbeb4ae54
4 changed files with 39 additions and 16 deletions

View file

@ -208,6 +208,12 @@ bool deserializeState(JsonObject root)
realtimeOverride = root[F("lor")] | realtimeOverride;
if (realtimeOverride > 2) realtimeOverride = REALTIME_OVERRIDE_ALWAYS;
if (root.containsKey("live")) {
bool lv = root["live"];
if (lv) realtimeLock(65000); //enter realtime without timeout
else realtimeTimeout = 0; //cancel realtime mode immediately
}
byte prevMain = strip.getMainSegmentId();
strip.mainSegment = root[F("mainseg")] | prevMain;
if (strip.getMainSegmentId() != prevMain) setValuesFromMainSeg();
@ -423,7 +429,7 @@ void serializeInfo(JsonObject root)
root[F("name")] = serverDescription;
root[F("udpport")] = udpPort;
root[F("live")] = (bool)realtimeMode;
root["live"] = (bool)realtimeMode;
switch (realtimeMode) {
case REALTIME_MODE_INACTIVE: root["lm"] = ""; break;