WiFi reducing tx power to negative values

timmbo
Posts: 30
Joined: Fri Jan 03, 2020 11:43 am

WiFi reducing tx power to negative values

Postby timmbo » Wed Oct 14, 2020 1:39 pm

Hey there,

I use esp_wifi_set_max_tx_power to reduce the output power of the wifi driver (actually for ESP NOW, but it applies to WiFi as well). The documentation says valid values range from 8 (= 2dBm) to 78 (= 19.5dBm).

How can I achieve negative dBm values like BLE is using? I also found out that for Arduino there is a function in WiFiGeneric.h:

Code: Select all

/**
 * control wifi tx power
 * @param power enum maximum wifi tx power
 * @return ok
 */
bool WiFiGenericClass::setTxPower(wifi_power_t power){
    if((getStatusBits() & (STA_STARTED_BIT | AP_STARTED_BIT)) == 0){
        log_w("Neither AP or STA has been started");
        return false;
    }
    return esp_wifi_set_max_tx_power(power) == ESP_OK;
}
Here wifi_power_t can also be negative:

Code: Select all

typedef enum {
    WIFI_POWER_19_5dBm = 78,// 19.5dBm
    WIFI_POWER_19dBm = 76,// 19dBm
    WIFI_POWER_18_5dBm = 74,// 18.5dBm
    WIFI_POWER_17dBm = 68,// 17dBm
    WIFI_POWER_15dBm = 60,// 15dBm
    WIFI_POWER_13dBm = 52,// 13dBm
    WIFI_POWER_11dBm = 44,// 11dBm
    WIFI_POWER_8_5dBm = 34,// 8.5dBm
    WIFI_POWER_7dBm = 28,// 7dBm
    WIFI_POWER_5dBm = 20,// 5dBm
    WIFI_POWER_2dBm = 8,// 2dBm
    WIFI_POWER_MINUS_1dBm = -4// -1dBm
} wifi_power_t;
Does this also work on the latest esp idf release? Negative values are not documented unfortunately.

Best,
Timm

topphisitian
Posts: 4
Joined: Mon May 15, 2023 9:17 am

Re: WiFi reducing tx power to negative values

Postby topphisitian » Wed Oct 25, 2023 1:13 pm

Have you find a solution?

Who is online

Users browsing this forum: No registered users and 400 guests