|
esp_iot_framework
v0.1.0-alpha
© 2026 AmakeSasha, distributed under a license Apache-2.0
|
Pre-initialization tuning and profile management for the Wi-Fi stack. More...
Functions | |
| esp_err_t | eif_set_wifi_config (const wifi_init_config_t *wifi_driver_config, wifi_ps_type_t wifi_power_mode, uint32_t wifi_attempt_delay_ms) |
| Configure Wi-Fi driver and power management policies. More... | |
| esp_err_t | eif_set_wifi_profiles_count (uint8_t wifi_profiles_count) |
| Set the number of additional user Wi-Fi profiles. More... | |
| esp_err_t | eif_wifi_initialize (void) |
| Launch the Wi-Fi subsystem and automated network services. More... | |
This module provides fine-grained control over the Wi-Fi stack behavior, including power management and connection recovery policies.
| esp_err_t eif_set_wifi_config | ( | const wifi_init_config_t * | wifi_driver_config, |
| wifi_ps_type_t | wifi_power_mode, | ||
| uint32_t | wifi_attempt_delay_ms | ||
| ) |
Overrides the default low-level driver settings. These parameters are applied globally and define the performance and energy profile of the device.
eif_core_initialize() but before eif_wifi_initialize().UB), memory leaks, or Wi-Fi crashes. Always validate the data you send.| wifi_driver_config | Low-level ESP-IDF Wi-Fi driver configuration Use WIFI_INIT_CONFIG_DEFAULT() as a base. |
| wifi_power_mode | Wi-Fi Modem-sleep policy. Defines the trade-off between power consumption and network responsiveness/latency. |
| wifi_attempt_delay_ms | Delay in milliseconds before switching to the next profile after a failed connection. |
ESP_OK: Settings saved successfully.ESP_ERR_INVALID_ARG: The wifi_driver_config pointer is NULL.Example of use:
| esp_err_t eif_set_wifi_profiles_count | ( | uint8_t | wifi_profiles_count | ) |
Defines how many additional user-defined slots are available in NVS.
eif_core_initialize() but before eif_nvs_initialize().Profile - configuration for a specific Wi-Fi network (SSID and Password). Profiles are managed in a circular (ring) list: if a connection attempt fails or if the active connection is broken, the framework automatically rotates to the next available slot. Upon reaching the end of the list, it wraps around to the first profile. This cycle continues indefinitely until a stable connection is re-established.
wifi_profiles_count + 1). If set to 0, only the system default profile (index 0) will be used. The default profile is hardcoded and cannot be changed. The default value is EIF_WIFI_PROFILES_DEFAULT_COUNT.| wifi_profiles_count | Number of extra slots (0 to EIF_WIFI_PROFILES_MAX_COUNT). |
ESP_OK: Profile capacity set and state reset.ESP_ERR_INVALID_ARG: wifi_profiles_count exceeds EIF_WIFI_PROFILES_MAX_COUNT.Example of use:
| esp_err_t eif_wifi_initialize | ( | void | ) |
Initializes the Wi-Fi stack, registers event handlers for automatic profile failover, and starts mDNS/Web Server once an IP is obtained. In case of IP loss, the Web Server and mDNS services are gracefully stopped to save resources and prevent invalid states. Once a new IP address is obtained, the framework automatically resumes these services.
eif_* functions (like URI registration or Wi-Fi connectivity). This function is mandatory for the framework to work.UB) will occur.ESP_OK: Subsystem initialized successfully.ESP_ERR_NO_MEM: Failed to allocate memory for network interface.ESP_ERR_*: Internal driver errors. Look at the logs to understand the cause of the errors.Example of use: