Use original names for config parameters

The config parameter names defined in the relay_chn_defs.h file
have been changed back to their original names (with the CONFIG_ prefix),
so that they are not confused with application-level defines.

Refs #1085
This commit is contained in:
2025-08-25 10:24:13 +03:00
parent 9d3f8ddbff
commit 5afefc4dc0
21 changed files with 186 additions and 207 deletions

View File

@@ -10,20 +10,20 @@
#include "relay_chn_ctl.h"
#include "relay_chn_output.h"
#if RELAY_CHN_ENABLE_NVS == 1
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
#include "relay_chn_nvs.h"
#endif
static const char *TAG = "RELAY_CHN_CTL";
static relay_chn_ctl_t chn_ctls[RELAY_CHN_COUNT];
static relay_chn_ctl_t chn_ctls[CONFIG_RELAY_CHN_COUNT];
esp_err_t relay_chn_ctl_init(relay_chn_output_t *outputs, relay_chn_run_info_t *run_infos)
{
// Initialize all relay channels
esp_err_t ret;
for (int i = 0; i < RELAY_CHN_COUNT; i++) {
for (int i = 0; i < CONFIG_RELAY_CHN_COUNT; i++) {
relay_chn_ctl_t* chn_ctl = &chn_ctls[i];
relay_chn_output_t* output = &outputs[i];
relay_chn_run_info_t* run_info = &run_infos[i];
@@ -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 RELAY_CHN_ENABLE_RUN_LIMIT == 1
uint16_t run_limit_sec = RELAY_CHN_RUN_LIMIT_DEFAULT_SEC;
#if RELAY_CHN_ENABLE_NVS == 1
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT == 1
uint16_t run_limit_sec = CONFIG_RELAY_CHN_RUN_LIMIT_DEFAULT_SEC;
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
// 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) {
@@ -55,13 +55,13 @@ esp_err_t relay_chn_ctl_init(relay_chn_output_t *outputs, relay_chn_run_info_t *
void relay_chn_ctl_deinit()
{
for (int i = 0; i < RELAY_CHN_COUNT; i++) {
for (int i = 0; i < CONFIG_RELAY_CHN_COUNT; i++) {
relay_chn_ctl_t* chn_ctl = &chn_ctls[i];
if (chn_ctl->inertia_timer != NULL) {
esp_timer_delete(chn_ctl->inertia_timer);
chn_ctl->inertia_timer = NULL;
}
#if RELAY_CHN_ENABLE_RUN_LIMIT == 1
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT == 1
if (chn_ctl->run_limit_timer != NULL) {
esp_timer_delete(chn_ctl->run_limit_timer);
chn_ctl->run_limit_timer = NULL;
@@ -88,7 +88,7 @@ char *relay_chn_ctl_get_state_str(uint8_t chn_id)
static void relay_chn_ctl_issue_cmd_on_all_channels(relay_chn_cmd_t cmd)
{
for (int i = 0; i < RELAY_CHN_COUNT; i++) {
for (int i = 0; i < CONFIG_RELAY_CHN_COUNT; i++) {
relay_chn_issue_cmd(&chn_ctls[i], cmd);
}
}
@@ -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 RELAY_CHN_ENABLE_RUN_LIMIT == 1
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT == 1
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) {
@@ -164,14 +164,14 @@ void relay_chn_ctl_set_run_limit(uint8_t chn_id, uint16_t time_sec)
}
// Check for boundaries
if (time_sec > RELAY_CHN_RUN_LIMIT_MAX_SEC)
time_sec = RELAY_CHN_RUN_LIMIT_MAX_SEC;
else if (time_sec < RELAY_CHN_RUN_LIMIT_MIN_SEC)
time_sec = RELAY_CHN_RUN_LIMIT_MIN_SEC;
if (time_sec > CONFIG_RELAY_CHN_RUN_LIMIT_MAX_SEC)
time_sec = CONFIG_RELAY_CHN_RUN_LIMIT_MAX_SEC;
else if (time_sec < CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC)
time_sec = CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC;
chn_ctls[chn_id].run_limit_sec = time_sec;
#if RELAY_CHN_ENABLE_NVS == 1
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
relay_chn_nvs_set_run_limit(chn_id, time_sec);
#endif
}