Skip to content

Commit d907363

Browse files
author
Veijo Pesonen
committed
Fix issue where only first digit of a channel number is returned
The AT parser is lazy and considers only the first digit of a channel number as the channel number. This fix forces the parser to read the whole scan AT response.
1 parent 58ecb26 commit d907363

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ESP8266/ESP8266.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,15 @@ void ESP8266::attach(Callback<void()> func)
490490
bool ESP8266::recv_ap(nsapi_wifi_ap_t *ap)
491491
{
492492
int sec;
493-
bool ret = _parser.recv("+CWLAP:(%d,\"%32[^\"]\",%hhd,\"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx\",%hhu", &sec, ap->ssid,
494-
&ap->rssi, &ap->bssid[0], &ap->bssid[1], &ap->bssid[2], &ap->bssid[3], &ap->bssid[4],
495-
&ap->bssid[5], &ap->channel);
493+
int dummy;
494+
bool ret = _parser.recv("+CWLAP:(%d,\"%32[^\"]\",%hhd,\"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx\",%hhu,%d,%d)\n",
495+
&sec,
496+
ap->ssid,
497+
&ap->rssi,
498+
&ap->bssid[0], &ap->bssid[1], &ap->bssid[2], &ap->bssid[3], &ap->bssid[4], &ap->bssid[5],
499+
&ap->channel,
500+
&dummy,
501+
&dummy);
496502

497503
ap->security = sec < 5 ? (nsapi_security_t)sec : NSAPI_SECURITY_UNKNOWN;
498504

0 commit comments

Comments
 (0)