I am able to detect that the supercapacitor voltage is dropping and save everything and deinit all modules before the voltage drops too low for the esp to work. After I detect the voltage drop I need to stop execution of all other tasks.
I know that the function I need is vTaskEndScheduler or vTaskSuspendAll, except that they don't work with the IDF implementation of freertos and calling them throws a Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0)
I saw somewhere in the docs that it is recommended using semaphores instead of creating critical sections with the above sections.
Until now I saved the handle for every task I created and deleted them with vTaskDelete before deiniting every module
But now I have http POST happening, and if I call esp_wifi_disconnect during an esp_http_client_write I also get a crash:
Code: Select all
I (12232) BAT: Disconnect wifi
I (12242) wifi: state: run -> init (0)
I (12242) wifi: pm stop, total sleep time: 4207612 us / 7481433 us
I (12252) wifi: n:11 0, o:11 0, ap:255 255, sta:11 0, prof:1
I (12252) BAT: C:/msys32/home/gunar.kroeger/esp/esp-idf/components/freertos/queue.c:719 (xQueueGenericSend)- assert failed!
abort() was called at PC 0x4009431c on core 1
I need to stop wifi as fast as possible so that I don't drain all the energy from the supercap.
So, how do I fully stop the FreeRTOS scheduler or how do I stop the underlying task that is trying to send data to the server?
Thanks