Skip to content

Commit 4189a3c

Browse files
author
Veijo Pesonen
authored
Merge pull request #67 from ARMmbed/fix_scan_channel
Fix channel numbers detected during wifi scan
2 parents 58ecb26 + 9c5dd4b commit 4189a3c

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
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

ESP8266Interface.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ bool ESP8266Interface::_get_firmware_ok()
244244
if (_esp.get_firmware_version() != ESP8266_VERSION) {
245245
debug("ESP8266: ERROR: Firmware incompatible with this driver.\
246246
\r\nUpdate to v%d - https://developer.mbed.org/teams/ESP8266/wiki/Firmware-Update\r\n",ESP8266_VERSION);
247-
return NSAPI_ERROR_DEVICE_ERROR;
247+
return false;
248248
}
249249

250-
return NSAPI_ERROR_OK;
250+
return true;
251251
}
252252

253253
bool ESP8266Interface::_disable_default_softap()
@@ -274,7 +274,7 @@ nsapi_error_t ESP8266Interface::_init(void)
274274
if (!_esp.reset()) {
275275
return NSAPI_ERROR_DEVICE_ERROR;
276276
}
277-
if (_get_firmware_ok() != NSAPI_ERROR_OK) {
277+
if (!_get_firmware_ok()) {
278278
return NSAPI_ERROR_DEVICE_ERROR;
279279
}
280280
if (_disable_default_softap() == false) {

0 commit comments

Comments
 (0)