esp8266/network_wlan: Make WLAN.config('channel') use wifi_get_channel.

Prior to this fix, `WLAN.config('channel')` would return an incorrect
channel for AP_IF if STA has connected to an external AP running on a
different channel.

The esp8266 now has the same behaviour as for esp32 per commit
98d1c50159.

Fixes issue #11463.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
This commit is contained in:
Glenn Moloney 2023-05-19 17:51:52 +10:00 committed by Damien George
parent 3699cf5f38
commit 4bed77cc23

View file

@ -641,8 +641,7 @@ static mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.authmode);
break;
case MP_QSTR_channel:
req_if = SOFTAP_IF;
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
val = MP_OBJ_NEW_SMALL_INT(wifi_get_channel());
break;
case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: {