feat: added get/set attemps

This commit is contained in:
Alexey Zholtikov 2025-05-06 09:31:46 +03:00
parent 17deb9f895
commit da9da77890
3 changed files with 31 additions and 1 deletions

View File

@ -128,6 +128,22 @@ extern "C"
*/
bool zh_espnow_is_initialized(void);
/**
* @brief Get number of attempts.
*
* @return Attemps number.
*/
uint8_t zh_espnow_get_attempts(void);
/**
* @brief Set number of attempts.
*
* @param[in] attempts Attemps number.
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_espnow_set_attempts(uint8_t attempts);
#ifdef __cplusplus
}
#endif

View File

@ -1 +1 @@
1.3.0
1.4.0

View File

@ -522,3 +522,17 @@ bool zh_espnow_is_initialized(void)
{
return _is_initialized;
}
uint8_t zh_espnow_get_attempts(void)
{
return _init_config.attempts;
}
esp_err_t zh_espnow_set_attempts(uint8_t attempts)
{
ZH_ESPNOW_CHECK(_is_initialized == true, ESP_ERR_INVALID_STATE, "ESP-NOW is not initialized.");
ZH_ESPNOW_CHECK(attempts > 0, ESP_ERR_INVALID_ARG, "Invalid number of attempts.");
_init_config.attempts = attempts;
ZH_ESPNOW_LOGI("Number of attempts set successfully.");
return ESP_OK;
}