tonyp7 / esp32-wifi-manager

Captive Portal for ESP32 that can connect to a saved wireless network or start an access point where you can connect to existing wifis.
MIT License
664 stars 217 forks source link

vTaskDelete(task_wifi_manager) ?fails? #55

Closed cgfoed closed 4 years ago

cgfoed commented 4 years ago

Great Work, awesome project! I have a problem though - I can't get wifi_manager_destroy(); to work.

As for a basic test I simply added it to the callback:

void cb_connection_ok(void *pvParameter){
    ESP_LOGI(TAG, "I have a connection!");
    wifi_manager_destroy();
}

I think the problem lays within vTaskDelete() - it seems the function is entered but never left.

void wifi_manager_destroy(){
    ESP_LOGI(TAG, "trying to kill wifi manager");
         if( task_wifi_manager != NULL ) vTaskDelete(task_wifi_manager);
        else ESP_LOGI(TAG, "This is not the Task you are looking for.");
    ESP_LOGI(TAG, "Success deleting task");
    task_wifi_manager = NULL;

Last Output is: I (4511) wifi_manager: trying to kill wifi manager "Success deleting task" is never printed.

I can delete other tasks on my project though (eg heap monitor).

Any Idea why this is happening? It's unclear to me.

cgfoed commented 4 years ago

to my embarrassment I can't reproduce the error anymore....