I'm interested in hardcoding the maximum supported TX power value for BLE scans for hardware testing. According to a recent post, +9db is the max supported value via the esp-idf API:
https://github.com/espressif/esp-idf/is ... -493992705
It seems this has been briefly discussed previously and is a planned feature:
https://github.com/micropython/micropyt ... -503046267
https://github.com/micropython/micropyt ... -540526800
I don't need to modify it on the fly, so hardcoding this prior to firmware compilation is fine. Could anyone give me some basic guidance on how to achieve this?
Hardcoding BLE TX Power
Re: Hardcoding BLE TX Power
I think you should be able to add the call to esp_ble_tx_power_set in ports/esp32/nimble.c / mp_bluetooth_nimble_port_preinit()
Re: Hardcoding BLE TX Power
I sorted it out.
In case someone else finds this post:
In the file ports/esp32/mp_nimbleport.c i added an #include "esp_bt.h" and in the function mp_bluetooth_nimble_port_hci_init(void) after esp_nimble_hci_and_controller_init() i added the following:
Seems to work.
I wish I knew enough about how this all fits together to make a function to set it from Micropython, but I'm not there yet.
In case someone else finds this post:
In the file ports/esp32/mp_nimbleport.c i added an #include "esp_bt.h" and in the function mp_bluetooth_nimble_port_hci_init(void) after esp_nimble_hci_and_controller_init() i added the following:
Code: Select all
esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_DEFAULT, ESP_PWR_LVL_P9);
esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, ESP_PWR_LVL_P9);
I wish I knew enough about how this all fits together to make a function to set it from Micropython, but I'm not there yet.