Fix config parameters check
Unnecessary `#if CONFIG_FOO == 1` checks were removed and the statements were simplified to` #if CONFIG_FOO`. `#ifdef CONFIG_FOO` statements were also changed to `#if CONFIG_FOO` to keep the style as uniform as possible. Refs #1085
This commit is contained in:
@@ -8,10 +8,10 @@
|
||||
#include "relay_chn_nvs.h"
|
||||
|
||||
#define RELAY_CHN_KEY_DIR "dir" /*!< Direction key */
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT
|
||||
#define RELAY_CHN_KEY_RLIM(ch) "rlim_%d" /*!< Run limit key */
|
||||
#endif
|
||||
#ifdef CONFIG_RELAY_CHN_ENABLE_TILTING
|
||||
#if CONFIG_RELAY_CHN_ENABLE_TILTING
|
||||
#define RELAY_CHN_KEY_TSENS(ch) "tsens_%d" /*!< Tilt sensitivity key */
|
||||
#define RELAY_CHN_KEY_TCNT(ch) "tcnt_%d" /*!< Tilt count key */
|
||||
#endif
|
||||
@@ -23,7 +23,7 @@ static nvs_handle_t relay_chn_nvs;
|
||||
esp_err_t relay_chn_nvs_init()
|
||||
{
|
||||
esp_err_t ret;
|
||||
#if CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION == 1
|
||||
#if CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION
|
||||
ret = nvs_open_from_partition(CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION_NAME,
|
||||
CONFIG_RELAY_CHN_NVS_NAMESPACE,
|
||||
NVS_READWRITE,
|
||||
@@ -72,7 +72,7 @@ esp_err_t relay_chn_nvs_get_direction(uint8_t ch, relay_chn_direction_t *directi
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT
|
||||
esp_err_t relay_chn_nvs_set_run_limit(uint8_t ch, uint16_t time_sec)
|
||||
{
|
||||
esp_err_t ret = nvs_set_u16(relay_chn_nvs, RELAY_CHN_KEY_RLIM(ch), time_sec);
|
||||
@@ -88,7 +88,7 @@ esp_err_t relay_chn_nvs_get_run_limit(uint8_t ch, uint16_t *time_sec)
|
||||
}
|
||||
#endif // CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
|
||||
#ifdef CONFIG_RELAY_CHN_ENABLE_TILTING
|
||||
#if CONFIG_RELAY_CHN_ENABLE_TILTING
|
||||
esp_err_t relay_chn_nvs_set_tilt_sensitivity(uint8_t ch, uint8_t sensitivity)
|
||||
{
|
||||
esp_err_t ret = nvs_set_u8(relay_chn_nvs, RELAY_CHN_KEY_TSENS(ch), sensitivity);
|
||||
|
||||
Reference in New Issue
Block a user