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

Portal restart if desired WiFi network reappears #42

Open
mitra42 opened this issue Nov 18, 2024 · 0 comments
Open

Portal restart if desired WiFi network reappears #42

mitra42 opened this issue Nov 18, 2024 · 0 comments

Comments

@mitra42
Copy link
Contributor

mitra42 commented Nov 18, 2024

Hi Juerd,

I'm trying to deal with what I think could be two common situations.
1: WiFi goes down temporarily
2: Temporary Power cut (very common especially in developing countries) - and WiFi comes back up slower than a device.

In both cases, my concern is unattended devices that with a basic use of WiFiSettings would enter the portal state and get stuck there.

My first attempt to fix this was a simple timeout watchdog, this worked but was annoying if the user is interacting with portal at the time.

I've now got a version that if there is a configured Wifi (i.e. its read a SSID from the SPIFFS/LittleFS) will - after a configurable period (I'm using 2 minutes) - rescan and if it detects the missing WiFi try a restart.

Thanks to all the callbacks I've got it working without changing the library, and am happy to continue using it this way, but I'm thinking it would be a useful addition. I'm not sure what is the best way to integrate it.

My code is at https://github.com/mitra42/frugal-iot/blob/main/system_wifi.cpp#L68 and its stored into WiFiSettings.onPortalWaitLoop at Line 130 based on WiFiSettings.onFailure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant