Skip to content

Commit 33fca6e

Browse files
committed
Fix 8266 WiFi
WiFi for 8266 devices wasn't working. WiFi.reconnect() shouldn't be called every time it checks the connection. I made it so it doesn't restart anymore, but that can be added back in if called for. It now waits 10 seconds for a connection, then calls WiFi.reconnect().
1 parent 6b7134f commit 33fca6e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/fdrs_gateway_wifi.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,16 @@ void begin_wifi()
175175
WiFi.config(hostIpAddress, gatewayAddress, subnetAddress, dns1Address, dns2Address);
176176
#endif
177177
WiFi.begin(ssid, password);
178-
int connectTries = 0;
178+
DBG("Connecting to WiFi SSID: " + String(FDRS_WIFI_SSID));
179+
int connectTries = 0;
179180
while (WiFi.status() != WL_CONNECTED)
180181
{
181182
connectTries++;
182-
DBG("Connecting to WiFi SSID: " + String(FDRS_WIFI_SSID) + " try number " + String(connectTries));
183183
delay(1000);
184-
WiFi.reconnect();
185-
if(connectTries >= 15) {
186-
DBG("Restarting ESP32: WiFi issues\n");
187-
delay(5000);
188-
ESP.restart();
189-
}
184+
if(connectTries >= 10) {
185+
DBG("Couldn't connect! Retrying...");
186+
WiFi.reconnect();
187+
}
190188
}
191189
#endif // USE_ETHERNET
192190
}

0 commit comments

Comments
 (0)