Systeminfos werden via mp3-Dateien in /system abgespielt.

This commit is contained in:
2022-08-25 14:51:18 +02:00
parent 076a6993c7
commit b2cf9d6277
4 changed files with 23 additions and 176 deletions

View File

@ -134,6 +134,9 @@ void Controller::play(String rfid_id, bool shuffle) {
play();
} else {
Serial.printf("There is no playlist for rfid_id %s\n", rfid_id.c_str());
// This is working more or less, but downloading files is really, REALLY slow. (About 4 minutes for 10 MBytes).
//download_album(rfid_id);
audio.connecttoFS(SD, "/system/sys_unknown_card.mp3");
}
} else {
if (!audio.isRunning()) {
@ -150,6 +153,11 @@ void Controller::play() {
audio.connecttoFS(SD, file.c_str(), current_playlist.get_current_time());
} else if (file.startsWith("http")) {
log_i("Playing URL %s via connecttohost", file.c_str());
audio.connecttoFS(SD, "/system/sys_connecting.mp3");
while (audio.isRunning()) {
yield();
audio.loop();
}
audio.connecttohost(file.c_str());
}
}
@ -202,8 +210,12 @@ bool Controller::is_button_pressed(uint8_t pin) {
return false;
}
void Controller::eof_mp3() {
void Controller::eof_mp3(String info) {
log_d("Handling eof. Keep playing until the file is finished.");
while(audio.isRunning()) { audio.loop(); yield; }
next_track();
if (info.startsWith("sys_")) {
log_d("File ending was a system audio file. Not running next_track.");
} else {
next_track();
}
}

View File

@ -94,6 +94,7 @@ void setup() {
Serial.println("Setup finished.");
audio.setVolume(12);
audio.connecttoFS(SD, "/system/sys_ready.mp3");
ftp.begin("", "");
}
@ -113,7 +114,7 @@ void audio_id3data(const char *info){ //id3 metadata
}
void audio_eof_mp3(const char *info){ //end of file
Serial.print("eof_mp3 ");Serial.println(info);
controller.eof_mp3();
controller.eof_mp3(info);
}
void audio_showstation(const char *info){
Serial.print("station ");Serial.println(info);