Cleanup setup

This commit is contained in:
Gabriel Augendre 2023-01-01 03:02:57 +01:00
parent b67b057d48
commit 418499aff8

View file

@ -80,16 +80,15 @@ void setup()
// List existing files // List existing files
File root = SPIFFS.open("/music"); File root = SPIFFS.open("/music");
File file = root.openNextFile(); File file = root.openNextFile();
while (file) if (file)
{ {
String fileName = file.name(); String fileName = file.name();
if (selectedFile == "" && !fileName.startsWith(".")) if (!fileName.startsWith("."))
selectedFile = fileName; selectedFile = fileName;
file.close(); file.close();
file = root.openNextFile();
} }
// Wifi // Wifi
#ifdef B_WIFI_AP #ifdef B_WIFI_AP
Serial.println("Setting up AP..."); Serial.println("Setting up AP...");
WiFi.softAP(ssid, password); WiFi.softAP(ssid, password);
@ -113,6 +112,7 @@ void setup()
server.on("/select-file", HTTP_POST, onSelectFile); server.on("/select-file", HTTP_POST, onSelectFile);
server.serveStatic("/", SPIFFS, "/www/").setDefaultFile("index.html"); server.serveStatic("/", SPIFFS, "/www/").setDefaultFile("index.html");
server.begin(); server.begin();
Serial.println("Server ready!"); Serial.println("Server ready!");
} }