Add run limit feature for relay channels with NVS support
- Introduced configuration options for enabling run limits in Kconfig. - Added APIs to get and set run limits for individual relay channels. - Implemented run limit timer functionality to automatically stop channels. - Updated NVS handling to store and retrieve run limit values. - Enhanced documentation in README and code comments to reflect new feature. Closes #1080
This commit is contained in:
@@ -146,6 +146,33 @@ void relay_chn_flip_direction(uint8_t chn_id);
|
||||
*/
|
||||
relay_chn_direction_t relay_chn_get_direction(uint8_t chn_id);
|
||||
|
||||
#if RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
/**
|
||||
* @brief Get the run limit for the specified channel
|
||||
*
|
||||
* @param chn_id The ID of the relay channel to query.
|
||||
*
|
||||
* @return The run limit value for the relevant channel if the channel ID is valid.
|
||||
* 0 if the channel ID is invalid.
|
||||
*/
|
||||
uint16_t relay_chn_get_run_limit(uint8_t chn_id);
|
||||
|
||||
/**
|
||||
* @brief Set the run limit for the specified channel
|
||||
*
|
||||
* Sets the time limit in seconds for the specified channel. It will not proceed
|
||||
* if the channel ID is invalid.
|
||||
* If the time_sec value is lesser than the CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC,
|
||||
* the value will be set to CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC.
|
||||
* If the time_sec value is greater than the CONFIG_RELAY_CHN_RUN_LIMIT_MAX_SEC,
|
||||
* the value will be set to CONFIG_RELAY_CHN_RUN_LIMIT_MAX_SEC.
|
||||
*
|
||||
* @param chn_id The ID of the relay channel to query.
|
||||
* @param time_sec The run limit time in seconds.
|
||||
*/
|
||||
void relay_chn_set_run_limit(uint8_t chn_id, uint16_t time_sec);
|
||||
#endif // RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_TILTING == 1
|
||||
|
||||
@@ -275,6 +302,29 @@ void relay_chn_flip_direction(void);
|
||||
*/
|
||||
relay_chn_direction_t relay_chn_get_direction(void);
|
||||
|
||||
#if RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
/**
|
||||
* @brief Get the run limit for the channel
|
||||
*
|
||||
* @return The run limit value for the channel.
|
||||
*/
|
||||
uint16_t relay_chn_get_run_limit(void);
|
||||
|
||||
/**
|
||||
* @brief Set the run limit for the channel
|
||||
*
|
||||
* Sets the time limit in seconds for the channel. It will not proceed
|
||||
* if the channel ID is invalid.
|
||||
* If the time_sec value is lesser than the CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC,
|
||||
* the value will be set to CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC.
|
||||
* If the time_sec value is greater than the CONFIG_RELAY_CHN_RUN_LIMIT_MAX_SEC,
|
||||
* the value will be set to CONFIG_RELAY_CHN_RUN_LIMIT_MAX_SEC.
|
||||
*
|
||||
* @param time_sec The run limit time in seconds.
|
||||
*/
|
||||
void relay_chn_set_run_limit(uint16_t time_sec);
|
||||
#endif // RELAY_CHN_ENABLE_RUN_LIMIT == 1
|
||||
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_TILTING == 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user