-
Notifications
You must be signed in to change notification settings - Fork 53
Wifi multi network support for esp32/esp8266/PicoW #601
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
Conversation
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.
cleanup autoformatting and retest pico reconnecting between phone then home wifi
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.
Overall this is a very solid feature implementation and I'll test it out on Monday. I've left comments requesting clarity and modifications.
Resolves #376
| return true; | ||
| } | ||
| } // else single network mode | ||
| else if (strcmp(_ssid, WiFi.SSID(i).c_str()) == 0) |
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.
Consider changing this to else to avoid doing an extra call to strcmp and c_str
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.
The normal network ssid doesn't get added to the altNetworks, so this check needs to still happen.
It has just occurred to me that I failed to test one eventuality that the primary ssid could connect when none of the altNetworks were found (which would fail). I always had some alt networks in range.
I should move this to be a separate check, dropping the else, probably above the multi-network/altNetworks check as that will be the less common path.
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.
@brentru this should be good to go now. All feedback resolved except the "unused networks" error message, but left some not marked resolved so you see the explanations.
Let me know what you think
This adds a new field called `alternative_networks' to the network_type_wifi object in the secrets.json settings file.
It's an array of objects (with fields network_ssid and network_password).
There is a maximum size of 3, although larger arrays will be tolerated only the first 3 entries will be used.
Example config:
{ "io_username": "tyeth_demo", "io_key": "my_super_secret_adafruit_io_key", "network_type_wifi": { "network_ssid": "free4all", "network_password": "password", "alternative_networks": [ { "network_ssid": "free4all_2G", "network_password": "password" }, { "network_ssid": "HOTSPOT", "network_password": "password" }, { "network_ssid": "Tenda_60C06C", "network_password": "password" }, { "network_ssid": "THERMAL", "network_password": "password" } ] }, "status_pixel_brightness": 0.2 }