How to restart wifi after stopping it?
Posted: Mon Sep 09, 2019 4:49 am
I want to switch from AP mode to STA mode (i.e. from access point to client). I tried to stop wifi, reconfigure and restart. But the client is never connected, and no errors are reported either.
So as an intermediate step, I tried to stop and restart without any change of configuration. Same result: Wifi goes away and never comes back.
So what is the proper procedure for restarting wifi, and finally, for restarting it with a different configuration?
So as an intermediate step, I tried to stop and restart without any change of configuration. Same result: Wifi goes away and never comes back.
Code: Select all
ESP_ERROR_CHECK(esp_wifi_stop()); // triggers SYSTEM_EVENT_AP_STOP event
vTaskDelay(configTICK_RATE_HZ * 10); // 10s delay
ESP_ERROR_CHECK(esp_wifi_start()); // does nothing?
So what is the proper procedure for restarting wifi, and finally, for restarting it with a different configuration?