Skip to content

Commit b42ac38

Browse files
authored
Merge pull request #8 from davirxavier/feature/crypt
wifi reconnection fix
2 parents df58781 + 837bb64 commit b42ac38

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

include/esp-config-page-wireless.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace ESP_CONFIG_PAGE
1212
IPAddress apIp = IPAddress(192, 168, 1, 1);
1313
String dnsName = "esp-config.local";
1414
int lastConnectionError = -1;
15+
unsigned long connectionRetryCounter;
1516
unsigned long connectionTimeoutCounter;
1617
unsigned long connectionTimeoutMs = 45000;
1718

@@ -224,6 +225,7 @@ namespace ESP_CONFIG_PAGE
224225
addServerHandler((char*) F("/config/wifi"), HTTP_POST, wifiSet);
225226
connectionTimeoutCounter = millis() - connectionTimeoutMs;
226227
WiFi.setAutoReconnect(true);
228+
WiFi.mode(WIFI_STA);
227229
}
228230

229231
inline void wirelessLoop()
@@ -252,6 +254,13 @@ namespace ESP_CONFIG_PAGE
252254
LOGN("Disabling AP");
253255
WiFi.mode(WIFI_STA);
254256
}
257+
258+
if (status != WL_CONNECTED && millis() - connectionRetryCounter > 3000)
259+
{
260+
LOGN("Trying to reconnect...");
261+
WiFi.reconnect();
262+
connectionRetryCounter = millis();
263+
}
255264
}
256265
}
257266
#endif //ESP_CONFIG_PAGE_WIRELESS_H

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "esp-config-page",
3-
"version": "1.4.4",
3+
"version": "1.4.5",
44
"keywords": "wifi,wi-fi,esp,esp8266,esp32,espressif8266,espressif32,nodemcu,wemos,arduino",
55
"description": "Dynamic and modular configuration webpage for ESP8266 and ESP32 boards using the arduino framework. Features automatic wi-fi setup, OTA updates, web triggered actions, environment variables configuration, logging monitoring and more.",
66
"frameworks": "arduino",

0 commit comments

Comments
 (0)