From 58a63d2f7daecaf6ab6a5ba175a6f8c2965f2cbb Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov Date: Sat, 7 Mar 2026 12:48:48 +0300 Subject: [PATCH] fix: negative zero value --- version.txt | 2 +- zh_inclinometer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/version.txt b/version.txt index 50aea0e..7c32728 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.1.0 \ No newline at end of file +2.1.1 \ No newline at end of file diff --git a/zh_inclinometer.c b/zh_inclinometer.c index 1fa65f1..4c6e136 100644 --- a/zh_inclinometer.c +++ b/zh_inclinometer.c @@ -55,7 +55,7 @@ esp_err_t zh_inclinometer_get(zh_inclinometer_handle_t *handle, float *angle) int pcnt_count = 0; pcnt_unit_get_count(handle->pcnt_unit_handle, &pcnt_count); float angle_temp = pcnt_count * handle->degrees_per_pulse; - *angle = (handle->rotation == true) ? angle_temp : -angle_temp; + *angle = (handle->rotation == true) ? angle_temp : ((angle_temp == 0) ? angle_temp : -angle_temp); ZH_LOGI("Inclinometer get position completed successfully."); return ESP_OK; }