fix(esp_wifi_prov): Moved the registering of wifi event handler

Moved the registering of of wifi event handler if under the condition
if device is already provisioned
This commit is contained in:
hrushikesh.bhosale 2024-11-28 14:10:01 +05:30
parent 8771607562
commit 80087d8a81

View File

@ -334,7 +334,6 @@ void app_main(void)
ESP_ERROR_CHECK(esp_event_handler_register(PROTOCOMM_TRANSPORT_BLE_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
#endif
ESP_ERROR_CHECK(esp_event_handler_register(PROTOCOMM_SECURITY_SESSION_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL));
/* Initialize Wi-Fi including netif with default config */
@ -522,6 +521,7 @@ void app_main(void)
* so let's release it's resources */
wifi_prov_mgr_deinit();
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
/* Start Wi-Fi station */
wifi_init_sta();
}