Skip to content

Commit

Permalink
Updated based on more feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
freakintoddles2 committed May 2, 2024
1 parent db475b6 commit 5e38039
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion wled00/fcn_declare.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void _overlayAnalogClock();
void shufflePlaylist();
void unloadPlaylist();
int16_t loadPlaylist(JsonObject playlistObject, byte presetId = 0);
void handlePlaylist(bool doAdvancePlaylist = false);
void handlePlaylist();
void serializePlaylist(JsonObject obj);

//presets.cpp
Expand Down
6 changes: 3 additions & 3 deletions wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,9 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
strip.loadCustomPalettes();
}
}
if (root.containsKey(F("np")) && root[F("np")].as<bool>()) { //skip to next preset in a playlist
doAdvancePlaylist = true;

if (root.containsKey(F("np"))) {
doAdvancePlaylist = root[F("np")].as<bool>(); //advances to next preset in playlist when true
}

JsonObject wifi = root[F("wifi")];
Expand Down
3 changes: 2 additions & 1 deletion wled00/playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ int16_t loadPlaylist(JsonObject playlistObj, byte presetId) {
}


void handlePlaylist(bool doAdvancePlaylist) {
void handlePlaylist() {
static unsigned long presetCycledTime = 0;
if (currentPlaylist < 0 || playlistEntries == nullptr) return;

Expand All @@ -149,6 +149,7 @@ if (millis() - presetCycledTime > (100 * playlistEntryDur) || doAdvancePlaylist)
strip.setTransition(fadeTransition ? playlistEntries[playlistIndex].tr * 100 : 0);
playlistEntryDur = playlistEntries[playlistIndex].dur;
applyPresetFromPlaylist(playlistEntries[playlistIndex].preset);
doAdvancePlaylist = false;
}
}

Expand Down
4 changes: 2 additions & 2 deletions wled00/set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,8 +901,8 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
applyPreset(presetCycCurr);
}

pos = req.indexOf(F("NP")); //skips to next preset in a playlist
if (pos > 0) doAdvancePlaylist = true;
pos = req.indexOf(F("NP")); //advances to next preset in a playlist
if (pos > 0) doAdvancePlaylist = true;

//set brightness
updateVal(req.c_str(), "&A=", &bri);
Expand Down
6 changes: 0 additions & 6 deletions wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,6 @@ void WLED::loop()

toki.resetTick();

// Advance to next playlist preset if the flag is set to true
if (doAdvancePlaylist) {
handlePlaylist(true);
doAdvancePlaylist = false; // Reset flag to false
}

#if WLED_WATCHDOG_TIMEOUT > 0
// we finished our mainloop, reset the watchdog timer
static unsigned long lastWDTFeed = 0;
Expand Down

0 comments on commit 5e38039

Please sign in to comment.