Set Audio channel from TWS side

Use the TWS side detection to figure out if your Left or Right; rather than relying on the master to be the right bud (not always true if you flash and pair left first).
This commit is contained in:
Ben V. Brown 2022-12-28 21:30:20 +11:00
parent 9a9ad05100
commit 1527ed4edd
1 changed files with 19 additions and 13 deletions

View File

@ -15,6 +15,7 @@
****************************************************************************/ ****************************************************************************/
#include <string.h> #include <string.h>
#include "app_tws_ibrt_trace.h" #include "app_tws_ibrt_trace.h"
#include "app_tws_if.h"
#include "bluetooth.h" #include "bluetooth.h"
#include "btapp.h" #include "btapp.h"
#include "app_ibrt_ui.h" #include "app_ibrt_ui.h"
@ -210,22 +211,27 @@ void app_bt_manager_ibrt_role_process(const btif_event_t *Event)
{ {
memcpy(p_ibrt_ctrl->local_addr.address,p_remote_dev_addr->address,6); memcpy(p_ibrt_ctrl->local_addr.address,p_remote_dev_addr->address,6);
} }
if (app_tws_is_left_side()){
#if 0 p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_LCHNL;
p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_LRMERGE; }else {
#else
if(IBRT_MASTER == p_ibrt_ctrl->nv_role)
{
TRACE(0,"#right");
p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_RCHNL; p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_RCHNL;
} }
else if(IBRT_SLAVE == p_ibrt_ctrl->nv_role)
{
TRACE(0,"#left");
p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_LCHNL;
} // #if 0
#endif // p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_LRMERGE;
// #else
// if(IBRT_MASTER == p_ibrt_ctrl->nv_role)
// {
// TRACE(0,"#right");
// p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_RCHNL;
// }
// else if(IBRT_SLAVE == p_ibrt_ctrl->nv_role)
// {
// TRACE(0,"#left");
// p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_LCHNL;
// }
// #endif
} }
} }