Bluetooth blocking wifi check?
Posted: Tue Mar 01, 2022 7:24 am
I am currently running the esp32 in dual BT/wifi mode. I've noticed that when the BT is listening for devices I cannot send data over wifi. I know BT and WiFi share the antenna, so it make sense that when one is using the other cannot. Is there a way to check to see if wifi can send data or if it is blocked? The following code will output the Error when it trys the send data to the socket and it is blocked. Once the BT stops listening, the the data is sent fine. Thanks.
Code: Select all
while (1) {
//int err = bind(sock, (struct sockaddr *)&tx_addr, sizeof(tx_addr));
if (uxQueueMessagesWaiting(audio_data_queue) > 0){
uint16_t msg[128]; //128
xStatus = xQueueReceive( audio_data_queue, &msg, 1 );
//ESP_LOGI(TAG, "Size of MSG: %d", sizeof(msg));
err = sendto(sock, &msg, sizeof(msg), 0, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
if (err < 0) {
ESP_LOGE(TAG, "Error occurred during sending: errno %d", errno);
// break;
}
}}