diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index 6a0d0d389a92e2..26e5dd35496282 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -210,9 +210,10 @@ extern "C" void app_main() { ESP_LOGE(TAG, "GetAppTask().StartAppTask() failed : %" CHIP_ERROR_FORMAT, error.Format()); } - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + + ESPOpenThreadInit(); } bool lowPowerClusterSleep() diff --git a/examples/all-clusters-minimal-app/esp32/main/main.cpp b/examples/all-clusters-minimal-app/esp32/main/main.cpp index 4972e775bd6f31..8a9a74e4c7f124 100644 --- a/examples/all-clusters-minimal-app/esp32/main/main.cpp +++ b/examples/all-clusters-minimal-app/esp32/main/main.cpp @@ -186,8 +186,9 @@ extern "C" void app_main() ESP_LOGE(TAG, "GetAppTask().StartAppTask() failed : %" CHIP_ERROR_FORMAT, error.Format()); } - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + + ESPOpenThreadInit(); } bool lowPowerClusterSleep() diff --git a/examples/energy-management-app/esp32/main/main.cpp b/examples/energy-management-app/esp32/main/main.cpp index 9e1dff9b43b745..9dff90bf9443cb 100644 --- a/examples/energy-management-app/esp32/main/main.cpp +++ b/examples/energy-management-app/esp32/main/main.cpp @@ -294,7 +294,8 @@ extern "C" void app_main() #endif SetDeviceAttestationCredentialsProvider(get_dac_provider()); - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + + ESPOpenThreadInit(); } diff --git a/examples/light-switch-app/esp32/main/main.cpp b/examples/light-switch-app/esp32/main/main.cpp index f8127433f14f60..564639327e7b65 100644 --- a/examples/light-switch-app/esp32/main/main.cpp +++ b/examples/light-switch-app/esp32/main/main.cpp @@ -19,6 +19,7 @@ #include "DeviceCallbacks.h" #include #include +#include #include "AppTask.h" #include "BindingHandler.h" @@ -135,21 +136,10 @@ extern "C" void app_main() SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD - if (DeviceLayer::ThreadStackMgr().InitThreadStack() != CHIP_NO_ERROR) - { - ESP_LOGE(TAG, "Failed to initialize Thread stack"); - return; - } - if (DeviceLayer::ThreadStackMgr().StartThreadTask() != CHIP_NO_ERROR) - { - ESP_LOGE(TAG, "Failed to launch Thread task"); - return; - } -#endif - chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + ESPOpenThreadInit(); + error = GetAppTask().StartAppTask(); if (error != CHIP_NO_ERROR) { diff --git a/examples/lighting-app/esp32/main/main.cpp b/examples/lighting-app/esp32/main/main.cpp index 120c004782c895..ba3edee4669e86 100644 --- a/examples/lighting-app/esp32/main/main.cpp +++ b/examples/lighting-app/esp32/main/main.cpp @@ -210,10 +210,11 @@ extern "C" void app_main() #endif SetDeviceAttestationCredentialsProvider(get_dac_provider()); - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + ESPOpenThreadInit(); + error = GetAppTask().StartAppTask(); if (error != CHIP_NO_ERROR) { diff --git a/examples/lit-icd-app/esp32/main/main.cpp b/examples/lit-icd-app/esp32/main/main.cpp index 4bb736b219eabd..04565a922b3bb5 100644 --- a/examples/lit-icd-app/esp32/main/main.cpp +++ b/examples/lit-icd-app/esp32/main/main.cpp @@ -130,10 +130,11 @@ extern "C" void app_main() #else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER - ESPOpenThreadInit(); static UatButton sButton; sButton.Init(UAT_GPIO, ESP_EXT1_WAKEUP_ANY_LOW); sButton.SetUatButtonPressCallback(UatButtonHandler); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + + ESPOpenThreadInit(); } diff --git a/examples/thread-br-app/esp32/main/main.cpp b/examples/thread-br-app/esp32/main/main.cpp index dcafcc1c74ae40..a03e29d6031097 100644 --- a/examples/thread-br-app/esp32/main/main.cpp +++ b/examples/thread-br-app/esp32/main/main.cpp @@ -149,9 +149,10 @@ extern "C" void app_main() SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER esp_openthread_set_backbone_netif(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF")); - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + + ESPOpenThreadInit(); } extern "C" void otSysProcessDrivers(otInstance * aInstance)