Merge pull request #1302 from catlee/nightlight-remaining

Return remaining nightlight time in json API
This commit is contained in:
Aircoookie 2020-11-10 21:16:54 +01:00 committed by GitHub
commit 89a2e15cfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -318,7 +318,12 @@ void serializeState(JsonObject root)
nl[F("fade")] = (nightlightMode > NL_MODE_SET); //deprecated
nl[F("mode")] = nightlightMode;
nl[F("tbri")] = nightlightTargetBri;
if (nightlightActive) {
nl[F("rem")] = (nightlightDelayMs - (millis() - nightlightStartTime)) / 1000; // seconds remaining
} else {
nl[F("rem")] = -1;
}
JsonObject udpn = root.createNestedObject("udpn");
udpn[F("send")] = notifyDirect;
udpn[F("recv")] = receiveNotifications;
@ -326,7 +331,7 @@ void serializeState(JsonObject root)
root[F("lor")] = realtimeOverride;
root[F("mainseg")] = strip.getMainSegmentId();
JsonArray seg = root.createNestedArray("seg");
for (byte s = 0; s < strip.getMaxSegments(); s++)
{