File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
libraries/ESP8266WiFi/src Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,23 @@ WiFiPhyMode_t ESP8266WiFiGenericClass::getPhyMode() {
124124 return (WiFiPhyMode_t) wifi_get_phy_mode ();
125125}
126126
127+ /* *
128+ * set the output power of WiFi
129+ * @param dBm max: +20.5dBm min: 0dBm
130+ */
131+ void ESP8266WiFiGenericClass::setOutputPower (float_t dBm) {
132+
133+ if (dBm > 20.5 ) {
134+ dBm = 20.5 ;
135+ } else if (dBm < 0 ) {
136+ dBm = 0 ;
137+ }
138+
139+ uint8_t val = (dBm*4 .0f );
140+ system_phy_set_max_tpw (val);
141+ }
142+
143+
127144/* *
128145 * store WiFi config in SDK flash area
129146 * @param persistent
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ class ESP8266WiFiGenericClass {
4646 bool setPhyMode (WiFiPhyMode_t mode);
4747 WiFiPhyMode_t getPhyMode ();
4848
49+ void setOutputPower (float_t dBm);
50+
4951 void persistent (bool persistent);
5052
5153 bool mode (WiFiMode_t);
You can’t perform that action at this time.
0 commit comments