feat: added status enumeration

This commit is contained in:
aZholtikov committed 2026-10-29 08:11:45 +03:00
1 parent d9872c8e94
commit fb87e98189
6 files changed
+91 -69

No files matched your search

+3 -3
View File
@@ -618,7 +618,7 @@ static void _zh_encoder_isr_processing_task(void *pvParameter)
{
zh_encoder_handle_t *handle = encoder_queue.handle;
bool position_changed = false;
bool encoder_status = false;
zh_encoder_status_t encoder_status = ZH_ENCODER_STATUS_DECREASED;
float encoder_position = 0.0;
uint8_t encoder_number = 0;
taskENTER_CRITICAL(&handle->lock);
@@ -644,7 +644,7 @@ static void _zh_encoder_isr_processing_task(void *pvParameter)
{
handle->encoder_position = candidate;
position_changed = true;
encoder_status = full_steps > 0 ? true : false;
encoder_status = full_steps > 0 ? ZH_ENCODER_STATUS_INCREASED : ZH_ENCODER_STATUS_DECREASED;
encoder_position = candidate;
encoder_number = handle->encoder_number;
}
@@ -672,7 +672,7 @@ static void _zh_encoder_button_timer_cb(TimerHandle_t xTimer)
encoder_handle->s_gpio_status = s_gpio_status;
zh_encoder_button_event_on_isr_t encoder_data = {0};
encoder_data.encoder_number = encoder_handle->encoder_number;
encoder_data.button_status = s_gpio_status;
encoder_data.button_status = s_gpio_status == true ? ZH_ENCODER_BUTTON_STATUS_RELEASED : ZH_ENCODER_BUTTON_STATUS_PRESSED;
ZH_ERROR_CHECK_CONT(esp_event_post(ZH_ENCODER, ZH_BUTTON_EVENT, &encoder_data, sizeof(encoder_data), pdMS_TO_TICKS(10)) == ESP_OK, ++_stats.event_post_error, "Encoder button isr processing failed. Failed to post interrupt event.");
}
}