Rename time_sec to limit_sec in relay channel functions for clarity
Fixes #1087
This commit is contained in:
@@ -101,18 +101,18 @@ uint16_t relay_chn_ctl_get_run_limit()
|
||||
return chn_ctl.run_limit_sec;
|
||||
}
|
||||
|
||||
void relay_chn_ctl_set_run_limit(uint16_t time_sec)
|
||||
void relay_chn_ctl_set_run_limit(uint16_t limit_sec)
|
||||
{
|
||||
// Check for boundaries
|
||||
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;
|
||||
if (limit_sec > CONFIG_RELAY_CHN_RUN_LIMIT_MAX_SEC)
|
||||
limit_sec = CONFIG_RELAY_CHN_RUN_LIMIT_MAX_SEC;
|
||||
else if (limit_sec < CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC)
|
||||
limit_sec = CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC;
|
||||
|
||||
chn_ctl.run_limit_sec = time_sec;
|
||||
chn_ctl.run_limit_sec = limit_sec;
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
relay_chn_nvs_set_run_limit(chn_ctl.id, time_sec);
|
||||
relay_chn_nvs_set_run_limit(chn_ctl.id, limit_sec);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -73,18 +73,18 @@ esp_err_t relay_chn_nvs_get_direction(uint8_t ch, relay_chn_direction_t *directi
|
||||
}
|
||||
|
||||
#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 relay_chn_nvs_set_run_limit(uint8_t ch, uint16_t limit_sec)
|
||||
{
|
||||
esp_err_t ret = nvs_set_u16(relay_chn_nvs, RELAY_CHN_KEY_RLIM(ch), time_sec);
|
||||
esp_err_t ret = nvs_set_u16(relay_chn_nvs, RELAY_CHN_KEY_RLIM(ch), limit_sec);
|
||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to set run limit for channel %d", ch);
|
||||
return nvs_commit(relay_chn_nvs);
|
||||
}
|
||||
|
||||
esp_err_t relay_chn_nvs_get_run_limit(uint8_t ch, uint16_t *time_sec)
|
||||
esp_err_t relay_chn_nvs_get_run_limit(uint8_t ch, uint16_t *limit_sec)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(time_sec != NULL, ESP_ERR_INVALID_ARG, TAG, "Run limit value pointer is NULL");
|
||||
ESP_RETURN_ON_FALSE(limit_sec != NULL, ESP_ERR_INVALID_ARG, TAG, "Run limit value pointer is NULL");
|
||||
|
||||
return nvs_get_u16(relay_chn_nvs, RELAY_CHN_KEY_RLIM(ch), time_sec);
|
||||
return nvs_get_u16(relay_chn_nvs, RELAY_CHN_KEY_RLIM(ch), limit_sec);
|
||||
}
|
||||
#endif // CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user