Better handling of eof_mp3 events: Keep playing as long as there is data remaining.
This commit is contained in:
		@@ -27,4 +27,5 @@ class Controller {
 | 
			
		||||
	void play();
 | 
			
		||||
	void play(String rfid_id);
 | 
			
		||||
	void stop();
 | 
			
		||||
	void eof_mp3();
 | 
			
		||||
};
 | 
			
		||||
@@ -209,3 +209,9 @@ bool Controller::is_button_pressed(uint8_t pin) {
 | 
			
		||||
	}
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Controller::eof_mp3() {
 | 
			
		||||
	log_d("Handling eof. Keep playing until the file is finished.");
 | 
			
		||||
	while(audio.isRunning()) { audio.loop(); yield; }
 | 
			
		||||
	next_track();
 | 
			
		||||
}
 | 
			
		||||
@@ -109,7 +109,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.next_track();
 | 
			
		||||
	controller.eof_mp3();
 | 
			
		||||
}
 | 
			
		||||
void audio_showstation(const char *info){
 | 
			
		||||
    Serial.print("station     ");Serial.println(info);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user