release-0.5.0 #31

Merged
ismail merged 19 commits from release-0.5.0 into main 2025-07-23 16:48:19 +02:00
2 changed files with 5 additions and 4 deletions
Showing only changes of commit b239b50abe - Show all commits

View File

@@ -49,6 +49,7 @@ typedef enum relay_chn_direction_enum relay_chn_direction_t;
* @brief Enums that represent the state of a relay channel. * @brief Enums that represent the state of a relay channel.
*/ */
enum relay_chn_state_enum { enum relay_chn_state_enum {
RELAY_CHN_STATE_UNDEFINED, ///< The relay channel state is undefined.
RELAY_CHN_STATE_FREE, ///< The relay channel is free to run or execute commands. RELAY_CHN_STATE_FREE, ///< The relay channel is free to run or execute commands.
RELAY_CHN_STATE_STOPPED, ///< The relay channel is stopped and not running. RELAY_CHN_STATE_STOPPED, ///< The relay channel is stopped and not running.
RELAY_CHN_STATE_FORWARD, ///< The relay channel is running in the forward direction. RELAY_CHN_STATE_FORWARD, ///< The relay channel is running in the forward direction.

View File

@@ -648,16 +648,16 @@ static void relay_chn_issue_cmd(relay_chn_t* relay_chn, relay_chn_cmd_t cmd)
/* relay_chn APIs */ /* relay_chn APIs */
relay_chn_state_t relay_chn_get_state(uint8_t chn_id) relay_chn_state_t relay_chn_get_state(uint8_t chn_id)
{ {
if (!relay_chn_is_channel_id_valid(chn_id)) { if (!relay_chn_is_channel_id_valid(chn_id) || chn_id == RELAY_CHN_ID_ALL) {
return RELAY_CHN_STATE_STOPPED; return RELAY_CHN_STATE_UNDEFINED;
} }
return relay_channels[chn_id].state; return relay_channels[chn_id].state;
} }
char *relay_chn_get_state_str(uint8_t chn_id) char *relay_chn_get_state_str(uint8_t chn_id)
{ {
if (!relay_chn_is_channel_id_valid(chn_id)) { if (!relay_chn_is_channel_id_valid(chn_id) || chn_id == RELAY_CHN_ID_ALL) {
return "INVALID"; return relay_chn_state_str(RELAY_CHN_STATE_UNDEFINED);
} }
return relay_chn_state_str(relay_channels[chn_id].state); return relay_chn_state_str(relay_channels[chn_id].state);
} }