Skip to content

Commit bed14e6

Browse files
committed
seTxPower() bugfix
- too early init
1 parent f5e1ef7 commit bed14e6

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

wled00/cfg.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
163163
#ifdef ARDUINO_ARCH_ESP32
164164
WiFi.setSleep(!noWifiSleep);
165165
WiFi.setHostname(hostName);
166-
WiFi.setTxPower(wifi_power_t(txPower));
167166
#else
168167
WiFi.setPhyMode(force802_3g ? WIFI_PHY_MODE_11G : WIFI_PHY_MODE_11N);
169168
wifi_set_sleep_type((noWifiSleep) ? NONE_SLEEP_T : MODEM_SLEEP_T);

wled00/set.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
9292
#ifdef ARDUINO_ARCH_ESP32
9393
int tx = request->arg(F("TX")).toInt();
9494
txPower = min(max(tx, (int)WIFI_POWER_2dBm), (int)WIFI_POWER_19_5dBm);
95+
WiFi.setTxPower(wifi_power_t(txPower)); // must set when WiFi is already started
9596
#endif
9697

9798
force802_3g = request->hasArg(F("FG"));

wled00/wled.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,9 @@ void WLED::setup()
477477
showWelcomePage = true;
478478
WiFi.mode(WIFI_MODE_AP); // WiFi is not configured so we'll most likely open an AP
479479
}
480+
#ifdef ARDUINO_ARCH_ESP32
481+
WiFi.setTxPower(wifi_power_t(txPower)); // must set when WiFi is already started
482+
#endif
480483

481484
// all GPIOs are allocated at this point
482485
serialCanRX = !PinManager::isPinAllocated(hardwareRX); // Serial RX pin (GPIO 3 on ESP32 and ESP8266)
@@ -660,10 +663,6 @@ void WLED::initAP(bool resetAP)
660663
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
661664
dnsServer.start(53, "*", WiFi.softAPIP());
662665

663-
#ifdef ARDUINO_ARCH_ESP32
664-
WiFi.setTxPower(wifi_power_t(txPower));
665-
#endif
666-
667666
#ifndef WLED_DISABLE_ESPNOW
668667
initESPNow();
669668
#endif

0 commit comments

Comments
 (0)