feat: added get/set attemps
This commit is contained in:
parent
17deb9f895
commit
da9da77890
@ -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
|
@ -1 +1 @@
|
||||
1.3.0
|
||||
1.4.0
|
14
zh_espnow.c
14
zh_espnow.c
@ -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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user