doc: updated comments
This commit is contained in:
1 parent
15b498fd6b
commit
7f92fb6cd4
2 files changed
+5
-2
No files matched your search
@@ -99,7 +99,7 @@ extern "C"
|
|||||||
* PCNT unit, frees the inclinometer handle memory, and sets the handle to
|
* PCNT unit, frees the inclinometer handle memory, and sets the handle to
|
||||||
* NULL.
|
* NULL.
|
||||||
*
|
*
|
||||||
* @param[in,out] handle Pointer to the unique inclinometer handle (must not be NULL)
|
* @param[in,out] handle Pointer to the inclinometer handle pointer (will be set to NULL)
|
||||||
*
|
*
|
||||||
* @note After deinitialization, the handle is invalidated and must not be
|
* @note After deinitialization, the handle is invalidated and must not be
|
||||||
* used. Call zh_inclinometer_init() again to reinitialize.
|
* used. Call zh_inclinometer_init() again to reinitialize.
|
||||||
|
|||||||
+4
-1
@@ -101,7 +101,10 @@ esp_err_t zh_inclinometer_get(zh_inclinometer_handle_t **handle, float *angle)
|
|||||||
ZH_ERROR_CHECK(pcnt_unit_get_count((*handle)->pcnt_unit_handle, &pcnt_count) == ESP_OK, ESP_FAIL, NULL, "Inclinometer get position failed. PCNT unit get count fail.");
|
ZH_ERROR_CHECK(pcnt_unit_get_count((*handle)->pcnt_unit_handle, &pcnt_count) == ESP_OK, ESP_FAIL, NULL, "Inclinometer get position failed. PCNT unit get count fail.");
|
||||||
float angle_temp = pcnt_count * (*handle)->degrees_per_pulse;
|
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;
|
||||||
*angle += 0.0f;
|
if (*angle == 0.0)
|
||||||
|
{
|
||||||
|
*angle = 0.0;
|
||||||
|
}
|
||||||
ZH_LOGI("Inclinometer get position completed successfully.");
|
ZH_LOGI("Inclinometer get position completed successfully.");
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user