Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix never entering offline mode #377

Merged
merged 1 commit into from
Oct 1, 2023
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
15 changes: 8 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,11 @@ void checkWifi() {
} while (!setupDone && wifiReconnects < maxWifiReconnects && WiFi.status() != WL_CONNECTED);


if (wifiReconnects >= maxWifiReconnects && !setupDone) { // no wifi connection after boot, initiate offline mode
// (only directly after boot)
if (wifiReconnects >= maxWifiReconnects && WiFi.status() != WL_CONNECTED) {
// no wifi connection after trying connection, initiate offline mode
initOfflineMode();
} else {
wifiReconnects = 0;
}
}

Expand Down Expand Up @@ -1426,19 +1428,18 @@ void debugVerboseOutput() {
*/
void wiFiSetup() {
wm.setCleanConnect(true);
wm.setConfigPortalTimeout(60); // sec Timeout for Portal
wm.setConnectTimeout(10); // Try 10 sec to connect to WLAN, 5 sec too short!
wm.setConfigPortalTimeout(60); // sec timeout for captive portal
wm.setConnectTimeout(10); // using 10s to connect to WLAN, 5s is sometimes too short!
wm.setBreakAfterConfig(true);
wm.setConnectRetries(3);

// Wifisetup fro
sysParaWifiCredentialsSaved.getStorage();

if (wifiCredentialsSaved == 0) {
const char hostname[] = (STR(HOSTNAME));
debugPrintf("Connect to WiFi: %s \n", String(hostname));
debugPrintf("Connecting to WiFi: %s \n", String(hostname));
#if OLED_DISPLAY != 0
displayLogo("Connect to WiFi: ", HOSTNAME);
displayLogo("Connecting to: ", HOSTNAME);
#endif
}

Expand Down