dynamic WiFi stack creation with ESP_MESH_LITE

BrookR
Posts: 15
Joined: Fri Mar 22, 2024 11:30 am

dynamic WiFi stack creation with ESP_MESH_LITE

Postby BrookR » Wed Oct 01, 2025 12:17 pm

Hi all,

I've been trying to see what actually needs to be de-initialised or destroyed when changing Wi-Fi details and so far i've got to the stage of

Code: Select all

E (11:59:21.497) esp_netif_lwip: esp_netif_new_api: Failed to configure netif with config=0x3fcce150 (config or if_key is NULL or duplicate key)
My destroy function for wifi looks like this so far;

Code: Select all

void destroy_wifi(void ) {
    destroy_mesh();
    // esp_mesh_lite_disconnect();
    // esp_mesh_lite_erase_rtc_store();
    
    err_local = esp_wifi_disconnect();
    ESP_LOGI(sysTags.main.wifi, "wifi disconect returned: %s", esp_err_to_name(err_local));

    err_local = esp_wifi_stop();
    ESP_LOGI(sysTags.main.wifi, "wifi stop returned: %s", esp_err_to_name(err_local));

    err_local = esp_wifi_deinit();
    ESP_LOGI(sysTags.main.wifi, "wifi deinit returned: %s", esp_err_to_name(err_local));

    err_local = esp_netif_deinit();
    ESP_LOGI(sysTags.main.wifi, "netif deinit returned: %s", esp_err_to_name(err_local));

    esp_netif_t *netif = NULL;
    netif = esp_netif_get_handle_from_ifkey("WIFI_STA_DEF");
    esp_netif_destroy(netif);
    ESP_LOGI(sysTags.main.wifi, "netif STA destroy returned: %s", esp_err_to_name(err_local));
}
Is there a list which outlines what actually needs to be deinit'd when changing wifi details? Preferably need a method without restarting the device

Any assistance or clarity would be great!

Thanks,
BR
Thanks,
BR

BrookR
Posts: 15
Joined: Fri Mar 22, 2024 11:30 am

Re: dynamic WiFi stack creation with ESP_MESH_LITE

Postby BrookR » Wed Oct 01, 2025 3:21 pm

Thanks,
BR

Who is online

Users browsing this forum: Amazon [Bot], Baidu [Spider], PerplexityBot, Qwantbot and 4 guests