Просто используйте xTaskGetCurrentTaskHandle()
how-to-get-current-task-handle-in-freertos.cpp
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
TaskHandle_t myTaskHandle = xTaskGetCurrentTaskHandle();
Check out similar posts by category:
Встраиваемые системы FreeRTOS
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow