WiFi factory reset - how to?

cskilbeck
Posts: 11
Joined: Tue Dec 10, 2019 10:40 pm

WiFi factory reset - how to?

Postby cskilbeck » Fri Oct 13, 2023 9:58 am

Is the following code a reasonable way to factory reset the wifi credentials?
  1. void wifi_factory_reset()
  2. {
  3.     wifi_config_t blank_config;
  4.     memset(&blank_config, 0, sizeof(blank_config));
  5.  
  6.     ESP_ERROR_CHECK(esp_wifi_disconnect());
  7.     ESP_ERROR_CHECK(esp_wifi_stop());
  8.     ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &blank_config));
  9.     ESP_ERROR_CHECK(esp_wifi_start());
  10. }
  11.  

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: WiFi factory reset - how to?

Postby ESP_Sprite » Sat Oct 14, 2023 1:08 am

Probably better to just stop WiFi and then nuke the WiFi NVS partition.

Who is online

Users browsing this forum: pkf1111 and 176 guests