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_output.h"
|
||||
#include "relay_chn_core.h"
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
#include "relay_chn_nvs.h"
|
||||
#endif
|
||||
|
||||
@@ -73,7 +73,7 @@ static esp_err_t relay_chn_output_ctl_init(relay_chn_output_t *output,
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
static esp_err_t relay_chn_output_load_direction(uint8_t ch, relay_chn_direction_t *direction)
|
||||
{
|
||||
esp_err_t ret = relay_chn_nvs_get_direction(ch, direction);
|
||||
@@ -101,7 +101,7 @@ esp_err_t relay_chn_output_init(const uint8_t* gpio_map, uint8_t gpio_count)
|
||||
gpio_num_t reverse_pin = (gpio_num_t) gpio_map[gpio_index + 1];
|
||||
|
||||
relay_chn_direction_t direction = RELAY_CHN_DIRECTION_DEFAULT;
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
// If NVS storage is enabled, retrieve the direction from storage
|
||||
ret = relay_chn_output_load_direction(i, &direction);
|
||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to load direction from storage for channel %d", i);
|
||||
@@ -111,7 +111,7 @@ esp_err_t relay_chn_output_init(const uint8_t* gpio_map, uint8_t gpio_count)
|
||||
}
|
||||
#else
|
||||
relay_chn_direction_t direction = RELAY_CHN_DIRECTION_DEFAULT;
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
// If NVS storage is enabled, retrieve the direction from storage
|
||||
ret = relay_chn_output_load_direction(0, &direction);
|
||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to load direction from storage for channel %d", 0);
|
||||
@@ -194,7 +194,7 @@ void relay_chn_output_flip(relay_chn_output_t *output)
|
||||
? RELAY_CHN_DIRECTION_FLIPPED
|
||||
: RELAY_CHN_DIRECTION_DEFAULT;
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
uint8_t ch = 0;
|
||||
#if CONFIG_RELAY_CHN_COUNT > 1
|
||||
for (uint8_t i = 0; i < CONFIG_RELAY_CHN_COUNT; i++) {
|
||||
|
||||
Reference in New Issue
Block a user