esp8266/network_wlan: Make WLAN.config(channel=x) use wifi_set_channel.

Also permits channel option to be used for STA_IF interface.  This
provides compatibility with esp32 code, especially for espnow users.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
This commit is contained in:
Glenn Moloney 2023-06-26 18:05:37 +10:00 committed by Damien George
parent 4bed77cc23
commit b1e6c2b655

View file

@ -565,8 +565,8 @@ static mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
break; break;
} }
case MP_QSTR_channel: { case MP_QSTR_channel: {
req_if = SOFTAP_IF;
cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value); cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value);
error_check(wifi_set_channel(cfg.ap.channel), "can't set channel");
break; break;
} }
case MP_QSTR_hostname: case MP_QSTR_hostname: