From 4820d8d83faa5c0dcf918c7532169e613586f141 Mon Sep 17 00:00:00 2001 From: Piyush Shah Date: Fri, 7 Nov 2025 17:36:37 +0800 Subject: [PATCH 1/2] esp_rainmaker: Make version dependency for network_provisioning more flexible --- components/esp_rainmaker/CHANGELOG.md | 15 +++++++++++++++ components/esp_rainmaker/idf_component.yml | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/components/esp_rainmaker/CHANGELOG.md b/components/esp_rainmaker/CHANGELOG.md index 7558d22..b6d6b6a 100644 --- a/components/esp_rainmaker/CHANGELOG.md +++ b/components/esp_rainmaker/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 1.7.8 + +## Changes +- Make version dependency for network_provisioning more flexible + +## 1.7.7 + +### New Feature +- Added AWS credential provider APIs, required for RainMaker Camera applications. + +## 1.7.6 + +## Changes +- Disabled esp_bt code from ota code for supporting esp32-p4, which uses network adapters for Bluetooth. + ## 1.7.5 ### Bug Fixes diff --git a/components/esp_rainmaker/idf_component.yml b/components/esp_rainmaker/idf_component.yml index 10ff9fb..049a904 100644 --- a/components/esp_rainmaker/idf_component.yml +++ b/components/esp_rainmaker/idf_component.yml @@ -1,5 +1,5 @@ ## IDF Component Manager Manifest File -version: "1.7.7" +version: "1.7.8" description: ESP RainMaker firmware agent url: https://github.com/espressif/esp-rainmaker/tree/master/components/esp_rainmaker repository: https://github.com/espressif/esp-rainmaker.git @@ -21,7 +21,7 @@ dependencies: espressif/esp_schedule: version: "~1.3.2" espressif/network_provisioning: - version: "~1.0.0" + version: ">=1.*" espressif/esp_rcp_update: # This allows all the minor version updates version: "^1.2.0" From 7dedfad9f739066cf3a41859937655586a79c884 Mon Sep 17 00:00:00 2001 From: Piyush Shah Date: Fri, 7 Nov 2025 17:37:09 +0800 Subject: [PATCH 2/2] app_network: Use new wifi retry count field for better resilience in poor network conditions If network connection fails even once, the firmware reports so to clients (like phone apps) and the clients declare failure and abort immediately, even if the firmware eventually connects. With this change, a failure will be reported only after a few retries (whise number is configurable) --- .../common/app_network/app_wifi_internal.c | 28 +++++++++---------- examples/common/app_network/idf_component.yml | 2 ++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/examples/common/app_network/app_wifi_internal.c b/examples/common/app_network/app_wifi_internal.c index 5431abe..c6ff42f 100644 --- a/examples/common/app_network/app_wifi_internal.c +++ b/examples/common/app_network/app_wifi_internal.c @@ -36,10 +36,6 @@ static const char* TAG = "app_wifi"; static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data) { -#ifdef CONFIG_APP_NETWORK_RESET_PROV_ON_FAILURE - static int retries = 0; -#endif - if (event_base == NETWORK_PROV_EVENT) { switch (event_id) { case NETWORK_PROV_START: @@ -60,21 +56,20 @@ static void event_handler(void* arg, esp_event_base_t event_base, (*reason == NETWORK_PROV_WIFI_STA_AUTH_ERROR) ? "Wi-Fi station authentication failed" : "Wi-Fi access-point not found"); #ifdef CONFIG_APP_NETWORK_RESET_PROV_ON_FAILURE - retries++; - if (retries >= CONFIG_APP_NETWORK_PROV_MAX_RETRY_CNT) { - ESP_LOGI(TAG, "Failed to connect with provisioned AP, reseting provisioned credentials"); - network_prov_mgr_reset_wifi_sm_state_on_failure(); - esp_event_post(APP_NETWORK_EVENT, APP_NETWORK_EVENT_PROV_RESTART, NULL, 0, portMAX_DELAY); - retries = 0; - } + /* Reset the state machine on provisioning failure. + * This is enabled by the CONFIG_EXAMPLE_RESET_PROV_MGR_ON_FAILURE configuration. + * It allows the provisioning manager to retry the provisioning process + * based on the number of attempts specified in wifi_conn_attempts. After attempting + * the maximum number of retries, the provisioning manager will reset the state machine + * and the provisioning process will be terminated. + */ + ESP_LOGI(TAG, "Failed to connect with provisioned AP, reseting provisioned credentials"); + network_prov_mgr_reset_wifi_sm_state_on_failure(); #endif // CONFIG_APP_NETWORK_RESET_PROV_ON_FAILURE break; } case NETWORK_PROV_WIFI_CRED_SUCCESS: ESP_LOGI(TAG, "Provisioning successful"); -#ifdef CONFIG_APP_NETWORK_RESET_PROV_ON_FAILURE - retries = 0; -#endif break; default: break; @@ -120,6 +115,11 @@ esp_err_t app_wifi_internal_start(const char *pop, const char *service_name, #ifdef CONFIG_ESP_RMAKER_NETWORK_OVER_WIFI /* Configuration for the provisioning manager */ network_prov_mgr_config_t config = { +#ifdef CONFIG_APP_NETWORK_RESET_PROV_ON_FAILURE + .network_prov_wifi_conn_cfg = { + .wifi_conn_attempts = CONFIG_APP_NETWORK_PROV_MAX_RETRY_CNT, + }, +#endif /* What is the Provisioning Scheme that we want ? * network_prov_scheme_softap or network_prov_scheme_ble */ #ifdef CONFIG_APP_NETWORK_PROV_TRANSPORT_BLE diff --git a/examples/common/app_network/idf_component.yml b/examples/common/app_network/idf_component.yml index 712d54f..222c4f7 100644 --- a/examples/common/app_network/idf_component.yml +++ b/examples/common/app_network/idf_component.yml @@ -2,3 +2,5 @@ dependencies: espressif/qrcode: version: "*" + espressif/network_provisioning: + version: "~1.2.0"