Fixed RFID scanning and implemented calling actions on Player.

This commit is contained in:
2019-08-08 06:49:35 +02:00
parent 1bf2b04303
commit 8feb1ec760
4 changed files with 37 additions and 13 deletions

View File

@ -191,12 +191,12 @@ std::list<String> Player::_files_in_dir(String path) {
while (entry = dir.openNextFile()) {
String filename = entry.name();
if (!entry.isDirectory() &&
!filename.startsWith(".") &&
!filename.startsWith(".") &&
( filename.endsWith(".mp3") ||
filename.endsWith(".ogg") ||
filename.endsWith(".wma") ||
filename.endsWith(".mp4") ||
filename.endsWith(".mpa")) {
filename.endsWith(".mpa"))) {
//Serial.printf("Adding file %s\n", filename.c_str());
result.push_back(path + filename);
} else {
@ -211,6 +211,7 @@ std::list<String> Player::_files_in_dir(String path) {
}
bool Player::play_album(String album) {
//if (_state==playing) stop();
album_state s = _last_tracks[album.c_str()];
Serial.printf("Last index for album %s was %d,%d\n", album.c_str(), s.index, s.position);
return play_song(album, s.index, s.position);
@ -269,7 +270,7 @@ void Player::_play_file(String file, uint32_t file_offset) {
Serial.println("Resetting SS_DO_NOT_JUMP...");
_write_control_register(SCI_STATUS, _read_control_register(SCI_STATUS) & ~SS_DO_NOT_JUMP);
delay(100);
_refills = 0;
_skip_to = file_offset;
if (_skip_to>0) _mute();
@ -358,7 +359,7 @@ void Player::_refill() {
_finish_stopping();
return;
}
_finish_stopping();
bool result = play_song(_playing_album, _playing_index + 1);
if (!result) {
@ -387,8 +388,8 @@ void Player::_refill() {
bool Player::_refill_needed() {
return _state==playing ||
_state==stopping ||
_state==system_sound_while_playing ||
_state==stopping ||
_state==system_sound_while_playing ||
_state==system_sound_while_stopped;
}