From e682fd07cb838702bf1e25145f80c5314d9541fe Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Thu, 7 Oct 2021 15:41:30 +0200 Subject: [PATCH] Reverted currentPlaylist. --- wled00/json.cpp | 2 +- wled00/playlist.cpp | 5 ++--- wled00/wled.h | 4 ++-- wled00/xml.cpp | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/wled00/json.cpp b/wled00/json.cpp index 79c44880..7ae408a3 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -416,7 +416,7 @@ void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segme if (errorFlag) {root[F("error")] = errorFlag; errorFlag = ERR_NONE;} root[F("ps")] = currentPreset>0 ? currentPreset : -1; - root[F("pl")] = currentPlaylist>0 ? currentPlaylist : -1; + root[F("pl")] = currentPlaylist; usermods.addToJsonState(root); diff --git a/wled00/playlist.cpp b/wled00/playlist.cpp index 31bcede5..1a64601b 100644 --- a/wled00/playlist.cpp +++ b/wled00/playlist.cpp @@ -47,8 +47,7 @@ void unloadPlaylist() { delete[] playlistEntries; playlistEntries = nullptr; } - currentPlaylist = 0; - playlistIndex = -1; + currentPlaylist = playlistIndex = -1; playlistLen = playlistEntryDur = playlistOptions = 0; DEBUG_PRINTLN(F("Playlist unloaded.")); } @@ -120,7 +119,7 @@ int16_t loadPlaylist(JsonObject playlistObj, byte presetId) { void handlePlaylist() { static unsigned long presetCycledTime = 0; - if (!currentPlaylist || playlistEntries == nullptr) return; + if (currentPlaylist<0 || playlistEntries == nullptr) return; if (millis() - presetCycledTime > (100*playlistEntryDur)) { presetCycledTime = millis(); diff --git a/wled00/wled.h b/wled00/wled.h index e56c7978..050db5a9 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2110070 +#define VERSION 2110071 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG @@ -513,7 +513,7 @@ WLED_GLOBAL byte timerWeekday[] _INIT_N(({ 255, 255, 255, 255, 255, 255, 255, 25 WLED_GLOBAL bool blynkEnabled _INIT(false); //playlists -WLED_GLOBAL byte currentPlaylist _INIT(0); +WLED_GLOBAL int16_t currentPlaylist _INIT(-1); //still used for "PL=~" HTTP API command WLED_GLOBAL byte presetCycCurr _INIT(0); diff --git a/wled00/xml.cpp b/wled00/xml.cpp index 260aad6f..b266d0d3 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -62,7 +62,7 @@ void XML_response(AsyncWebServerRequest *request, char* dest) oappend(SET_F("")); oappendi(currentPreset); oappend(SET_F("")); - oappendi(currentPlaylist > 0); + oappendi(currentPlaylist >= 0); oappend(SET_F("")); oappend(serverDescription); if (realtimeMode)