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

Without autoreconnect, forcibly stop station connection manager #8607

Merged
merged 2 commits into from
Jun 26, 2022

Conversation

mcspr
Copy link
Collaborator

@mcspr mcspr commented Jun 17, 2022

fix #7432

Sketches are most likely to use WiFi.status(), which in turn uses wifi_station_get_connect_status() return value to determine current STA status.
SDK does not seem to track the event when autoreconnect is disabled and does not even change from STATION_GOT_IP, so we force it into some other state

Looking at RTOS SDK, it does not have autoreconnect like the NONOS does. Instead, it is expected to handle 'DISCONNECTED' event, where wifi_station_connect(); is called to restart the connection cycle. Which also could be used to update some internal 'status' variable... Seems like a lot of changes, though, and does not really fit well with the class approach we have currently.

Sketches will most likely use `WiFi.status()`, which uses its status
Since the SDK itself does not track the event when autoreconnect is disabled,
force it into some other state
@d-a-v d-a-v added the alpha included in alpha release label Jun 23, 2022
@d-a-v d-a-v added this to the 3.1 milestone Jun 23, 2022
@d-a-v
Copy link
Collaborator

d-a-v commented Jun 23, 2022

When this event is received while reconnect policy is not set, does it change the connection status after the event ? (right after - or a short while after the event)

When the reconnect policy is set, and when ssid has vanished, same question: does status eventually change from "got ip" ?

(/me should try it, maybe @TD-er could too)

@mcspr
Copy link
Collaborator Author

mcspr commented Jun 23, 2022

When this event is received while reconnect policy is not set, does it change the connection status after the event ? (right after - or a short while after the event)

Change is immediate and any user event handler (loop down below) will see status() as disconnected

When the reconnect policy is set, and when ssid has vanished, same question: does status eventually change from "got ip" ?

It does. SDK default is auto-reconnect, it will attempt a new connection when disconnected from AP. afaik it will attempt connections indefinitely, unless disconnect() is called from our side.

@TD-er
Copy link
Contributor

TD-er commented Jun 23, 2022

This is what I also do in ESPEasy, I explicitly call the disconnect before attempting to reconnect.
But I wonder whether this fix/work-around will work with static IP configurations as this does not (or has that changed?) send the got-IP event with static IP config.

@mcspr
Copy link
Collaborator Author

mcspr commented Jun 23, 2022

But I wonder whether this fix/work-around will work with static IP configurations as this does not (or has that changed?) send the got-IP event with static IP config.

No difference. You mean got-IP status from the connection manager? It is set right after assoc happens. Disconnect is handled the same way.

@mcspr mcspr merged commit 0bff52f into esp8266:master Jun 26, 2022
@mcspr mcspr deleted the wifi/handle-no-autoreconnect branch June 26, 2022 23:21
hasenradball pushed a commit to hasenradball/Arduino that referenced this pull request Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha included in alpha release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WiFi.status() is not reflecting the true state
3 participants