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:
@@ -10,7 +10,7 @@
|
||||
#include "relay_chn_ctl.h"
|
||||
#include "relay_chn_output.h"
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
#include "relay_chn_nvs.h"
|
||||
#endif
|
||||
|
||||
@@ -27,10 +27,10 @@ esp_err_t relay_chn_ctl_init(relay_chn_output_t *output, relay_chn_run_info_t *r
|
||||
chn_ctl.pending_cmd = RELAY_CHN_CMD_NONE;
|
||||
chn_ctl.output = output;
|
||||
chn_ctl.run_info = run_info;
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT
|
||||
uint16_t run_limit_sec = CONFIG_RELAY_CHN_RUN_LIMIT_DEFAULT_SEC;
|
||||
esp_err_t ret;
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
// Load run limit value from NVS
|
||||
ret = relay_chn_nvs_get_run_limit(chn_ctl.id, &run_limit_sec);
|
||||
if (ret != ESP_OK && ret != ESP_ERR_NVS_NOT_FOUND) {
|
||||
@@ -51,7 +51,7 @@ void relay_chn_ctl_deinit()
|
||||
esp_timer_delete(chn_ctl.inertia_timer);
|
||||
chn_ctl.inertia_timer = NULL;
|
||||
}
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT
|
||||
if (chn_ctl.run_limit_timer != NULL) {
|
||||
esp_timer_delete(chn_ctl.run_limit_timer);
|
||||
chn_ctl.run_limit_timer = NULL;
|
||||
@@ -95,7 +95,7 @@ relay_chn_direction_t relay_chn_ctl_get_direction()
|
||||
return relay_chn_output_get_direction(chn_ctl.output);
|
||||
}
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT
|
||||
uint16_t relay_chn_ctl_get_run_limit()
|
||||
{
|
||||
return chn_ctl.run_limit_sec;
|
||||
@@ -111,7 +111,7 @@ void relay_chn_ctl_set_run_limit(uint16_t time_sec)
|
||||
|
||||
chn_ctl.run_limit_sec = time_sec;
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
relay_chn_nvs_set_run_limit(chn_ctl.id, time_sec);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user