This commit is contained in:
richonguzman
2023-06-09 01:12:13 -04:00
parent 56c0010a3b
commit 324939fc72
9 changed files with 108 additions and 19 deletions

View File

@@ -8,9 +8,20 @@ extern WiFi_AP *currentWiFi;
extern int myWiFiAPIndex;
extern int myWiFiAPSize;
extern int stationMode;
extern uint32_t previousWiFiMillis;
namespace WIFI_Utils {
void checkWiFi() {
if ((WiFi.status() != WL_CONNECTED) && ((millis() - previousWiFiMillis) >= 30*1000)) {
Serial.print(millis());
Serial.println("Reconnecting to WiFi...");
WiFi.disconnect();
WiFi.reconnect();
previousWiFiMillis = millis();
}
}
void startWiFi() {
int status = WL_IDLE_STATUS;
WiFi.mode(WIFI_STA);