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:
2025-08-25 10:56:01 +03:00
parent 5afefc4dc0
commit 6ff16b5797
17 changed files with 77 additions and 77 deletions

View File

@@ -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
@@ -34,9 +34,9 @@ esp_err_t relay_chn_ctl_init(relay_chn_output_t *outputs, relay_chn_run_info_t *
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;
#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) {
@@ -61,7 +61,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;
@@ -146,7 +146,7 @@ relay_chn_direction_t relay_chn_ctl_get_direction(uint8_t chn_id)
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(uint8_t chn_id)
{
if (!relay_chn_is_channel_id_valid(chn_id) || chn_id == RELAY_CHN_ID_ALL) {
@@ -171,7 +171,7 @@ void relay_chn_ctl_set_run_limit(uint8_t chn_id, uint16_t time_sec)
chn_ctls[chn_id].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_id, time_sec);
#endif
}