serkri / SmartEVSE-3

Smart Electric Vehicle Charging Station (EVSE)
MIT License
75 stars 26 forks source link

evse.cpp: fixing reconnect after wifi disconnect #32

Closed dingo35 closed 2 years ago

dingo35 commented 2 years ago

This fix makes the SmartEVSE wifi reconnect withing 15-20 seconds after disconnecting, even after a "strange" disconnect (e.g. temporary signal loss). EDIT: removed my remark on clean disconnects.

deqw commented 2 years ago

A "clean" wifi-disconnect was never a problem (e.g. when rebooting your router), that is probably why this problem was only bothering people with bad wifi - signals ...

Your assumption is not correct.

koen-serneels commented 2 years ago

If we can get a verification that this indeed makes it reconnect after a strange disconnect, then we can merge this PR as it seems to be the cleanest imho. Some questions though

dingo35 commented 2 years ago

As I understand, set AutoReconnect does only work with MultiWiFi, where in the ConfigPortal you have to specify a fallback AP.

Perhaps it would work if you would specify your primary AP as a fallback also, but even if that would work:

  1. It would only reconnect after a disconnect, not prevent one
  2. We would have to make sure all users specify their APs twice in the configportal; people who would not read the manual would ask questions in the forum etc.

The docs don't specify this explicitly, but all the examples I find with AutoReconnect are with MultiWiFi calls; the docs are not very clear anyway, e.g. the fact that you only set AutoReconnect after a disconnect doesn't make much sense to me... (see the link I added as a comment in the code).

EDIT: By the way the library you are referring to is NOT the one we are using! We are using https://github.com/khoih-prog/ESPAsync_WiFiManager (note the underscore!!!).

Koen Serneels @.***> schreef op 4 juli 2022 08:35:44 CEST:

If we can get a verification that this indeed makes it reconnect after a strange disconnect, then we can merge this PR as it seems to be the cleanest imho. Some questions though

Unless we fully understand, isn't it better to leave the setAutoReconnect in place as well? That's what the manual says, so maybe it still covers other situations

Is it possible for someone facing these issues (I don't have any) to add a short addition here https://github.com/alanswx/ESPAsyncWiFiManager/issues/92 with the circumstances in which it happens etc and that the setAutoReconnect does not work oposed to the reconnect? I'm curious to their response, because it would be better fixed in the library than using these workarounds

-- Reply to this email directly or view it on GitHub: https://github.com/serkri/SmartEVSE-3/pull/32#issuecomment-1173409442 You are receiving this because you authored the thread.

Message ID: @.***>

koen-serneels commented 2 years ago

As I understand, set AutoReconnect does only work with MultiWiFi

Ok, fair enough

EDIT: By the way the library you are referring to is NOT the one we are using! We are using https://github.com/khoih-prog/ESPAsync_WiFiManager (note the underscore!!!)

I followed the link in your code comment with this PR: image

Why are you refering to this library then for?

dingo35 commented 2 years ago

Ha ha you are right; my point is not to add comments to that thread since we don't use that library; the comments they make are still relevant for us:

"WiFi (or ESP8266WiFi) base library is where re-connection is handled."

AFAIK the libraries just add some luxury stuff (like the ConfigPortal)...

Koen Serneels @.***> schreef op 4 juli 2022 10:05:45 CEST:

EDIT: By the way the library you are referring to is NOT the one we are using! We are using https://github.com/khoih-prog/ESPAsync_WiFiManager (note the underscore!!!)

I followed the link in your code comment with this PR (https://github.com/alanswx/ESPAsyncWiFiManager/issues/92)

-- Reply to this email directly or view it on GitHub: https://github.com/serkri/SmartEVSE-3/pull/32#issuecomment-1173489141 You are receiving this because you authored the thread.

Message ID: @.***>