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 :
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));