diff --git a/components/bt/host/nimble/nimble b/components/bt/host/nimble/nimble index 2e9782126bf..1022de21ca9 160000 --- a/components/bt/host/nimble/nimble +++ b/components/bt/host/nimble/nimble @@ -1 +1 @@ -Subproject commit 2e9782126bf348ca3be06f04d1eb7792dc546dbe +Subproject commit 1022de21ca9eb62af86b2b59024b29bff17f29c8 diff --git a/components/bt/host/nimble/port/include/esp_nimble_cfg.h b/components/bt/host/nimble/port/include/esp_nimble_cfg.h index af22b75fb0d..d50070e5711 100644 --- a/components/bt/host/nimble/port/include/esp_nimble_cfg.h +++ b/components/bt/host/nimble/port/include/esp_nimble_cfg.h @@ -15,8 +15,12 @@ * attempt to use these macros without including this header will result in a * compiler error. */ +#ifndef MYNEWT_VAL #define MYNEWT_VAL(_name) MYNEWT_VAL_ ## _name +#endif +#ifndef MYNEWT_VAL_CHOICE #define MYNEWT_VAL_CHOICE(_name, _val) MYNEWT_VAL_ ## _name ## __ ## _val +#endif #ifndef IRAM_ATTR_64MCPU #define IRAM_ATTR_64MCPU IRAM_ATTR diff --git a/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_cent/main/main.c b/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_cent/main/main.c index e7029e278d4..1223715a026 100644 --- a/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_cent/main/main.c +++ b/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_cent/main/main.c @@ -24,14 +24,6 @@ static int8_t tx_pwr_lvl; static struct ble_prox_cent_conn_peer conn_peer[MYNEWT_VAL(BLE_MAX_CONNECTIONS) + 1]; static struct ble_prox_cent_link_lost_peer disconn_peer[MYNEWT_VAL(BLE_MAX_CONNECTIONS) + 1]; -/* Note: Path loss is calculated using formula : threshold - RSSI value - * by default threshold is kept -128 as per the spec - * high_threshold and low_threshold are hardcoded after testing and noting - * RSSI values when distance between devices are less and more. - */ -static int8_t high_threshold = -70; -static int8_t low_threshold = -100; - void ble_store_config_init(void); static void ble_prox_cent_scan(void); static int ble_prox_cent_gap_event(struct ble_gap_event *event, void *arg); @@ -661,16 +653,11 @@ ble_prox_cent_path_loss_task(void *pvParameters) MODLOG_DFLT(INFO, "path loss = %d pwr lvl = %d rssi = %d", path_loss, tx_pwr_lvl, rssi); - if ((conn_peer[i].val_handle != 0) && - (path_loss > high_threshold || path_loss < low_threshold)) { - - if (path_loss < low_threshold) { - path_loss = 0; - } - + if (conn_peer[i].val_handle != 0) { + int8_t path_loss_val = (int8_t)path_loss; #if MYNEWT_VAL(BLE_GATTC) rc = ble_gattc_write_no_rsp_flat(i, conn_peer[i].val_handle, - &path_loss, sizeof(path_loss)); + &path_loss_val, sizeof(path_loss_val)); if (rc != 0) { MODLOG_DFLT(ERROR, "Error: Failed to write characteristic; rc=%d\n", rc);