From b8de36b340f6741f4727163f84a1b18f6994a284 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Sat, 13 Mar 2021 22:46:08 +0100 Subject: [PATCH] Cleanup --- wled00/json.cpp | 3 ++- wled00/playlist.cpp | 45 +-------------------------------------------- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/wled00/json.cpp b/wled00/json.cpp index 472ed44f0..161a76433 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -279,7 +279,8 @@ bool deserializeState(JsonObject root) JsonObject playlist = root[F("playlist")]; if (!playlist.isNull()) { - loadPlaylist(playlist); //return stateResponse; + loadPlaylist(playlist); + noNotification = true; //do not notify both for this request and the first playlist entry } colorUpdated(noNotification ? NOTIFIER_CALL_MODE_NO_NOTIFY : NOTIFIER_CALL_MODE_DIRECT_CHANGE); diff --git a/wled00/playlist.cpp b/wled00/playlist.cpp index b294fdef7..885e1fb68 100644 --- a/wled00/playlist.cpp +++ b/wled00/playlist.cpp @@ -34,46 +34,6 @@ void shufflePlaylist() { } } -/* - * The same thing as saving and loading playlist can be achieved using JSON API saved in a preset. - * -void deserializePlaylist() { - DynamicJsonDocument doc(JSON_BUFFER_SIZE); - - DEBUG_PRINTLN(F("Reading playlist from /playlist.json...")); - - if (!readObjectFromFile("/playlist.json", nullptr, &doc)) return; //if file does not exist just exit - - JsonObject playlist = doc[F("playlist")]; - if (!playlist.isNull()) loadPlaylist(playlist); -} - - -void serializePlaylist() { - DynamicJsonDocument doc(JSON_BUFFER_SIZE/8); // we don't need big buffer (>1k is ok) - - DEBUG_PRINTLN(F("Writing playlist to /playlist.json...")); - - PlaylistEntry* entries = reinterpret_cast(playlistEntries); - - JsonObject playlist = doc.createNestedObject(F("playlist")); - JsonArray ps = playlist.createNestedArray(F("ps")); - JsonArray dur = playlist.createNestedArray(F("dur")); - JsonArray tr = playlist.createNestedArray(F("transition")); - for (uint8_t i=0; i