Skip to content

Commit b2a1d31

Browse files
committed
bt_av: code cleanup
1 parent 57d45f4 commit b2a1d31

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

main/src/user/bt_av.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,16 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
212212
xEventGroupSetBits(user_event_group, BT_A2DP_IDLE_BIT);
213213
xEventGroupSetBits(user_event_group, VFX_RELOAD_BIT | VFX_FFT_FULL_BIT);
214214
} else if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_CONNECTED) {
215+
xEventGroupClearBits(user_event_group, BT_A2DP_IDLE_BIT);
216+
xEventGroupSetBits(user_event_group, BT_OTA_LOCKED_BIT);
217+
215218
memcpy(&a2d_remote_bda, a2d->conn_stat.remote_bda, sizeof(esp_bd_addr_t));
216219

217220
if (memcmp(&last_remote_bda, &a2d_remote_bda, sizeof(esp_bd_addr_t)) != 0) {
218221
memcpy(&last_remote_bda, &a2d_remote_bda, sizeof(esp_bd_addr_t));
219222
app_setenv("LAST_REMOTE_BDA", &last_remote_bda, sizeof(esp_bd_addr_t));
220223
}
221224

222-
xEventGroupSetBits(user_event_group, BT_OTA_LOCKED_BIT);
223-
224225
#ifdef CONFIG_ENABLE_AUDIO_PROMPT
225226
audio_player_play_file(0);
226227
#endif
@@ -265,8 +266,6 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
265266
ESP_LOGI(BT_A2D_TAG, "audio player configured, sample rate=%d", sample_rate);
266267
}
267268

268-
xEventGroupClearBits(user_event_group, BT_A2DP_IDLE_BIT);
269-
270269
break;
271270
}
272271
default:
@@ -391,7 +390,7 @@ static void bt_av_hdl_avrc_tg_evt(uint16_t event, void *p_param)
391390
break;
392391
}
393392
case ESP_AVRC_TG_SET_ABSOLUTE_VOLUME_CMD_EVT: {
394-
ESP_LOGI(BT_RC_TG_TAG, "AVRC set absolute volume: %d%%", (int)rc->set_abs_vol.volume * 100/ 0x7f);
393+
ESP_LOGI(BT_RC_TG_TAG, "AVRC set absolute volume: %d%%", (int)rc->set_abs_vol.volume * 100 / 0x7f);
395394
break;
396395
}
397396
case ESP_AVRC_TG_REGISTER_NOTIFICATION_EVT: {

0 commit comments

Comments
 (0)