diff --git a/wled00/json.cpp b/wled00/json.cpp index d8abc772c..92e836a3d 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -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; } diff --git a/wled00/led.cpp b/wled00/led.cpp index 4f2190ce6..99f8dd1a8 100644 --- a/wled00/led.cpp +++ b/wled00/led.cpp @@ -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; } diff --git a/wled00/set.cpp b/wled00/set.cpp index cc3d99697..e024e6ec0 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -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;