Page 1 of 1

WiFi factory reset - how to?

Posted: Fri Oct 13, 2023 9:58 am
by cskilbeck
Is the following code a reasonable way to factory reset the wifi credentials?

Code: Untitled.c Select all

void wifi_factory_reset()
{
wifi_config_t blank_config;
memset(&blank_config, 0, sizeof(blank_config));

ESP_ERROR_CHECK(esp_wifi_disconnect());
ESP_ERROR_CHECK(esp_wifi_stop());
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &blank_config));
ESP_ERROR_CHECK(esp_wifi_start());
}

Re: WiFi factory reset - how to?

Posted: Sat Oct 14, 2023 1:08 am
by Sprite
Probably better to just stop WiFi and then nuke the WiFi NVS partition.