mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
add WiFi TX power control
This commit is contained in:
parent
8943ac402c
commit
bbeaeaad54
@ -124,6 +124,23 @@ WiFiPhyMode_t ESP8266WiFiGenericClass::getPhyMode() {
|
|||||||
return (WiFiPhyMode_t) wifi_get_phy_mode();
|
return (WiFiPhyMode_t) wifi_get_phy_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the output power of WiFi
|
||||||
|
* @param dBm max: +20.5dBm min: 0dBm
|
||||||
|
*/
|
||||||
|
void ESP8266WiFiGenericClass::setOutputPower(float_t dBm) {
|
||||||
|
|
||||||
|
if(dBm > 20.5) {
|
||||||
|
dBm = 20.5;
|
||||||
|
} else if(dBm < 0) {
|
||||||
|
dBm = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t val = (dBm*4.0f);
|
||||||
|
system_phy_set_max_tpw(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* store WiFi config in SDK flash area
|
* store WiFi config in SDK flash area
|
||||||
* @param persistent
|
* @param persistent
|
||||||
|
@ -46,6 +46,8 @@ class ESP8266WiFiGenericClass {
|
|||||||
bool setPhyMode(WiFiPhyMode_t mode);
|
bool setPhyMode(WiFiPhyMode_t mode);
|
||||||
WiFiPhyMode_t getPhyMode();
|
WiFiPhyMode_t getPhyMode();
|
||||||
|
|
||||||
|
void setOutputPower(float_t dBm);
|
||||||
|
|
||||||
void persistent(bool persistent);
|
void persistent(bool persistent);
|
||||||
|
|
||||||
bool mode(WiFiMode_t);
|
bool mode(WiFiMode_t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user