@@ -83,7 +83,7 @@ void bt_app_a2d_data_cb(const uint8_t *data, uint32_t len)
8383#endif
8484
8585#ifdef CONFIG_ENABLE_AUDIO_PROMPT
86- if (uxBits & AUDIO_MP3_RUN_BIT ) {
86+ if (uxBits & BT_A2DP_IDLE_BIT || uxBits & AUDIO_MP3_RUN_BIT ) {
8787 return ;
8888 }
8989#endif
@@ -179,8 +179,9 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
179179 audio_mp3_play (1 );
180180 led_set_mode (3 );
181181
182- xEventGroupSetBits (user_event_group , VFX_FFT_FULL_BIT );
183182 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 );
184185 } else if (a2d -> conn_stat .state == ESP_A2D_CONNECTION_STATE_CONNECTED ) {
185186 xEventGroupSetBits (user_event_group , BT_OTA_LOCKED_BIT );
186187
@@ -208,13 +209,15 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
208209 if (a2d -> audio_cfg .mcc .type == ESP_A2D_MCT_SBC ) {
209210 int sample_rate = 16000 ;
210211 char oct0 = a2d -> audio_cfg .mcc .cie .sbc [0 ];
212+
211213 if (oct0 & (0x01 << 6 )) {
212214 sample_rate = 32000 ;
213215 } else if (oct0 & (0x01 << 5 )) {
214216 sample_rate = 44100 ;
215217 } else if (oct0 & (0x01 << 4 )) {
216218 sample_rate = 48000 ;
217219 }
220+
218221 i2s_set_output_sample_rate (sample_rate );
219222
220223 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)
224227 a2d -> audio_cfg .mcc .cie .sbc [3 ]);
225228 ESP_LOGI (BT_A2D_TAG , "audio player configured, sample rate=%d" , sample_rate );
226229 }
230+
231+ xEventGroupClearBits (user_event_group , BT_A2DP_IDLE_BIT );
232+
227233 break ;
228234 }
229235 default :
0 commit comments