feat: added statistics

This commit is contained in:
2025-12-24 12:30:14 +03:00
parent deb882beb6
commit 2060a56b55
4 changed files with 56 additions and 3 deletions

View File

@@ -61,6 +61,14 @@ void app_main(void)
printf("Encoder position %0.2f.\n", position); // For ESP8266 first disable "Component config -> Newlib -> Enable nano formatting options for printf/scanf family" via menuconfig.
// zh_encoder_set(&encoder_handle, 5); // Just for example.
// zh_encoder_reset(&encoder_handle); // Just for example.
for (;;)
{
const zh_encoder_stats_t *stats = zh_encoder_get_stats();
printf("Number of event post error: %ld.\n", stats->event_post_error);
printf("Number of queue overflow error: %ld.\n", stats->queue_overflow_error);
printf("Minimum free stack size: %ld.\n", stats->min_stack_size);
vTaskDelay(10000 / portTICK_PERIOD_MS);
}
}
void zh_encoder_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data)