BLE Tx Power Setting Error
Posted: Sun May 15, 2022 5:22 pm
ESP IDF:4.4.1 with Espressif ide Version: 2.4.2
Sourcecode: BLE Mesh - OnOffServer Example
Chip:ESP32-C3
While trying to set
err = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV,ESP_PWR_LVL_P9);
Following error comes:
error: implicit declaration of function 'esp_ble_tx_power_set'
Code compiles with warning when function modified as below:
esp_err_t esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV,ESP_PWR_LVL_P9);
warning: parameter names (without types) in function declaration
How to find whether tx power was applied successfully?
How to find the actual tx power in use?
Code (part only)
void app_main(void) {
esp_err_t err;
ESP_LOGI(TAG, "Initializing...");
board_init();
err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_ERROR_CHECK(nvs_flash_erase());
err = nvs_flash_init();
}
ESP_ERROR_CHECK(err);
err = bluetooth_init();
if (err) {
ESP_LOGE(TAG, "esp32_bluetooth_init failed (err %d)", err);
return;
}
ble_mesh_get_dev_uuid(dev_uuid);
/* Initialize the Bluetooth Mesh Subsystem */
err = ble_mesh_init();
//int v = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_SCAN, 8);
if (err) {
ESP_LOGE(TAG, "Bluetooth mesh init failed (err %d)", err);
} else {
err = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV,ESP_PWR_LVL_P9);
}
}
Sourcecode: BLE Mesh - OnOffServer Example
Chip:ESP32-C3
While trying to set
err = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV,ESP_PWR_LVL_P9);
Following error comes:
error: implicit declaration of function 'esp_ble_tx_power_set'
Code compiles with warning when function modified as below:
esp_err_t esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV,ESP_PWR_LVL_P9);
warning: parameter names (without types) in function declaration
How to find whether tx power was applied successfully?
How to find the actual tx power in use?
Code (part only)
void app_main(void) {
esp_err_t err;
ESP_LOGI(TAG, "Initializing...");
board_init();
err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_ERROR_CHECK(nvs_flash_erase());
err = nvs_flash_init();
}
ESP_ERROR_CHECK(err);
err = bluetooth_init();
if (err) {
ESP_LOGE(TAG, "esp32_bluetooth_init failed (err %d)", err);
return;
}
ble_mesh_get_dev_uuid(dev_uuid);
/* Initialize the Bluetooth Mesh Subsystem */
err = ble_mesh_init();
//int v = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_SCAN, 8);
if (err) {
ESP_LOGE(TAG, "Bluetooth mesh init failed (err %d)", err);
} else {
err = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV,ESP_PWR_LVL_P9);
}
}