Allow PSK instead of passphrase in WiFiSTA::begin (#897)
This commit is contained in:
parent
7d2bffb0e8
commit
79e5d4c40d
@ -110,7 +110,7 @@ wl_status_t WiFiSTAClass::begin(const char* ssid, const char *passphrase, int32_
|
|||||||
return WL_CONNECT_FAILED;
|
return WL_CONNECT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(passphrase && strlen(passphrase) > 63) {
|
if(passphrase && strlen(passphrase) > 64) {
|
||||||
// fail passphrase too long!
|
// fail passphrase too long!
|
||||||
return WL_CONNECT_FAILED;
|
return WL_CONNECT_FAILED;
|
||||||
}
|
}
|
||||||
@ -119,6 +119,9 @@ wl_status_t WiFiSTAClass::begin(const char* ssid, const char *passphrase, int32_
|
|||||||
strcpy(reinterpret_cast<char*>(conf.sta.ssid), ssid);
|
strcpy(reinterpret_cast<char*>(conf.sta.ssid), ssid);
|
||||||
|
|
||||||
if(passphrase) {
|
if(passphrase) {
|
||||||
|
if (strlen(passphrase) == 64) // it's not a passphrase, is the PSK
|
||||||
|
memcpy(reinterpret_cast<char*>(conf.sta.password), passphrase, 64);
|
||||||
|
else
|
||||||
strcpy(reinterpret_cast<char*>(conf.sta.password), passphrase);
|
strcpy(reinterpret_cast<char*>(conf.sta.password), passphrase);
|
||||||
} else {
|
} else {
|
||||||
*conf.sta.password = 0;
|
*conf.sta.password = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user