Optimize and refactor tilt counting
- Optimized tilt counting data by reducing the tilt counter variables into one for smaller memory footprint. So the `relay_chn_tilt_counter_t` type is replaced by a single `uint16_t` variable in the `relay_chn_tilt_ctl_t` structure. Hence the `relay_chn_tilt_counter_t` type has been removed since it is not necessary anymore. - Refactored tilt count handling in NVS: consolidate forward and reverse counts into a single tilt count parameter. - Updated NVS test files that affected by the data type and function signature changes. Fixes #1079
This commit is contained in:
@@ -68,21 +68,19 @@ esp_err_t relay_chn_nvs_get_tilt_sensitivity(uint8_t ch, uint8_t *sensitivity);
|
||||
* @brief Store tilt counters in NVS.
|
||||
*
|
||||
* @param[in] ch Channel number.
|
||||
* @param[in] forward_count Forward tilt counter value.
|
||||
* @param[in] reverse_count Reverse tilt counter value.
|
||||
* @param[in] tilt_count Tilt count value.
|
||||
* @return ESP_OK on success, error code otherwise.
|
||||
*/
|
||||
esp_err_t relay_chn_nvs_set_tilt_count(uint8_t ch, uint32_t forward_count, uint32_t reverse_count);
|
||||
esp_err_t relay_chn_nvs_set_tilt_count(uint8_t ch, uint16_t tilt_count);
|
||||
|
||||
/**
|
||||
* @brief Retrieve tilt counters from NVS.
|
||||
*
|
||||
* @param[in] ch Channel number.
|
||||
* @param[out] forward_count Pointer to store forward tilt counter.
|
||||
* @param[out] reverse_count Pointer to store reverse tilt counter.
|
||||
* @param[out] tilt_count Pointer to store tilt count.
|
||||
* @return ESP_OK on success, error code otherwise.
|
||||
*/
|
||||
esp_err_t relay_chn_nvs_get_tilt_count(uint8_t ch, uint32_t *forward_count, uint32_t *reverse_count);
|
||||
esp_err_t relay_chn_nvs_get_tilt_count(uint8_t ch, uint16_t *tilt_count);
|
||||
#endif // RELAY_CHN_ENABLE_TILTING
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user