From fa4bb5306013209d76c9a17d0eedb2325963725d Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 1 Jan 2023 18:14:05 +0100 Subject: [PATCH] Select a file by default --- src/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index aeddaa9..8e1b1dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,6 +71,21 @@ void setup() return; } + File root = SPIFFS.open("/music"); + File file = root.openNextFile(); + while (file) + { + String fileName = file.name(); + if (!fileName.startsWith(".")) + { + selectedFile = fileName; + Serial.println("Selected " + fileName); + break; + } + file.close(); + file = root.openNextFile(); + } + // Wifi #ifdef B_WIFI_AP Serial.println("Setting up AP...");