Commit 822e9ca8 authored by Mark's avatar Mark Committed by Paul Sokolovsky
Browse files

esp8266/modnetwork: Use struct bss_info::ssid_len for ESSID length.

Instead of calling strlen(), which won't work if there're 32 chars in
returned ESSID. struct bss_info::ssid_len is not documented in SDK API
Guide, but is present in SDK headers since 1.4.0. Just in case, previous
code is left commented.
parent a1a261d8
......@@ -142,7 +142,13 @@ STATIC void esp_scan_cb(scaninfo *si, STATUS status) {
struct bss_info *bs;
STAILQ_FOREACH(bs, si->pbss, next) {
mp_obj_tuple_t *t = mp_obj_new_tuple(6, NULL);
#if 1
// struct bss_info::ssid_len is not documented in SDK API Guide,
// but is present in SDK headers since 1.4.0
t->items[0] = mp_obj_new_bytes(bs->ssid, bs->ssid_len);
#else
t->items[0] = mp_obj_new_bytes(bs->ssid, strlen((char*)bs->ssid));
#endif
t->items[1] = mp_obj_new_bytes(bs->bssid, sizeof(bs->bssid));
t->items[2] = MP_OBJ_NEW_SMALL_INT(bs->channel);
t->items[3] = MP_OBJ_NEW_SMALL_INT(bs->rssi);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment