-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Improves WiFiMulti #9139
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
Improves WiFiMulti #9139
Conversation
👋 Hello SuGlider, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
libraries/WiFi/examples/WiFiMultiAdvanced/WiFiMultiAdvanced.ino
Outdated
Show resolved
Hide resolved
Except the example, LGTM too |
// fail SSID too long or missing! | ||
log_e("[WIFI][APlistAdd] no ssid or ssid too long"); | ||
return false; | ||
} | ||
|
||
if(passphrase && strlen(passphrase) > 64) { | ||
if(passphrase && strlen(passphrase) > 63) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👁️🗨️
Description of Change
This PR is based on PR #2775 from @Daemach, with some changes.
WiFiMulti has now new methods that improves its ways to connect to a WiFi AP.
It adds a new example to the ESP32 Core called
WiFiMultiAdvanced.ino
.An important improvement is that the WiFiMulti
run()
will mark the failed WiFi APs in order to do not include them in the nextrun()
execution. This avoids that it fails all the time in the very same AP with the highest RSSI. After failing with all possible APs of the list, it will reset the "failed marks" and try again from fresh.New APIs:
void setStrictMode(bool bStrict)
Default is
true
: It forces to only keep connected or to connect to an AP from the provided WiFiMulti list.When bStrict is
false
, it will keep the last/current connected AP even if not in the WiFiMulti List.void setAllowOpenAP(bool bAllowOpenAP)
Default is
false
: doesn't add open AP networks to the WiFiMulti list.When bAllowOpenAP is
true
, it will add ANY scanned open open AP to the WiFiMulti list, even if not in the initial user listvoid APlistClean(void)
Clears the current list of Multi APs and frees the memory
void setConnectionTestCallbackFunc(ConnectionTestCB_t cbFunc)
Default is NULL - no validation callback function
It allows the user to define a callback function [
bool cb_func(void)
] that will validate the connection to the Internet.If the callback returns true, the connection is considered valid and the AP will added to the validated AP list.
Set the callback to NULL to disable the feature and validate any SSID that is in the list.
Tests scenarios
Using 3 APs, 1 Open AP.
Used the new
WiFiMultiAdvanced.ino
example to test many combinations in Verbose Mode.Related links
Closes #2775