ports/esp8266: Add auto_connect & reconnects options to WLAN.config(). #9460
+18
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for:
WLAN.config(auto_connect=True/False)
); andWLAN.config(reconnects=xx)
).Motivation
The auto-connect feature is regarded by some as a mis-feature of the esp8266 and is one source of incompatible behaviour for code running on esp32 and esp8266. The
auto_connect=False
option allows users to ensure their esp8266 device's behaviour is deterministically derived from startup code. Thereconnects
option provides similar (but not the same) functionality to thereconnects
opton on ESP32.The semantics of the
reconnects
option differ from the esp32 in important ways:Note:
WLAN.config("reconnects")
is not supported since the esp8266 SDK provide no mechanism for querying the current settings.This PR adds:
WLAN.config(auto_connect=True/False)
to enable/disable the ESP8266 from automatically connecting to wifi networks after WLAN.active(True).WLAN.config(reconnects=xx)
wherexx
is an integer to limit the number of times to attempt to reconnect after becoming disconnected from a wifi access point.