@@ -83,7 +83,7 @@ void bt_app_a2d_data_cb(const uint8_t *data, uint32_t len)
83
83
#endif
84
84
85
85
#ifdef CONFIG_ENABLE_AUDIO_PROMPT
86
- if (uxBits & AUDIO_MP3_RUN_BIT ) {
86
+ if (uxBits & BT_A2DP_IDLE_BIT || uxBits & AUDIO_MP3_RUN_BIT ) {
87
87
return ;
88
88
}
89
89
#endif
@@ -179,8 +179,9 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
179
179
audio_mp3_play (1 );
180
180
led_set_mode (3 );
181
181
182
- xEventGroupSetBits (user_event_group , VFX_FFT_FULL_BIT );
183
182
xEventGroupSetBits (user_event_group , VFX_RELOAD_BIT );
183
+ xEventGroupSetBits (user_event_group , VFX_FFT_FULL_BIT );
184
+ xEventGroupSetBits (user_event_group , BT_A2DP_IDLE_BIT );
184
185
} else if (a2d -> conn_stat .state == ESP_A2D_CONNECTION_STATE_CONNECTED ) {
185
186
xEventGroupSetBits (user_event_group , BT_OTA_LOCKED_BIT );
186
187
@@ -208,13 +209,15 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
208
209
if (a2d -> audio_cfg .mcc .type == ESP_A2D_MCT_SBC ) {
209
210
int sample_rate = 16000 ;
210
211
char oct0 = a2d -> audio_cfg .mcc .cie .sbc [0 ];
212
+
211
213
if (oct0 & (0x01 << 6 )) {
212
214
sample_rate = 32000 ;
213
215
} else if (oct0 & (0x01 << 5 )) {
214
216
sample_rate = 44100 ;
215
217
} else if (oct0 & (0x01 << 4 )) {
216
218
sample_rate = 48000 ;
217
219
}
220
+
218
221
i2s_set_output_sample_rate (sample_rate );
219
222
220
223
ESP_LOGI (BT_A2D_TAG , "configure audio player %x-%x-%x-%x" ,
@@ -224,6 +227,9 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
224
227
a2d -> audio_cfg .mcc .cie .sbc [3 ]);
225
228
ESP_LOGI (BT_A2D_TAG , "audio player configured, sample rate=%d" , sample_rate );
226
229
}
230
+
231
+ xEventGroupClearBits (user_event_group , BT_A2DP_IDLE_BIT );
232
+
227
233
break ;
228
234
}
229
235
default :
0 commit comments