esp_netif_destroy is not working

Zeni241
Posts: 59
Joined: Tue Nov 20, 2018 4:28 am

esp_netif_destroy is not working

Postby Zeni241 » Fri Nov 27, 2020 7:07 am

If a user didn't sent correct SSID and PW in first attempt, he resends the credentials and "wifi_init_sta(void)" is executed again.
But the second time core panics, most probably the first instance of "esp_netif" is not destroyed.
I know "esp_netif_init()" should be fired only once and if firing second time, it should be destroyed first. But question is how to destroy :?: :?:

Bellow is my code which is not working :roll: :roll: :

Code: Select all


esp_netif_t *my_esp_netif;
'
'
'
'
'
if(my_esp_netif){
        esp_netif_destroy(my_esp_netif);
      }
  
   my_esp_netif= esp_netif_init();
   ESP_ERROR_CHECK(esp_event_loop_create_default()); //     This is the line at which core panics.
    esp_netif_create_default_wifi_sta();
    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK(esp_wifi_init(&cfg));

Who is online

Users browsing this forum: No registered users and 57 guests