-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
Add GET WIFISCAN
and base64 WiFi credential commands
#262
Conversation
btw is it necessary for it to be blocking? I have no idea if you can just print it when you get the scan data |
I've tried the non-blocking one during the first commit, but it always returns as failed. There should be somewhere buggy but can't locate them. The blocking scan will timeout server connection but reconnects once finished, and it won't break WiFi connection. Since we only need to scan during provisioning, imo the blocking one would be enough. |
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.
There some stuff that need to be locked at.
char pass[65]; | ||
const char * b64ssid = parser->getCmdParam(2); | ||
const char * b64pass = parser->getCmdParam(3); | ||
base64_decode_chars(b64ssid, strlen_P(b64ssid), ssid); |
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.
Is this conversation length save? so ssid will not be writen longer that it is?
const char * b64ssid = parser->getCmdParam(2); | ||
const char * b64pass = parser->getCmdParam(3); | ||
base64_decode_chars(b64ssid, strlen_P(b64ssid), ssid); | ||
base64_decode_chars(b64pass, strlen_P(b64pass), pass); |
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.
Same here
// Scan would fail if connecting, stop connecting before scan | ||
if (WiFi.status() != WL_CONNECTED) WiFi.disconnect(); | ||
|
||
WiFi.scanNetworks(); |
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.
I did try it on ESP8266:
It did not work for me after a short time after boot, after the line
[INFO ] [WiFiProvisioning] SmartConfig started
it did return everytime:
[INFO ] [SerialCommands] [WSCAN] Scan failed!
i would also love to have this function async, because it will probably mess up some IMUs because they need to fetch data or they may timeout.
This PR add
GET WIFISCAN
command to initiate a blocking scan, retrieving what hotspot could be seen by the trackers during provisioning. Could avoid connecting to a 5G hotspot, misspelling, and might help future fancy provisioning.The result would be printed in the format below:
In addition, since
CmdParser
couldn't deal with double quotes in SSID / Password, a base64 version for serial provisioning is added (SET BWIFI <B64SSID> <B64PASS>
). Everything is the same except encoded in base64 to avoid double quote in the command.Currently blocked by #256