Update playlist.cpp

Updated to allow a user to optionally skip to the next preset in the playlist anytime they desire.
This commit is contained in:
freakintoddles2 2024-04-30 16:21:40 -07:00 committed by GitHub
parent 9f99a1896d
commit bed364d75e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -123,11 +123,11 @@ int16_t loadPlaylist(JsonObject playlistObj, byte presetId) {
} }
void handlePlaylist() { void handlePlaylist(bool skipNext) {
static unsigned long presetCycledTime = 0; static unsigned long presetCycledTime = 0;
if (currentPlaylist < 0 || playlistEntries == nullptr) return; if (currentPlaylist < 0 || playlistEntries == nullptr) return;
if (millis() - presetCycledTime > (100*playlistEntryDur)) { if (millis() - presetCycledTime > (100 * playlistEntryDur) || skipNext) {
presetCycledTime = millis(); presetCycledTime = millis();
if (bri == 0 || nightlightActive) return; if (bri == 0 || nightlightActive) return;