v0.13.0-b2
Reduced unneeded websockets pushes
This commit is contained in:
parent
6a8ed1192f
commit
123bd0bb92
@ -2,6 +2,14 @@
|
||||
|
||||
### Builds after release 0.12.0
|
||||
|
||||
#### Build 2107100
|
||||
|
||||
- Version bump to 0.13.0-b2 "Toki"
|
||||
- Accept hex color strings in individual LED API
|
||||
- Fixed transition property not applying unless power/bri/color changed next
|
||||
- Moved transition field below segments (temporarily)
|
||||
- Reduced unneeded websockets pushes
|
||||
|
||||
#### Build 2107091
|
||||
|
||||
- Fixed presets using wrong call mode (e.g. causing buttons to send UDP under direct change type)
|
||||
|
@ -177,7 +177,7 @@ void _drawOverlayCronixie();
|
||||
//playlist.cpp
|
||||
void shufflePlaylist();
|
||||
void unloadPlaylist();
|
||||
void loadPlaylist(JsonObject playlistObject, byte presetId = 0);
|
||||
int16_t loadPlaylist(JsonObject playlistObject, byte presetId = 0);
|
||||
void handlePlaylist();
|
||||
|
||||
//presets.cpp
|
||||
|
3156
wled00/html_ui.h
3156
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -218,7 +218,6 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
|
||||
nightlightDelayMins = nl[F("dur")] | nightlightDelayMins;
|
||||
nightlightMode = nl[F("mode")] | nightlightMode;
|
||||
nightlightTargetBri = nl[F("tbri")] | nightlightTargetBri;
|
||||
getJsonValue(nl[F("tbri")], nightlightTargetBri);
|
||||
|
||||
JsonObject udpn = root["udpn"];
|
||||
notifyDirect = udpn["send"] | notifyDirect;
|
||||
@ -313,9 +312,9 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
|
||||
}
|
||||
|
||||
JsonObject playlist = root[F("playlist")];
|
||||
if (!playlist.isNull()) {
|
||||
loadPlaylist(playlist, presetId);
|
||||
noNotification = true; //do not notify both for this request and the first playlist entry
|
||||
if (!playlist.isNull() && loadPlaylist(playlist, presetId)) {
|
||||
//do not notify here, because the first playlist entry will do
|
||||
noNotification = true;
|
||||
} else {
|
||||
interfaceUpdateCallMode = CALL_MODE_WS_SEND;
|
||||
}
|
||||
|
@ -53,16 +53,16 @@ void unloadPlaylist() {
|
||||
}
|
||||
|
||||
|
||||
void loadPlaylist(JsonObject playlistObj, byte presetId) {
|
||||
int16_t loadPlaylist(JsonObject playlistObj, byte presetId) {
|
||||
unloadPlaylist();
|
||||
|
||||
JsonArray presets = playlistObj["ps"];
|
||||
playlistLen = presets.size();
|
||||
if (playlistLen == 0) return;
|
||||
if (playlistLen == 0) return -1;
|
||||
if (playlistLen > 100) playlistLen = 100;
|
||||
|
||||
playlistEntries = new PlaylistEntry[playlistLen];
|
||||
if (playlistEntries == nullptr) return;
|
||||
if (playlistEntries == nullptr) return -1;
|
||||
|
||||
byte it = 0;
|
||||
for (int ps : presets) {
|
||||
@ -113,6 +113,7 @@ void loadPlaylist(JsonObject playlistObj, byte presetId) {
|
||||
|
||||
currentPlaylist = presetId;
|
||||
DEBUG_PRINTLN(F("Playlist loaded."));
|
||||
return currentPlaylist;
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,13 +33,20 @@ void wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventTyp
|
||||
JsonObject root = jsonBuffer.as<JsonObject>();
|
||||
if (error || root.isNull()) return;
|
||||
|
||||
if (root.containsKey("lv"))
|
||||
if (root["v"] && root.size() == 1) {
|
||||
//if the received value is just "{"v":true}", send only to this client
|
||||
verboseResponse = true;
|
||||
} else if (root.containsKey("lv"))
|
||||
{
|
||||
wsLiveClientId = root["lv"] ? client->id() : 0;
|
||||
} else {
|
||||
fileDoc = &jsonBuffer;
|
||||
verboseResponse = deserializeState(root);
|
||||
fileDoc = nullptr;
|
||||
if (!interfaceUpdateCallMode) {
|
||||
//special case, only on playlist load, avoid sending twice in rapid succession
|
||||
if (millis() - lastInterfaceUpdate > 1700) verboseResponse = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//update if it takes longer than 300ms until next "broadcast"
|
||||
|
Loading…
Reference in New Issue
Block a user