feat(esp8266): add settings for wifi tx power to menuconfig

This commit is contained in:
Zhang Jun Hao
2019-04-18 11:35:58 +08:00
parent 08fc1b8b63
commit aeaa66ec08
2 changed files with 16 additions and 6 deletions

View File

@ -455,5 +455,13 @@ config ESP_PHY_INIT_DATA_VDD33_CONST
When the ADC reference voltage is set to the actual VDD33 power supply voltage, the value range of vdd33_const is [18,36], the unit is 0.1V.
When the ADC reference voltage is set to the default value of 3.3V as the supply voltage, the range of vdd33_const is [0, 18] or (36, 255).
config ESP8266_PHY_MAX_WIFI_TX_POWER
int "Max WiFi TX power (dBm)"
range 0 21
default 20
help
Set maximum transmit power for WiFi radio. Actual transmit power for high
data rates may be lower than this setting.
endmenu # PHY

View File

@ -17,6 +17,8 @@
#include "esp_phy_init.h"
#include "sdkconfig.h"
// constrain a value between 'low' and 'high', inclusive
#define LIMIT(val, low, high) ((val < low) ? low : (val > high) ? high : val)
#define PHY_INIT_MAGIC "PHYINIT"
static const char phy_init_magic_pre[] = PHY_INIT_MAGIC;
@ -59,12 +61,12 @@ static const esp_phy_init_data_t phy_init_data= { {
0x00,
0xf8,
0xf8,
0x52,
0x4e,
0x4a,
0x44,
0x40,
0x38,
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x52),
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x4e),
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x4a),
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x44),
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x40),
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x38),
0x00,
0x00,
0x01,