diff --git a/components/esp_matter/Kconfig b/components/esp_matter/Kconfig index 2bc9d6ddc..e2c03190c 100644 --- a/components/esp_matter/Kconfig +++ b/components/esp_matter/Kconfig @@ -228,4 +228,14 @@ menu "ESP Matter" If enabled, we will start Matter server when calling esp_matter::start() If disabled, the Matter server will not be initialized in esp_matter::start() + config ESP_MATTER_ENABLE_OPENTHREAD + bool "Initialize Thread stack and start Thread task when starting ESP-Matter" + default y + help + Enabled this option to initialize Thread stack and start Thread task when calling + esp_matter::start() + + Disable this option to initialize Thread stack and start Thread task with more + flexibility. + endmenu diff --git a/components/esp_matter/esp_matter_core.cpp b/components/esp_matter/esp_matter_core.cpp index bbcddfa33..3549563cf 100644 --- a/components/esp_matter/esp_matter_core.cpp +++ b/components/esp_matter/esp_matter_core.cpp @@ -961,6 +961,7 @@ static esp_err_t chip_init(event_callback_t callback, intptr_t callback_arg) PlatformMgr().AddEventHandler(callback, callback_arg); } #if CHIP_DEVICE_CONFIG_ENABLE_THREAD +#ifdef CONFIG_ESP_MATTER_ENABLE_OPENTHREAD if (ThreadStackMgr().InitThreadStack() != CHIP_NO_ERROR) { ESP_LOGE(TAG, "Failed to initialize Thread stack"); return ESP_FAIL; @@ -986,6 +987,7 @@ static esp_err_t chip_init(event_callback_t callback, intptr_t callback_arg) ESP_LOGE(TAG, "Failed to launch Thread task"); return ESP_FAIL; } +#endif // CONFIG_ESP_MATTER_ENABLE_OPENTHREAD #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD #if CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER