From e133e5a8076dfc47c2796eaf52ff810b93fda34a Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov Date: Wed, 3 Dec 2025 09:12:34 +0300 Subject: [PATCH] perf: added task handle --- include/zh_encoder.h | 2 ++ zh_encoder.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/zh_encoder.h b/include/zh_encoder.h index 61c4346..a1289bd 100644 --- a/include/zh_encoder.h +++ b/include/zh_encoder.h @@ -30,6 +30,8 @@ extern "C" { #endif + extern TaskHandle_t zh_encoder; /*!< Unique encoder Task Handle. */ + /** * @brief Structure for initial initialization of encoder. */ diff --git a/zh_encoder.c b/zh_encoder.c index 8e3ca15..a2d97b6 100644 --- a/zh_encoder.c +++ b/zh_encoder.c @@ -26,6 +26,7 @@ static const uint8_t _encoder_matrix[7][4] = { {0x03, 0x05, 0x03, 0x00}, }; +TaskHandle_t zh_encoder = NULL; static QueueHandle_t _queue_handle = NULL; static bool _is_initialized = false; @@ -152,7 +153,7 @@ static esp_err_t _zh_encoder_create_task(const zh_encoder_init_config_t *config) config->stack_size, NULL, config->task_priority, - NULL, + &zh_encoder, tskNO_AFFINITY); ZH_ENCODER_CHECK(err == pdPASS, ESP_FAIL, "Task creation failed."); }