Skip to content

Commit 313f4a9

Browse files
committed
Merge branch 'bugfix/btdm_blufi_send_longer_custom_data_will_congested' into 'master'
component/bt: fix Blufi sends longer customer data will will lead congested See merge request espressif/esp-idf!9887
2 parents 01d55b9 + fa729f3 commit 313f4a9

File tree

1 file changed

+9
-1
lines changed
  • components/bt/host/bluedroid/btc/profile/esp/blufi

1 file changed

+9
-1
lines changed

components/bt/host/bluedroid/btc/profile/esp/blufi/blufi_prf.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "blufi_int.h"
3737

3838
#include "esp_blufi_api.h"
39+
#include "esp_gatt_common_api.h"
3940

4041
#if (GATTS_INCLUDED == TRUE)
4142

@@ -530,10 +531,17 @@ void btc_blufi_send_encap(uint8_t type, uint8_t *data, int total_data_len)
530531
remain_len -= hdr->data_len;
531532
}
532533

533-
btc_blufi_send_notify((uint8_t *)hdr,
534+
retry:
535+
if (esp_ble_get_cur_sendable_packets_num(blufi_env.conn_id) > 0) {
536+
btc_blufi_send_notify((uint8_t *)hdr,
534537
((hdr->fc & BLUFI_FC_CHECK) ?
535538
hdr->data_len + sizeof(struct blufi_hdr) + 2 :
536539
hdr->data_len + sizeof(struct blufi_hdr)));
540+
} else {
541+
BTC_TRACE_WARNING("%s wait to send blufi custom data\n", __func__);
542+
vTaskDelay(pdMS_TO_TICKS(10));
543+
goto retry;
544+
}
537545

538546
osi_free(hdr);
539547
hdr = NULL;

0 commit comments

Comments
 (0)