kopia lustrzana https://github.com/Aircoookie/WLED
Endless playlist fix.
rodzic
29c9e5cb17
commit
131625bb53
|
@ -10,6 +10,7 @@ typedef struct PlaylistEntry {
|
||||||
uint16_t tr;
|
uint16_t tr;
|
||||||
} ple;
|
} ple;
|
||||||
|
|
||||||
|
bool playlistEndless = false;
|
||||||
int8_t playlistRepeat = 1;
|
int8_t playlistRepeat = 1;
|
||||||
byte playlistEndPreset = 0;
|
byte playlistEndPreset = 0;
|
||||||
byte *playlistEntries = nullptr;
|
byte *playlistEntries = nullptr;
|
||||||
|
@ -92,6 +93,9 @@ void loadPlaylist(JsonObject playlistObj) {
|
||||||
playlistRepeat = playlistObj[F("repeat")] | 0;
|
playlistRepeat = playlistObj[F("repeat")] | 0;
|
||||||
playlistEndPreset = playlistObj[F("end")] | 0;
|
playlistEndPreset = playlistObj[F("end")] | 0;
|
||||||
|
|
||||||
|
playlistEndless = playlistRepeat < 1;
|
||||||
|
if (playlistEndless && playlistRepeat==0) playlistRepeat = 1; // it will never decrement
|
||||||
|
|
||||||
currentPlaylist = 0; //TODO here we need the preset ID where the playlist is saved
|
currentPlaylist = 0; //TODO here we need the preset ID where the playlist is saved
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,9 +116,8 @@ void handlePlaylist() {
|
||||||
}
|
}
|
||||||
// playlist roll-over
|
// playlist roll-over
|
||||||
if (!playlistIndex) {
|
if (!playlistIndex) {
|
||||||
if (playlistRepeat > 0) {// playlistRepeat < 0 => endless loop with shuffling presets
|
if (!playlistEndless) playlistRepeat--; // decrease repeat count on each index reset if not an endless playlist
|
||||||
playlistRepeat--; // decrease repeat count on each index reset
|
if (playlistRepeat < 0) {// playlistRepeat < 0 => endless loop with shuffling presets
|
||||||
} else {
|
|
||||||
shufflePlaylist(); // shuffle playlist and start over
|
shufflePlaylist(); // shuffle playlist and start over
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue