fix(nimble): fix esp_hid_device example when static_to_dynamic enabled

This commit is contained in:
Astha Verma
2026-01-12 17:54:08 +05:30
parent bec112ac57
commit 039d2d62ed
2 changed files with 11 additions and 8 deletions
+7 -1
View File
@@ -641,7 +641,9 @@ ble_hs_adv_parse_uuids16(struct ble_hs_adv_fields *adv_fields,
{
ble_uuid_any_t uuid;
int uuid_cnt;
#if MYNEWT_VAL(BLE_ADV_UUID_CONCAT)
int free_slots;
#endif
if (data_len % 2 != 0) {
return BLE_HS_EBADDATA;
@@ -670,7 +672,7 @@ ble_hs_adv_parse_uuids16(struct ble_hs_adv_fields *adv_fields,
adv_fields->num_uuids16 += uuid_cnt;
#else
adv_fields->uuids16 = ble_hs_adv_uuids16;
adv_fields->num_uuids16 = data_len / 2;
adv_fields->num_uuids16 = uuid_cnt;
for (int i = 0; i < adv_fields->num_uuids16; i++) {
ble_uuid_init_from_buf(&uuid, data + i * 2, 2);
@@ -686,7 +688,9 @@ ble_hs_adv_parse_uuids32(struct ble_hs_adv_fields *adv_fields,
{
ble_uuid_any_t uuid;
int uuid_cnt;
#if MYNEWT_VAL(BLE_ADV_UUID_CONCAT)
int free_slots;
#endif
if (data_len % 4 != 0) {
return BLE_HS_EBADDATA;
@@ -732,7 +736,9 @@ ble_hs_adv_parse_uuids128(struct ble_hs_adv_fields *adv_fields,
{
ble_uuid_any_t uuid;
int uuid_cnt;
#if MYNEWT_VAL(BLE_ADV_UUID_CONCAT)
int free_slots;
#endif
if (data_len % 16 != 0) {
return BLE_HS_EBADDATA;
+4 -7
View File
@@ -153,6 +153,10 @@ esp_err_t esp_nimble_init(void)
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
/* Reset deinit flag at start of new init cycle */
ble_npl_reset_deinit_flag();
if (ble_npl_ensure_ctx()) {
return ESP_FAIL;
}
#endif
#if CONFIG_BT_CONTROLLER_DISABLED
@@ -303,13 +307,6 @@ nimble_port_init(void)
}
#endif
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
ret = ble_npl_ensure_ctx();
if (ret != ESP_OK) {
return ret;
}
#endif
ret = esp_nimble_init();
if (ret != ESP_OK) {