diff --git a/nimble/host/src/ble_hs_adv.c b/nimble/host/src/ble_hs_adv.c index c99729e48..2ba1018be 100644 --- a/nimble/host/src/ble_hs_adv.c +++ b/nimble/host/src/ble_hs_adv.c @@ -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; diff --git a/porting/nimble/src/nimble_port.c b/porting/nimble/src/nimble_port.c index 654026f01..97b0345cf 100644 --- a/porting/nimble/src/nimble_port.c +++ b/porting/nimble/src/nimble_port.c @@ -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) {