working rfid, more player capabilities

This commit is contained in:
2023-07-09 23:00:24 +02:00
parent 0f47f29c74
commit 2a19ebdff8
5 changed files with 125 additions and 25 deletions

View File

@@ -122,6 +122,36 @@ void DirectoryNode::advanceToFirstMP3InThisNode() {
}
}
DirectoryNode* DirectoryNode::advanceToMP3(const String* currentGlobal) {
for (auto subdir : subdirectories)
{
if (subdir->getName()==*currentGlobal) {
subdir->advanceToFirstMP3InThisNode();
return subdir;
}
// Have each subdirectory advance its song
for (size_t i = 0; i < subdir->mp3Files.size(); i++)
{
if (*currentGlobal == subdir->mp3Files[i])
{
// Found the current MP3 file
if (i < subdir->mp3Files.size() - 1)
{
subdir->currentPlaying = &subdir->mp3Files[i];
return subdir;
}
}
}
}
// If we get here, there were no MP3 files or subdirectories left to check
currentPlaying = nullptr;
Serial.println("no more nodes found");
return this;
}
DirectoryNode* DirectoryNode::advanceToNextMP3(const String* currentGlobal)
{
bool useFirst = false;