Attempt to fix slow wifi connection caused by #7602

Attempt to fix slow wifi connection caused by #7602
This commit is contained in:
Theo Arends 2020-02-13 12:46:06 +01:00
parent 48c02960d4
commit 51211dfd55
1 changed files with 24 additions and 0 deletions

View File

@ -429,6 +429,10 @@ void WifiCheckIp(void)
WifiSetState(1); WifiSetState(1);
Wifi.counter = WIFI_CHECK_SEC; Wifi.counter = WIFI_CHECK_SEC;
Wifi.retry = Wifi.retry_init; Wifi.retry = Wifi.retry_init;
if (Wifi.status != WL_CONNECTED) {
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECTED));
}
Wifi.status = WL_CONNECTED;
#ifdef USE_DISCOVERY #ifdef USE_DISCOVERY
#ifdef WEBSERVER_ADVERTISE #ifdef WEBSERVER_ADVERTISE
if (2 == Wifi.mdns_begun) { if (2 == Wifi.mdns_begun) {
@ -450,9 +454,29 @@ void WifiCheckIp(void)
break; break;
case WL_NO_SSID_AVAIL: case WL_NO_SSID_AVAIL:
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_AP_NOT_REACHED)); AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_AP_NOT_REACHED));
if (WIFI_WAIT == Settings.sta_config) {
Wifi.retry = Wifi.retry_init;
} else {
if (Wifi.retry > (Wifi.retry_init / 2)) {
Wifi.retry = Wifi.retry_init / 2;
}
else if (Wifi.retry) {
Wifi.retry = 0;
}
}
break; break;
case WL_CONNECT_FAILED: case WL_CONNECT_FAILED:
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_WRONG_PASSWORD)); AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_WRONG_PASSWORD));
if (Wifi.retry > (Wifi.retry_init / 2)) {
Wifi.retry = Wifi.retry_init / 2;
}
else if (Wifi.retry) {
Wifi.retry = 0;
}
break; break;
default: // WL_IDLE_STATUS and WL_DISCONNECTED default: // WL_IDLE_STATUS and WL_DISCONNECTED
// log on the 1/2 or full interval // log on the 1/2 or full interval