General code and comment cleanup

This commit is contained in:
2025-09-04 16:59:00 +03:00
parent 7244b57061
commit bf5e3a4426
25 changed files with 213 additions and 218 deletions

View File

@@ -18,10 +18,10 @@ extern "C" {
/**
* @brief Initializes the relay channel timer.
*
*
* This function creates a timer for the relay channel to handle direction change inertia.
* Required by *_ctl_* module.
*
*
* @param chn_ctl Pointer to the relay channel control structure.
* @return esp_err_t ESP_OK on success, or an error code on failure.
*/
@@ -30,12 +30,12 @@ esp_err_t relay_chn_init_timer(relay_chn_ctl_t *chn_ctl);
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT
/**
* @brief Initializes the relay channel run limit timer.
*
*
* This function creates a timer for the relay channel to handle run time limit.
* Required by *_ctl_* module.
*
*
* @param chn_ctl Pointer to the relay channel control structure.
*
*
* @return esp_err_t ESP_OK on success, or an error code on failure.
*/
esp_err_t relay_chn_init_run_limit_timer(relay_chn_ctl_t *chn_ctl);
@@ -43,10 +43,10 @@ esp_err_t relay_chn_init_run_limit_timer(relay_chn_ctl_t *chn_ctl);
/**
* @brief Issues a command to the relay channel.
*
*
* Evaluates the current state of the relay channel and issues the command accordingly.
* Required by *_core, *_ctl_* and *_tilt modules.
*
*
* @param chn_ctl Pointer to the relay channel control structure.
* @param cmd The command to issue.
*/
@@ -54,7 +54,7 @@ void relay_chn_issue_cmd(relay_chn_ctl_t* chn_ctl, relay_chn_cmd_t cmd);
/**
* @brief Dispatches a relay channel command.
*
*
* @param chn_ctl Pointer to the relay channel control structure.
* @param cmd The command to dispatch.
*/
@@ -62,7 +62,7 @@ void relay_chn_dispatch_cmd(relay_chn_ctl_t *chn_ctl, relay_chn_cmd_t cmd);
/**
* @brief Returns the string representation of a relay channel command.
*
*
* @param cmd The relay channel command.
* @return char* The string representation of the command.
*/
@@ -70,11 +70,11 @@ char *relay_chn_cmd_str(relay_chn_cmd_t cmd);
/**
* @brief Starts the ESP timer once with the specified time in milliseconds.
*
*
* Starts the ESP timer to run once after the specified time.
* If the timer is already running, it stops it first and then starts it again.
* Required by *_ctl_* and *_tilt modules.
*
*
* @param esp_timer The ESP timer handle.
* @param time_ms The time in milliseconds to wait before the timer expires.
* @return esp_err_t ESP_OK on success, or an error code on failure.
@@ -83,11 +83,11 @@ esp_err_t relay_chn_start_esp_timer_once(esp_timer_handle_t esp_timer, uint32_t
/**
* @brief Updates the state of the relay channel and notifies listeners.
*
*
* This function updates the state of the relay channel and notifies all registered listeners
* about the state change.
* Required by *_ctl_* and *_tilt modules.
*
*
* @param chn_ctl Pointer to the relay channel control structure.
* @param new_state The new state to set for the relay channel.
*/
@@ -95,7 +95,7 @@ void relay_chn_update_state(relay_chn_ctl_t *chn_ctl, relay_chn_state_t new_stat
/**
* @brief Return the text presentation of an state.
*
*
* @param state A state with type of relay_chn_state_t.
* @return char* The text presentation of the state. "UNKNOWN" if the state is not known.
*/
@@ -104,7 +104,7 @@ char *relay_chn_state_str(relay_chn_state_t state);
#if CONFIG_RELAY_CHN_COUNT > 1
/**
* @brief Check if the provided channel ID is valid.
*
*
* @param chn_id Channel ID to check.
* @return true Channel ID is valid.
* @return false Channel ID is invalid.

View File

@@ -16,17 +16,17 @@ extern "C" {
/**
* @brief Initialize the relay channel control.
*
*
* @param output Pointer to the output object(s).
* @param run_info Pointer to the runtime information object(s).
*
*
* @return esp_err_t Returns ESP_OK on success, or an error code on failure.
*/
esp_err_t relay_chn_ctl_init(relay_chn_output_t *output, relay_chn_run_info_t *run_info);
/**
* @brief Deinitialize the relay channel control.
*
*
* This function cleans up resources used by the relay channel control.
*/
void relay_chn_ctl_deinit(void);
@@ -34,16 +34,16 @@ void relay_chn_ctl_deinit(void);
#if CONFIG_RELAY_CHN_COUNT > 1
/**
* @brief Get the control structure for a specific relay channel.
*
*
* @param chn_id The ID of the relay channel to retrieve.
*
*
* @return relay_chn_ctl_t* Pointer to the control structure for the specified channel, or NULL if not found.
*/
relay_chn_ctl_t *relay_chn_ctl_get(uint8_t chn_id);
/**
* @brief Get the control structures for all relay channels.
*
*
* @return relay_chn_ctl_t* Pointer to the array of control structures for all channels.
*/
relay_chn_ctl_t *relay_chn_ctl_get_all(void);

View File

@@ -16,7 +16,7 @@ extern "C" {
/**
* @brief Init the notify module.
*
*
* @return
* - ESP_OK: Success
* - ESP_ERR_NO_MEM: Not enough memory to create notify queue
@@ -25,7 +25,7 @@ esp_err_t relay_chn_notify_init(void);
/**
* @brief Deinit the notify module.
*
*
* This function cleans up resources used by the notify module.
*/
void relay_chn_notify_deinit(void);

View File

@@ -18,9 +18,9 @@ extern "C" {
/**
* @brief Initialize NVS storage for relay channels.
*
* @attention Before calling this function, make sure the NVS flash is initialised
* using either the nvs_flash_init() function for the default NVS partition or the
*
* @attention Before calling this function, make sure the NVS flash is initialised
* using either the nvs_flash_init() function for the default NVS partition or the
* nvs_flash_init_partition() function for a custom partition.
*
* @return ESP_OK on success, error code otherwise.
@@ -32,7 +32,7 @@ esp_err_t relay_chn_nvs_init(void);
*
* @param[in] ch Channel number.
* @param[in] direction Direction to store.
*
*
* @note This operation is asynchronous. The value is queued to be written
* by a background task. A subsequent `get` call may not immediately
* reflect the new value.
@@ -56,7 +56,7 @@ esp_err_t relay_chn_nvs_get_direction(uint8_t ch, relay_chn_direction_t *directi
*
* @param[in] ch Channel number.
* @param[in] limit_sec Run limit value to store.
*
*
* @note This operation is asynchronous. The value is queued to be written
* by a background task. A subsequent `get` call may not immediately
* reflect the new value.
@@ -81,7 +81,7 @@ esp_err_t relay_chn_nvs_get_run_limit(uint8_t ch, uint16_t *limit_sec, uint16_t
*
* @param[in] ch Channel number.
* @param[in] sensitivity Sensitivity value to store.
*
*
* @note This operation is asynchronous. The value is queued to be written
* by a background task. A subsequent `get` call may not immediately
* reflect the new value.
@@ -104,7 +104,7 @@ esp_err_t relay_chn_nvs_get_tilt_sensitivity(uint8_t ch, uint8_t *sensitivity, u
*
* @param[in] ch Channel number.
* @param[in] tilt_count Tilt count value.
*
*
* @note This operation is asynchronous. The value is queued to be written
* by a background task. A subsequent `get` call may not immediately
* reflect the new value.

View File

@@ -24,7 +24,7 @@ extern "C" {
*
* @param[in] gpio_map Array of GPIO pin numbers for each relay channel.
* @param[in] gpio_count Number of GPIO pins (relay channels).
*
*
* @return ESP_OK on success, error code otherwise.
*/
esp_err_t relay_chn_output_init(const uint8_t* gpio_map, uint8_t gpio_count);
@@ -41,7 +41,7 @@ void relay_chn_output_deinit(void);
* @brief Get the relay channel output object for a specific channel.
*
* @param[in] chn_id Channel ID.
*
*
* @return Pointer to relay channel output object, or NULL if invalid.
*/
relay_chn_output_t *relay_chn_output_get(uint8_t chn_id);
@@ -67,7 +67,7 @@ relay_chn_output_t *relay_chn_output_get(void);
* Sets the relay channel to the stop state.
*
* @param[in] output Pointer to relay channel output object.
*
*
* @return ESP_OK on success, error code otherwise.
*/
esp_err_t relay_chn_output_stop(relay_chn_output_t *output);
@@ -76,7 +76,7 @@ esp_err_t relay_chn_output_stop(relay_chn_output_t *output);
* @brief Set relay channel output to forward direction.
*
* @param[in] output Pointer to relay channel output object.
*
*
* @return ESP_OK on success, error code otherwise.
*/
esp_err_t relay_chn_output_forward(relay_chn_output_t *output);
@@ -85,7 +85,7 @@ esp_err_t relay_chn_output_forward(relay_chn_output_t *output);
* @brief Set relay channel output to reverse direction.
*
* @param[in] output Pointer to relay channel output object.
*
*
* @return ESP_OK on success, error code otherwise.
*/
esp_err_t relay_chn_output_reverse(relay_chn_output_t *output);
@@ -103,7 +103,7 @@ void relay_chn_output_flip(relay_chn_output_t *output);
* @brief Get the current direction of the relay channel output.
*
* @param[in] output Pointer to relay channel output object.
*
*
* @return Current direction of the relay channel.
*/
relay_chn_direction_t relay_chn_output_get_direction(relay_chn_output_t *output);

View File

@@ -49,7 +49,7 @@ relay_chn_run_info_t *relay_chn_run_info_get(void);
* @brief Get the last run command for a relay channel.
*
* @param[in] run_info Pointer to run information structure.
*
*
* @return Last command that was executed, or RELAY_CHN_CMD_NONE if invalid.
*/
relay_chn_cmd_t relay_chn_run_info_get_last_run_cmd(relay_chn_run_info_t *run_info);
@@ -66,7 +66,7 @@ void relay_chn_run_info_set_last_run_cmd(relay_chn_run_info_t *run_info, relay_c
* @brief Get the timestamp of the last run command.
*
* @param[in] run_info Pointer to run information structure.
*
*
* @return Timestamp in milliseconds of last command, or 0 if invalid.
*/
uint32_t relay_chn_run_info_get_last_run_cmd_time_ms(relay_chn_run_info_t *run_info);

View File

@@ -19,7 +19,7 @@ extern "C" {
* Must be called before using any other tilt functions.
*
* @param[in] chn_ctls Array of relay channel control structures.
*
*
* @return ESP_OK on success, error code otherwise.
*/
esp_err_t relay_chn_tilt_init(relay_chn_ctl_t *chn_ctls);
@@ -34,12 +34,12 @@ void relay_chn_tilt_deinit(void);
/**
* @brief Dispatch a tilt command to a relay channel.
*
*
* Queues a tilt command for execution on the specified channel.
*
* @param[in] tilt_ctl Pointer to tilt control structure.
* @param[in] cmd Tilt command to execute.
*
*
* @return ESP_OK on success, error code otherwise.
*/
esp_err_t relay_chn_tilt_dispatch_cmd(relay_chn_tilt_ctl_t *tilt_ctl, relay_chn_tilt_cmd_t cmd);