Playlist bugfix.

pull/2737/head
Blaz Kristan 2021-10-22 21:31:03 +02:00
rodzic bbf46358fa
commit 31bf615fe8
3 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -239,7 +239,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
JsonObject udpn = root["udpn"];
notifyDirect = udpn["send"] | notifyDirect;
receiveNotifications = udpn["recv"] | receiveNotifications;
bool noNotification = udpn[F("nn")]; //send no notification just for this request
if ((bool)udpn[F("nn")]) callMode = CALL_MODE_NO_NOTIFY; //send no notification just for this request
unsigned long timein = root[F("time")] | UINT32_MAX; //backup time source if NTP not synced
if (timein != UINT32_MAX) {
@ -339,12 +339,13 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
JsonObject playlist = root[F("playlist")];
if (!playlist.isNull() && loadPlaylist(playlist, presetId)) {
//do not notify here, because the first playlist entry will do
noNotification = true;
if (root["on"].isNull()) callMode = CALL_MODE_NO_NOTIFY;
else callMode = CALL_MODE_DIRECT_CHANGE; // possible bugfix for playlist only containing HTTP API preset FX=~
} else {
interfaceUpdateCallMode = CALL_MODE_WS_SEND;
}
colorUpdated(noNotification ? CALL_MODE_NO_NOTIFY : callMode);
colorUpdated(callMode);
return stateResponse;
}

Wyświetl plik

@ -30,7 +30,6 @@ void toggleOnOff()
{
briLast = bri;
bri = 0;
unloadPlaylist();
}
}
@ -38,8 +37,7 @@ void toggleOnOff()
//scales the brightness with the briMultiplier factor
byte scaledBri(byte in)
{
uint32_t d = in*briMultiplier;
uint32_t val = d/100;
uint16_t val = ((uint16_t)in*briMultiplier)/100;
if (val > 255) val = 255;
return (byte)val;
}

Wyświetl plik

@ -514,10 +514,11 @@ bool updateVal(const String* req, const char* key, byte* val, byte minv, byte ma
int out = getNumVal(req, pos+1);
if (out == 0)
{
// we only have ~ (and perhaps -)
if (req->charAt(pos+4) == '-') {
*val = min((int)maxv, max((int)minv, (int)(*val -1)));
*val = (int)(*val -1) < (int)minv ? maxv : (*val -1);
} else {
*val = min((int)maxv, max((int)minv, (int)(*val +1)));
*val = (int)(*val +1) > (int)maxv ? minv : (*val +1);
}
} else {
out += *val;