@@ -138,6 +138,8 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
138
138
139
139
EventBits_t uxBits = xEventGroupGetBits (user_event_group );
140
140
if (!(uxBits & OS_PWR_SLEEP_BIT ) && !(uxBits & OS_PWR_RESET_BIT )) {
141
+ xEventGroupSetBits (user_event_group , KEY_SCAN_RUN_BIT | KEY_SCAN_CLR_BIT );
142
+
141
143
esp_bt_gap_set_scan_mode (ESP_BT_CONNECTABLE , ESP_BT_GENERAL_DISCOVERABLE );
142
144
}
143
145
@@ -152,6 +154,11 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
152
154
} else if (a2d -> conn_stat .state == ESP_A2D_CONNECTION_STATE_CONNECTED ) {
153
155
xEventGroupClearBits (user_event_group , BT_A2DP_IDLE_BIT );
154
156
157
+ EventBits_t uxBits = xEventGroupGetBits (user_event_group );
158
+ if (!(uxBits & OS_PWR_SLEEP_BIT ) && !(uxBits & OS_PWR_RESET_BIT )) {
159
+ xEventGroupSetBits (user_event_group , KEY_SCAN_RUN_BIT | KEY_SCAN_CLR_BIT );
160
+ }
161
+
155
162
memcpy (& a2d_remote_bda , a2d -> conn_stat .remote_bda , sizeof (esp_bd_addr_t ));
156
163
157
164
if (memcmp (& last_remote_bda , & a2d_remote_bda , sizeof (esp_bd_addr_t )) != 0 ) {
@@ -168,7 +175,7 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
168
175
led_set_mode (2 );
169
176
#endif
170
177
} else {
171
- xEventGroupClearBits (user_event_group , BT_A2DP_IDLE_BIT );
178
+ xEventGroupClearBits (user_event_group , BT_A2DP_IDLE_BIT | KEY_SCAN_RUN_BIT );
172
179
}
173
180
break ;
174
181
}
0 commit comments