This commit is contained in:
Blaz Kristan
2023-12-23 20:58:55 +01:00
committed by Frank
parent 4bbf1ba584
commit 738df1847a
6 changed files with 7 additions and 3 deletions

View File

@@ -83,7 +83,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
noWifiSleep = doc[F("wifi")][F("sleep")] | !noWifiSleep; // inverted
noWifiSleep = !noWifiSleep;
//int wifi_phy = doc[F("wifi")][F("phy")]; //force phy mode n?
force802_3g = doc[F("wifi")][F("phy")] | force802_3g; //force phy mode g?
JsonObject hw = doc[F("hw")];
@@ -735,7 +735,7 @@ void serializeConfig() {
JsonObject wifi = doc.createNestedObject("wifi");
wifi[F("sleep")] = !noWifiSleep;
//wifi[F("phy")] = 1;
wifi[F("phy")] = (int)force802_3g;
#ifdef WLED_USE_ETHERNET
JsonObject ethernet = doc.createNestedObject("eth");

View File

@@ -178,6 +178,7 @@
<option value="3">Never (not recommended)</option></select><br>
AP IP: <span class="sip"> Not active </span><br>
<h3>Experimental</h3>
Force 802.11g mode (ESP8266 only): <input type="checkbox" name="FG"><br>
Disable WiFi sleep: <input type="checkbox" name="WS"><br>
<i>Can help with connectivity issues.<br>
Do not enable if WiFi is working correctly, increases power consumption.</i>

View File

@@ -46,6 +46,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
if (passlen == 0 || (passlen > 7 && !isAsterisksOnly(request->arg(F("AP")).c_str(), 65))) strlcpy(apPass, request->arg(F("AP")).c_str(), 65);
int t = request->arg(F("AC")).toInt(); if (t > 0 && t < 14) apChannel = t;
force802_3g = request->hasArg(F("FG"));
noWifiSleep = request->hasArg(F("WS"));
#ifndef WLED_DISABLE_ESPNOW

View File

@@ -1027,7 +1027,7 @@ void WLED::initConnection()
WiFi.disconnect(true); // close old connections
#ifdef ESP8266
WiFi.setPhyMode(WIFI_PHY_MODE_11N);
WiFi.setPhyMode(force802_3g ? WIFI_PHY_MODE_11G : WIFI_PHY_MODE_11N);
#endif
if (staticIP[0] != 0 && staticGateway[0] != 0) {

View File

@@ -342,6 +342,7 @@ WLED_GLOBAL bool noWifiSleep _INIT(true); // disabling
#else
WLED_GLOBAL bool noWifiSleep _INIT(false);
#endif
WLED_GLOBAL bool force802_3g _INIT(false);
#ifdef WLED_USE_ETHERNET
#ifdef WLED_ETH_DEFAULT // default ethernet board type if specified

View File

@@ -343,6 +343,7 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W
sappends('s',SET_F("AP"),fapass);
sappend('v',SET_F("AC"),apChannel);
sappend('c',SET_F("FG"),force802_3g);
sappend('c',SET_F("WS"),noWifiSleep);
#ifndef WLED_DISABLE_ESPNOW