diff --git a/lib/framework/APSettingsService.cpp b/lib/framework/APSettingsService.cpp index 07eb04bf9..4c3c7994d 100644 --- a/lib/framework/APSettingsService.cpp +++ b/lib/framework/APSettingsService.cpp @@ -49,7 +49,7 @@ void APSettingsService::startAP() { WiFi.softAPConfig(_state.localIP, _state.gatewayIP, _state.subnetMask); esp_wifi_set_bandwidth((wifi_interface_t)ESP_IF_WIFI_AP, WIFI_BW_HT20); WiFi.softAP(_state.ssid.c_str(), _state.password.c_str(), _state.channel, _state.ssidHidden, _state.maxClients); -#ifdef BOARD_C3_MINI_V1 +#if CONFIG_IDF_TARGET_ESP32C3 WiFi.setTxPower(WIFI_POWER_8_5dBm); // https://www.wemos.cc/en/latest/c3/c3_mini_1_0_0.html#about-wifi #endif if (!_dnsServer) { diff --git a/lib/framework/NetworkSettingsService.cpp b/lib/framework/NetworkSettingsService.cpp index 415c20455..91b0ee00b 100644 --- a/lib/framework/NetworkSettingsService.cpp +++ b/lib/framework/NetworkSettingsService.cpp @@ -68,14 +68,14 @@ void NetworkSettingsService::manageSTA() { } else { esp_wifi_set_bandwidth((wifi_interface_t)ESP_IF_WIFI_STA, WIFI_BW_HT40); } - esp_wifi_set_max_tx_power(networkSettings.tx_power * 4); if (networkSettings.nosleep) { WiFi.setSleep(false); // turn off sleep - WIFI_PS_NONE } + WiFi.begin(_state.ssid.c_str(), _state.password.c_str()); // attempt to connect to the network + esp_wifi_set_max_tx_power(networkSettings.tx_power * 4); // set power after wifi is startet for C3 }); - - WiFi.begin(_state.ssid.c_str(), _state.password.c_str()); // attempt to connect to the network #ifdef BOARD_C3_MINI_V1 + // not sure if we need this special value for c3_min_v1.0 WiFi.setTxPower(WIFI_POWER_8_5dBm); // https://www.wemos.cc/en/latest/c3/c3_mini_1_0_0.html#about-wifi #endif }