Change currentPreset to byte

JSON API still returns -1 for no preset
This commit is contained in:
cschwinne 2021-10-03 13:53:37 +02:00
parent 91598cbbbf
commit 6ddcba8917
4 changed files with 5 additions and 5 deletions

View File

@ -411,7 +411,7 @@ void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segme
if (!forPreset) { if (!forPreset) {
if (errorFlag) root[F("error")] = errorFlag; if (errorFlag) root[F("error")] = errorFlag;
root[F("ps")] = currentPreset; root[F("ps")] = (currentPreset > 0) ? currentPreset : -1;
root[F("pl")] = currentPlaylist; root[F("pl")] = currentPlaylist;
usermods.addToJsonState(root); usermods.addToJsonState(root);

View File

@ -111,7 +111,7 @@ void colorUpdated(int callMode)
{ {
effectChanged = false; effectChanged = false;
if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0; if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0;
currentPreset = -1; //something changed, so we are no longer in the preset currentPreset = 0; //something changed, so we are no longer in the preset
notify(callMode); notify(callMode);

View File

@ -564,7 +564,7 @@ WLED_GLOBAL JsonDocument* fileDoc;
WLED_GLOBAL bool doCloseFile _INIT(false); WLED_GLOBAL bool doCloseFile _INIT(false);
// presets // presets
WLED_GLOBAL int16_t currentPreset _INIT(-1); WLED_GLOBAL byte currentPreset _INIT(0);
WLED_GLOBAL byte errorFlag _INIT(0); WLED_GLOBAL byte errorFlag _INIT(0);

View File

@ -60,9 +60,9 @@ void XML_response(AsyncWebServerRequest *request, char* dest)
oappend(SET_F("</wv><ws>")); oappend(SET_F("</wv><ws>"));
oappendi(colSec[3]); oappendi(colSec[3]);
oappend(SET_F("</ws><ps>")); oappend(SET_F("</ws><ps>"));
oappendi((currentPreset < 1) ? 0:currentPreset); oappendi(currentPreset);
oappend(SET_F("</ps><cy>")); oappend(SET_F("</ps><cy>"));
oappendi(currentPlaylist > 0); oappendi(currentPlaylist >= 0);
oappend(SET_F("</cy><ds>")); oappend(SET_F("</cy><ds>"));
oappend(serverDescription); oappend(serverDescription);
if (realtimeMode) if (realtimeMode)