Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/wifi-manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

bool shouldSaveConfig = true;
int connectionAttempts = 0;
const int maxConnectionAttempts = 10;

void restartprocess(){
deleteFileSystem();
Expand All @@ -33,18 +32,21 @@ bool setupWifi(){
return false;
}

while (connectionAttempts < maxConnectionAttempts) {
while (true) { // stay in this loop until wifi connects
if (WiFi.status() == WL_CONNECTED)
break;

//WiFi.mode(WIFI_STA);
WiFi.begin(globalVariables.SSID, globalVariables.APPW);
delay(1000);

Serial.print(F("Connecting to WIFI.. "));
Serial.println(globalVariables.SSID);
Serial.print(F("Connecting to WIFI.. Attempt #"));
Serial.print(connectionAttempts);
Serial.print(F(" SSID: "));
Serial.print(globalVariables.SSID);
Serial.print(F(" APPW: "))
Serial.println(globalVariables.APPW);
delay(8000); // can probably be lower?
delay(10000); // can probably be lower?
connectionAttempts++;
}

Expand All @@ -70,6 +72,10 @@ bool setupWifi(){
WiFi.setTxPower(WIFI_POWER_19_5dBm); // https://github.com/G6EJD/ESP32-8266-Adjust-WiFi-RF-Power-Output/blob/main/README.md
#endif

#ifdef ESP32
WiFi.setTxPower(WIFI_POWER_19_5dBm); // https://github.com/G6EJD/ESP32-8266-Adjust-WiFi-RF-Power-Output/blob/main/README.md
#endif

return true;
}

Expand Down