feat: added get/set attemps
This commit is contained in:
14
zh_espnow.c
14
zh_espnow.c
@ -521,4 +521,18 @@ void zh_espnow_reset_stats(void)
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user