- fix missing mac address in hello message when ethernet is used
- fix noise when adau1961 is used and muted - fix ESP32 not booting because active REFCLK from LAN8720 some code polish
This commit is contained in:
@@ -563,12 +563,27 @@ esp_err_t adau1961_set_mute(bool enable) {
|
||||
esp_err_t ret = ESP_OK;
|
||||
uint8_t data[3];
|
||||
|
||||
// Playback right and left channel enable
|
||||
data[0] = (uint8_t)(R35_PLAYBACK_PWR_MGMT >> 8);
|
||||
data[1] = (uint8_t)R35_PLAYBACK_PWR_MGMT;
|
||||
data[2] = (!enable << 1) | (!enable << 0);
|
||||
// left channel
|
||||
// get mixer 3 control reg
|
||||
data[0] = (uint8_t)(R22_PLAYBACK_MIXER3_LEFT_CTRL0 >> 8);
|
||||
data[1] = (uint8_t)R22_PLAYBACK_MIXER3_LEFT_CTRL0;
|
||||
ret = i2c_bus_read_bytes(i2c_handler, adau1961_addr, data, 2, &data[2], 1);
|
||||
ADAU1961_ASSERT(ret, "Fail to read R22_PLAYBACK_MIXER3_LEFT_CTRL0", ESP_FAIL);
|
||||
|
||||
data[2] = (!enable << 5);
|
||||
ret = i2c_bus_write_data(i2c_handler, adau1961_addr, data, 3);
|
||||
ADAU1961_ASSERT(ret, "Fail to write R35_PLAYBACK_PWR_MGMT", ESP_FAIL);
|
||||
ADAU1961_ASSERT(ret, "Fail to set R22_PLAYBACK_MIXER3_LEFT_CTRL0", ESP_FAIL);
|
||||
|
||||
// right channel
|
||||
// get mixer 4 control reg
|
||||
data[0] = (uint8_t)(R24_PLAYBACK_MIXER4_RIGHT_CTRL0 >> 8);
|
||||
data[1] = (uint8_t)R24_PLAYBACK_MIXER4_RIGHT_CTRL0;
|
||||
ret = i2c_bus_read_bytes(i2c_handler, adau1961_addr, data, 2, &data[2], 1);
|
||||
ADAU1961_ASSERT(ret, "Fail to read R22_PLAYBACK_MIXER3_LEFT_CTRL0", ESP_FAIL);
|
||||
|
||||
data[2] = (!enable << 6);
|
||||
ret = i2c_bus_write_data(i2c_handler, adau1961_addr, data, 3);
|
||||
ADAU1961_ASSERT(ret, "Fail to set R24_PLAYBACK_MIXER4_RIGHT_CTRL0", ESP_FAIL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -397,36 +397,28 @@ int32_t player_send_snapcast_setting(snapcastSetting_t *setting) {
|
||||
(curSet.codec != setting->codec) || (curSet.muted != setting->muted) ||
|
||||
(curSet.sr != setting->sr) || (curSet.volume != setting->volume) ||
|
||||
(curSet.cDacLat_ms != setting->cDacLat_ms)) {
|
||||
ret = player_set_snapcast_settings(setting);
|
||||
if (ret != pdPASS) {
|
||||
ESP_LOGE(TAG,
|
||||
"player_send_snapcast_setting: couldn't change "
|
||||
"snapcast setting");
|
||||
}
|
||||
|
||||
// check if it is only volume / mute related setting, which is handled by
|
||||
// http_get_task()
|
||||
if (((curSet.muted != setting->muted) ||
|
||||
(curSet.volume != setting->volume)) &&
|
||||
((curSet.bits == setting->bits) && (curSet.buf_ms == setting->buf_ms) &&
|
||||
(curSet.ch == setting->ch) &&
|
||||
(curSet.chkInFrames == setting->chkInFrames) &&
|
||||
(curSet.codec == setting->codec) && (curSet.sr == setting->sr) &&
|
||||
(curSet.cDacLat_ms == setting->cDacLat_ms))) {
|
||||
// no notify needed, only set changed parameters
|
||||
ret = player_set_snapcast_settings(setting);
|
||||
if (ret != pdPASS) {
|
||||
ESP_LOGE(TAG,
|
||||
"player_send_snapcast_setting: couldn't change "
|
||||
"snapcast setting");
|
||||
}
|
||||
} else {
|
||||
if ((((curSet.muted != setting->muted) ||
|
||||
(curSet.volume != setting->volume)) &&
|
||||
((curSet.bits == setting->bits) &&
|
||||
(curSet.buf_ms == setting->buf_ms) && (curSet.ch == setting->ch) &&
|
||||
(curSet.chkInFrames == setting->chkInFrames) &&
|
||||
(curSet.codec == setting->codec) && (curSet.sr == setting->sr) &&
|
||||
(curSet.cDacLat_ms == setting->cDacLat_ms))) == false) {
|
||||
// notify needed
|
||||
ret = xQueueOverwrite(snapcastSettingQueueHandle, &settingChanged);
|
||||
if (ret != pdPASS) {
|
||||
ESP_LOGE(TAG,
|
||||
"player_send_snapcast_setting: couldn't notify "
|
||||
"snapcast setting");
|
||||
} else {
|
||||
// notify successful, so change parameters
|
||||
ret = player_set_snapcast_settings(setting);
|
||||
if (ret != pdPASS) {
|
||||
ESP_LOGE(TAG,
|
||||
"player_send_snapcast_setting: couldn't "
|
||||
"change snapcast setting");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1063,6 +1055,8 @@ static void player_task(void *pvParameters) {
|
||||
|
||||
if ((scSet.sr != __scSet.sr) || (scSet.bits != __scSet.bits) ||
|
||||
(scSet.ch != __scSet.ch)) {
|
||||
i2s_custom_start(I2S_NUM_0);
|
||||
audio_set_mute(true);
|
||||
i2s_custom_stop(I2S_NUM_0);
|
||||
|
||||
ret = player_setup_i2s(I2S_NUM_0, ¤tSnapcastSetting);
|
||||
@@ -1079,8 +1073,6 @@ static void player_task(void *pvParameters) {
|
||||
i2s_custom_set_clk(I2S_NUM_0, __scSet.sr, __scSet.bits, __scSet.ch);
|
||||
|
||||
initialSync = 0;
|
||||
|
||||
audio_set_mute(true);
|
||||
}
|
||||
|
||||
if ((__scSet.buf_ms != scSet.buf_ms) ||
|
||||
@@ -1382,12 +1374,12 @@ static void player_task(void *pvParameters) {
|
||||
timer_pause(TIMER_GROUP_1, TIMER_1);
|
||||
timer_set_auto_reload(TIMER_GROUP_1, TIMER_1, TIMER_AUTORELOAD_DIS);
|
||||
|
||||
audio_set_mute(true);
|
||||
|
||||
i2s_custom_stop(I2S_NUM_0);
|
||||
|
||||
initialSync = 0;
|
||||
|
||||
audio_set_mute(true);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ static const char *provSsid = CONFIG_WIFI_PROVISIONING_SSID;
|
||||
|
||||
static const char *TAG = "WIFI";
|
||||
|
||||
char mac_address[18];
|
||||
static char mac_address[18];
|
||||
|
||||
EventGroupHandle_t s_wifi_event_group;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user