From 777e042ab53821b1240466af1e92eceb14c0fdf1 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 1 May 2018 16:37:08 +1000 Subject: [PATCH] esp32/modnetwork: Allow to get ESSID of AP that STA is connected to. Following the same addition to esp8266 port. --- ports/esp32/modnetwork.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ports/esp32/modnetwork.c b/ports/esp32/modnetwork.c index ef5292be3c..f299ec2f03 100644 --- a/ports/esp32/modnetwork.c +++ b/ports/esp32/modnetwork.c @@ -509,8 +509,11 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs return mp_obj_new_bytes(mac, sizeof(mac)); } case QS(MP_QSTR_essid): - req_if = WIFI_IF_AP; - val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len); + if (self->if_id == WIFI_IF_STA) { + val = mp_obj_new_str((char*)cfg.sta.ssid, strlen((char*)cfg.sta.ssid)); + } else { + val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len); + } break; case QS(MP_QSTR_hidden): req_if = WIFI_IF_AP;