Hi
I am using hci_pwr_ctrl and want to get the RSS (read_conn_rssi(default_conn_handle, &rssi) in a very high frequency. However, I notice when I use 100Hz frequency, a series of RSSI are the same. I suspect that the RSSI is not updated correctly and needs to be updated at a certain frequency. Is this correct?
void modulate_tx_power(void *p1, void *p2, void *p3)
{
int8_t txp_get = 0;
uint8_t idx = 0;
while (1) {
if (!default_conn) {
printk("Set Tx power level to %d\n", txpower[idx]);
set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV,
0, txpower[1]); //一直0
k_sleep(K_SECONDS(5));
printk("Get Tx power level -> ");
get_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV,
0, &txp_get);
printk("TXP = %d\n", txp_get);
idx = (idx+1) % DEVICE_BEACON_TXPOWER_NUM;
} else {
int8_t rssi = 0xFF;
int8_t txp_adaptive;
idx = 0;
read_conn_rssi(default_conn_handle, &rssi);
printk("Connected (%d) - RSSI = %d\n",
default_conn_handle, rssi);
if (rssi > -70) {
txp_adaptive = 0;//一直0
} else if (rssi > -90) {
txp_adaptive = -12;
} else {
txp_adaptive = -4;
}
printk("Adaptive Tx power selected = %d\n",
txp_adaptive);
set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_CONN,
default_conn_handle, txp_adaptive);
get_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_CONN,
default_conn_handle, &txp_get);
printk("Connection (%d) TXP = %d\n",
default_conn_handle, txp_get);
k_sleep(K_MSEC(10));
}
}
}
