feat: retry wifi 3 times on provision, reset on fail
This commit is contained in:
@@ -77,6 +77,7 @@ static void prov_event_handler(void *arg, esp_event_base_t base,
|
||||
network_prov_wifi_sta_fail_reason_t *reason = (network_prov_wifi_sta_fail_reason_t *)data;
|
||||
ESP_LOGE(TAG, "Provisioning failed: %s",
|
||||
(*reason == NETWORK_PROV_WIFI_STA_AUTH_ERROR) ? "auth error" : "AP not found");
|
||||
network_prov_mgr_reset_wifi_sm_state_on_failure();
|
||||
break;
|
||||
}
|
||||
case NETWORK_PROV_WIFI_CRED_SUCCESS:
|
||||
@@ -101,8 +102,9 @@ esp_err_t provisioning_run(void)
|
||||
prov_event_handler, NULL);
|
||||
|
||||
network_prov_mgr_config_t config = {
|
||||
.scheme = network_prov_scheme_ble,
|
||||
.scheme_event_handler = NETWORK_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM,
|
||||
.scheme = network_prov_scheme_ble,
|
||||
.scheme_event_handler = NETWORK_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM,
|
||||
.network_prov_wifi_conn_cfg = { .wifi_conn_attempts = 3 },
|
||||
};
|
||||
ESP_ERROR_CHECK(network_prov_mgr_init(config));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user