Code: Select all
static void periodic_check( void * pvParameters )
{
const TickType_t xDelay = ((int)pvParameters * 1000) / portTICK_PERIOD_MS;
for( ;; )
{
check_for_update();
vTaskDelay( xDelay );
}
}
void otaau_start_timedUpdateCheck(int secconds)
{
xTaskCreate(&periodic_check, "periodic_check", 8192, secconds, 5, &xHandle);
//otaau_check_for_update();
}
void otaau_stop_timedUpdateCheck()
{
if( xHandle != NULL )
{
vTaskDelete( xHandle );
}
}
void otaau_check_for_update()
{
TaskHandle_t Handle = NULL;
xTaskCreate(&check_for_update, "check_for_update", 8192, NULL, 5, Handle);
const TickType_t xDelay = (3 * 1000) / portTICK_PERIOD_MS;
vTaskDelay( xDelay ); //[i]Delay for debug[/i]
while(1) {
eTaskState status = eTaskGetState(Handle); //[b]assert failed![/b]
ESP_LOGI("otaau", "Status is: %d", status);
//if
}
}
first, sorry for my bad english.
Im new with esp and working on an automatic update script.
The update things working but now i want check periodic for new updates.
For this i have a start and stop function, but i want check in the stop function, if the periodic_check task run, before i delete them.
For this i want use eTaskGetState.
But if i run the script on my esp32, i get (eTaskGetState)- assert failed! on the monitor.
Code: Select all
/root/esp/esp-idf/components/freertos/tasks.c:1511 (eTaskGetState)- assert failed!
abort() was called at PC 0x4008b909 on core 0
0x4008b909: eTaskGetState at /root/esp/esp-idf/components/freertos/tasks.c:4423
Backtrace: 0x4008dbe4:0x3ffc8290 0x4008dd87:0x3ffc82b0 0x4008b909:0x3ffc82d0 0x400d2e46:0x3ffc82f0
0x4008dbe4: invoke_abort at /root/esp/esp-idf/components/esp32/panic.c:648
0x4008dd87: abort at /root/esp/esp-idf/components/esp32/panic.c:648
0x4008b909: eTaskGetState at /root/esp/esp-idf/components/freertos/tasks.c:4423
0x400d2e46: otaau_check_for_update at /root/esp/my_Projects/test/main/../../my_include_shit/automatic_Updater/ota_automatic_updater.c:560
CPU halted.