Add missing destroy function.

The component allocates resources (timers, event loop) in relay_chn_create but never frees them. This is a resource leak.
Hence, a destroy function added to free the resources gracefully.

Fixes #1048.
This commit is contained in:
2025-07-14 11:37:14 +03:00
parent a90649a4d3
commit f1cb928341
3 changed files with 41 additions and 1 deletions

View File

@@ -97,6 +97,13 @@ typedef void (*relay_chn_state_listener_t)(uint8_t chn_id, relay_chn_state_t old
*/
esp_err_t relay_chn_create(const gpio_num_t* gpio_map, uint8_t gpio_count);
/**
* @brief Destroy the relay channels and free resources.
*
* This function cleans up the relay channels and releases any resources allocated during their creation.
*/
void relay_chn_destroy(void);
/**
* @brief Register a channel state change listener.
*