Skip to content

Commit

Permalink
Fix for #2922
Browse files Browse the repository at this point in the history
  • Loading branch information
blazoncek committed Dec 23, 2023
1 parent 39e0a1f commit 5f62b4a
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 164 deletions.
4 changes: 2 additions & 2 deletions wled00/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,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")];

Expand Down Expand Up @@ -682,7 +682,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");
Expand Down
1 change: 1 addition & 0 deletions wled00/data/settings_wifi.htm
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ <h3>Configure Access Point</h3>
<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>
Expand Down
324 changes: 163 additions & 161 deletions wled00/html_settings.h

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions wled00/set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,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) {
Expand Down
1 change: 1 addition & 0 deletions wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,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
Expand Down
1 change: 1 addition & 0 deletions wled00/xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ void getSettingsJS(byte subPage, char* dest)
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
Expand Down

0 comments on commit 5f62b4a

Please sign in to comment.