Don't read all dirs at startup.
This commit is contained in:
parent
4840c150c2
commit
45dfe0cfe0
@ -13,7 +13,6 @@ class PlaylistManager {
|
||||
|
||||
public:
|
||||
PlaylistManager();
|
||||
std::vector<String> dirs;
|
||||
std::map<String, String> map;
|
||||
Playlist get_playlist(String rfid_id);
|
||||
bool has_playlist(String rfid_id);
|
||||
|
@ -22,6 +22,7 @@ MFRC522* rfid;
|
||||
void setup() {
|
||||
pinMode(PIN_CS_SD, OUTPUT); digitalWrite(PIN_CS_SD, HIGH);
|
||||
pinMode(PIN_CS_RFID, OUTPUT); digitalWrite(PIN_CS_RFID, HIGH);
|
||||
|
||||
Serial.begin(115200);
|
||||
WiFi.begin("Schlenz", "1410WischlingenPanda");
|
||||
log_i("Connecting to WiFi...");
|
||||
@ -41,7 +42,7 @@ void setup() {
|
||||
Serial.print("Connected to WiFi. IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
ArduinoOTA.begin();
|
||||
Serial.println("Waiting for OTA...");
|
||||
log_i("Waiting for OTA...");
|
||||
for(int i=0; i<20; i++) {
|
||||
ArduinoOTA.handle();
|
||||
delay(100);
|
||||
|
@ -6,6 +6,7 @@ PlaylistManager::PlaylistManager() {
|
||||
SPIMaster::enable_sd();
|
||||
current_rfid_tag_id = String("");
|
||||
|
||||
/*
|
||||
File root = SD.open("/");
|
||||
while(File entry = root.openNextFile()) {
|
||||
if (entry.isDirectory()) {
|
||||
@ -17,6 +18,8 @@ PlaylistManager::PlaylistManager() {
|
||||
}
|
||||
}
|
||||
}
|
||||
root.close();
|
||||
*/
|
||||
|
||||
if (!SD.exists("/_mapping.txt")) {
|
||||
Serial.println("WARNING: /_mapping.txt not found!");
|
||||
@ -37,7 +40,7 @@ PlaylistManager::PlaylistManager() {
|
||||
Serial.printf(" Adding mapping: %s=>%s\n", rfid_id.c_str(), folder.c_str());
|
||||
map[rfid_id] = folder;
|
||||
|
||||
if (folder.charAt(0)=='/') {
|
||||
/*if (folder.charAt(0)=='/') {
|
||||
bool found=false;
|
||||
for (String f: dirs) {
|
||||
if (f.equals(folder)) {
|
||||
@ -48,12 +51,11 @@ PlaylistManager::PlaylistManager() {
|
||||
if (!found) {
|
||||
Serial.printf("WARNING: Found mapping for RFID id %s which maps to non-existing folder %s!\n", rfid_id.c_str(), folder.c_str());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
root.close();
|
||||
}
|
||||
|
||||
Playlist PlaylistManager::get_playlist(String rfid_id) {
|
||||
|
Loading…
Reference in New Issue
Block a user