Added MQTT client, better speaker handling, fixed bug in FTP server, ...
This commit is contained in:
@ -113,7 +113,7 @@ void Player::_wakeup() {
|
||||
_write_control_register(SCI_AUDATA, 0x0000);
|
||||
_write_control_register(SCI_CLOCKF, 0x6000);
|
||||
delay(10);
|
||||
_speaker_on();
|
||||
//_speaker_on();
|
||||
_spi_settings = &_spi_settings_fast;
|
||||
_state = idle;
|
||||
}
|
||||
@ -224,12 +224,14 @@ void Player::vol_down() {
|
||||
|
||||
void Player::_mute() {
|
||||
INFO("Muting.\n");
|
||||
_speaker_off();
|
||||
set_volume(1, false);
|
||||
}
|
||||
|
||||
void Player::_unmute() {
|
||||
INFO("Unmuting.\n");
|
||||
set_volume(_volume, false);
|
||||
_speaker_on();
|
||||
}
|
||||
|
||||
void Player::track_next() {
|
||||
@ -407,6 +409,7 @@ void Player::_play_file(String file, uint32_t file_offset) {
|
||||
_current_play_position = _file.position();
|
||||
_skip_to = file_offset;
|
||||
if (_skip_to>0) _mute();
|
||||
else _speaker_on();
|
||||
INFO("Now playing.\n");
|
||||
}
|
||||
|
||||
@ -459,7 +462,7 @@ void Player::_finish_playing() {
|
||||
_init();
|
||||
}
|
||||
|
||||
void Player::stop() {
|
||||
void Player::stop(bool turn_speaker_off) {
|
||||
if (_state != playing /* && _state != system_sound_while_playing && _state != system_sound_while_stopped*/) return;
|
||||
INFO("Stopping...\n");
|
||||
if (_state == playing) {
|
||||
@ -474,7 +477,7 @@ void Player::stop() {
|
||||
uint16_t mode = _read_control_register(SCI_MODE);
|
||||
if ((mode & SM_CANCEL) == 0) {
|
||||
_flush(2052, endbyte);
|
||||
_finish_stopping();
|
||||
_finish_stopping(turn_speaker_off);
|
||||
break;
|
||||
} else if (_stop_delay > 2048) {
|
||||
init();
|
||||
@ -484,7 +487,8 @@ void Player::stop() {
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_finish_stopping() {
|
||||
void Player::_finish_stopping(bool turn_speaker_off) {
|
||||
if (turn_speaker_off) _speaker_off();
|
||||
_state = idle;
|
||||
_stopped_at = millis();
|
||||
if (_file) {
|
||||
@ -501,17 +505,17 @@ void Player::_refill() {
|
||||
if (result == 0) {
|
||||
// File is over.
|
||||
DEBUG("EOF reached.\n");
|
||||
_skip_to = 0;
|
||||
_finish_playing();
|
||||
if (_state == system_sound_while_playing) {
|
||||
_finish_stopping();
|
||||
_finish_stopping(false);
|
||||
play_album(_playing_album);
|
||||
return;
|
||||
} else if (_state == system_sound_while_stopped) {
|
||||
_finish_stopping();
|
||||
_finish_stopping(true);
|
||||
return;
|
||||
}
|
||||
|
||||
_finish_stopping();
|
||||
_finish_stopping(false);
|
||||
bool result = play_song(_playing_album, _playing_index + 1);
|
||||
if (!result) {
|
||||
_set_last_track(_playing_album.c_str(), 0, 0);
|
||||
|
Reference in New Issue
Block a user