esp_wifi_set_max_tx_power, help with programming guide info

username
Posts: 196
Joined: Thu May 03, 2018 1:18 pm

esp_wifi_set_max_tx_power, help with programming guide info

Postby username » Tue Dec 18, 2018 2:04 am

ok, it seems i am less on the IQ scale than most with the programming guide information.
Looking for some deciphering of the docs that make absolutely no sense to me.
Looking here: https://demo-dijiudu.readthedocs.io/en/ ... wer6int8_t

It looks nicely detailed at first glance to me. Where it falls apart for me is the parameter to pass to it.
it states "WiFi transmiting power is divided to six levels in phy init data. Level0 represents highest transmiting power and level5 represents lowest transmiting power." and "power: Maximum WiFi transmiting power."

OK? are there defines already set up for this? if not what value am i to send to it?

I am looking for a two fold answer.
#1) The answer on what to pass
#2) how did you figure out what to pass to it by this description, so I can learn better on my own.

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: esp_wifi_set_max_tx_power, help with programming guide info

Postby loboris » Tue Dec 18, 2018 9:24 am

As the value range for CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER in menuconfig is 0 - 20, I can only assume the range for esp_wifi_set_max_tx_power() is the same.
It is indeed not clear from the function description and the function source is not available.

username
Posts: 196
Joined: Thu May 03, 2018 1:18 pm

Re: esp_wifi_set_max_tx_power, help with programming guide info

Postby username » Tue Dec 18, 2018 10:16 am

Well at least I am not alone in thinking the doc was confusing.

boarchuz
Posts: 287
Joined: Tue Aug 21, 2018 5:28 am

Re: esp_wifi_set_max_tx_power, help with programming guide info

Postby boarchuz » Tue Dec 18, 2018 12:08 pm

At the same link you provided there's also esp_wifi_get_max_tx_power(int8_t *power) which seems to complement the function to set it.
https://demo-dijiudu.readthedocs.io/en/ ... erP6int8_t

So I think 78 is your answer.

username
Posts: 196
Joined: Thu May 03, 2018 1:18 pm

Re: esp_wifi_set_max_tx_power, help with programming guide info

Postby username » Tue Dec 18, 2018 12:26 pm

Not saying your incorrect, but then the tx/rx tables dont jive with one another.

boarchuz
Posts: 287
Joined: Tue Aug 21, 2018 5:28 am

Re: esp_wifi_set_max_tx_power, help with programming guide info

Postby boarchuz » Tue Dec 18, 2018 1:33 pm

I actually had a look at the esp_wifi_set_max_tx_power function this time and it seems fairly clear to me, though I agree the values seem rather arbitrary.

Here's my understanding as an amateur: esp_wifi_set_max_tx_power takes a int8_t as a parameter indicating the desired power level. So acceptable values for the function are in the range -128 to 127. It tells us that "WiFi transmiting power is divided to six levels in phy init data." So the value passed to the function must then be mapped to one of these six levels (while level5 is broken up into many sub-levels, it seems, so there are effectively 12 levels). Simply feed the function the "int8_t power" within the range of the level you desire.

So if you called esp_wifi_set_max_tx_power(71), the transmission power would be set to level3 because we can see by the table that 71 lies within the range [68, 73] corresponding to level3.

username
Posts: 196
Joined: Thu May 03, 2018 1:18 pm

Re: esp_wifi_set_max_tx_power, help with programming guide info

Postby username » Tue Dec 18, 2018 1:54 pm

I agree (now, after much checking into things) that the range is -128 to 127. But it should not take more than 30 seconds to figure out what to pass to it from the docs. What makes matters even worse is when you look at the rx level return values, which then confuses what your trying to interpret from the vague tx levels.

I.E. if i set tx to level 71, then do a get_tx what am i going to get back, 68 or 74 ?

To the point, I have figured out what I need to know, but the document writing needs some help.

Who is online

Users browsing this forum: No registered users and 41 guests