Page 1 of 1

Besides channel, what else should be re-configured after stop-start wifi?

Posted: Sun Sep 25, 2022 6:51 pm
by wuyuanyi
I called `esp_wifi_stop` before invoking `esp_light_sleep_start` and called `esp_wifi_start` after woken up. However, I received a weird `ESP_ERR_ESPNOW_ARG` for my espnow code.

The problem raised because I used the WiFi channel other than `1`. After calling `esp_wifi_stop` then `esp_light_sleep_start`, the channel is not preserved (restored to channel 1) regardless of whether entering sleep mode or not in between.

After using the channel 1, or calling `esp_wifi_set_channel` after woken up and `esp_wifi_start`, the error was gone.

Because stopping & starting WiFI is very useful for the application involving light-sleep, I think the documentation or example should clarify what need to be re-configured after stop-start WiFi, besides channel.

Much appreciated if anyone could provide me with some insights about what should be re-configured when the interface is restarted!