-
Notifications
You must be signed in to change notification settings - Fork 57
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
Wifi reconnect takes too long #125
Comments
I also observed this. |
I think you are right. Then you get the first part I described (WiFiStatus stays WIFI_CONNECT_ONGOING). It will reconnect in at most 10 sec. |
I have an idea why the reconnect might take that long. |
No, it takes that long because setupWifi() is only called in certain situation, as I described. |
Please replace row 397 of MHI-AC-Ctrl.ino |
This indeed fixes both problems. Please also see my last comment on my pull request after it was closed. |
fix implemented in v2.6 release |
I was testing what is happening when my wifi is failing. I know the AC will switch off after 120 seconds.
But I saw some strange behavior when blocking and unblocking my Wifi. I (un)block the esp in my AP to test this.
I also added some extra debug to show the behavior. The esp was not connected to the airco to make testing easier (removed logging mhi_ac_ctrl_core.loop error). ESP with airco connected has the same behavior.
I observed:
variable WiFiStatus
When I restart the ESP, variable WiFiStatus stays WIFI_CONNECT_ONGOING until first WiFI_SEARCH_FOR_STRONGER_AP_INTERVALL has passed (default 12 minutes) and WiFI_SEARCHStrongestAP = true. This is because it won't call setupWiFi until that moment.
This will influence reconnecting when I block and unblock the Wifi. When I Block my Wifi and for example after 2 sec I unblock my Wifi, it won't reconnect immediately (because of "if(WiFiStatus != WIFI_CONNECT_ONGOING").
It will reconnect after the next WiFiStatus = WIFI_CONNECT_TIMEOUT occurred. At most 10 seconds later.
See log: WifiStatus.txt
I don't know if this is intended behavior.
Reconnect Wifi
When the WiFiStatus = WIFI_CONNECT_OK (after the first WiFI_SEARCH_FOR_STRONGER_AP_INTERVALL has passed), I blocked the Wifi. Then I got a lot of MQTTreconnect() messages. When I unblock my Wifi, It takes until WiFI_SEARCH_FOR_STRONGER_AP_INTERVALL (12 min) has passed before setupWiFi() is called again. Then it will reconnect.
So this will take at most 12 min.
See log: WIFI_CONNECT_OK .txt
I changed WiFI_SEARCH_FOR_STRONGER_AP_INTERVALL to 2 minutes for testing. So in the log you will see faster reconnect.
I don't think this was intended behavior. It should reconnect right away when possible.
The text was updated successfully, but these errors were encountered: