Skip to content

Commit 6ddcba8

Browse files
committed
Change currentPreset to byte
JSON API still returns -1 for no preset
1 parent 91598cb commit 6ddcba8

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

wled00/json.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segme
411411
if (!forPreset) {
412412
if (errorFlag) root[F("error")] = errorFlag;
413413

414-
root[F("ps")] = currentPreset;
414+
root[F("ps")] = (currentPreset > 0) ? currentPreset : -1;
415415
root[F("pl")] = currentPlaylist;
416416

417417
usermods.addToJsonState(root);

wled00/led.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void colorUpdated(int callMode)
111111
{
112112
effectChanged = false;
113113
if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0;
114-
currentPreset = -1; //something changed, so we are no longer in the preset
114+
currentPreset = 0; //something changed, so we are no longer in the preset
115115

116116
notify(callMode);
117117

wled00/wled.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ WLED_GLOBAL JsonDocument* fileDoc;
564564
WLED_GLOBAL bool doCloseFile _INIT(false);
565565

566566
// presets
567-
WLED_GLOBAL int16_t currentPreset _INIT(-1);
567+
WLED_GLOBAL byte currentPreset _INIT(0);
568568

569569
WLED_GLOBAL byte errorFlag _INIT(0);
570570

wled00/xml.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ void XML_response(AsyncWebServerRequest *request, char* dest)
6060
oappend(SET_F("</wv><ws>"));
6161
oappendi(colSec[3]);
6262
oappend(SET_F("</ws><ps>"));
63-
oappendi((currentPreset < 1) ? 0:currentPreset);
63+
oappendi(currentPreset);
6464
oappend(SET_F("</ps><cy>"));
65-
oappendi(currentPlaylist > 0);
65+
oappendi(currentPlaylist >= 0);
6666
oappend(SET_F("</cy><ds>"));
6767
oappend(serverDescription);
6868
if (realtimeMode)

0 commit comments

Comments
 (0)