diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index 7f6694a615bf6d..6cfa14a9895297 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -280,6 +280,14 @@ menu "CHIP Device Layer" help Enables or Disables the support for Commissionable Device Type. + config ENABLE_BG_EVENT_PROCESSING + bool "Enable Background event processing" + default n + help + Few cryptographic operations requires more time for processing, + When this option is enabled, main matter task can delegate some + time consuming operations to background task so that main matter + task is not blocked and can process other work. endmenu menu "Device Identification Options" diff --git a/examples/platform/esp32/common/CHIPDeviceManager.cpp b/examples/platform/esp32/common/CHIPDeviceManager.cpp index 037ca40f2c0c3b..22063fc67851ea 100644 --- a/examples/platform/esp32/common/CHIPDeviceManager.cpp +++ b/examples/platform/esp32/common/CHIPDeviceManager.cpp @@ -83,7 +83,10 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ReturnErrorOnFailure(PlatformMgr().StartBackgroundEventLoopTask()); // Start a task to run the CHIP Device event loop. - return PlatformMgr().StartEventLoopTask(); + ReturnErrorOnFailure(PlatformMgr().StartEventLoopTask()); + + // This is a no op if CONFIG_ENABLE_BG_EVENT_PROCESSING is disabled + return PlatformMgr().StartBackgroundEventLoopTask(); } } // namespace DeviceManager } // namespace chip diff --git a/src/platform/ESP32/CHIPDevicePlatformConfig.h b/src/platform/ESP32/CHIPDevicePlatformConfig.h index 96b910785cf620..f98fa12272e1fc 100644 --- a/src/platform/ESP32/CHIPDevicePlatformConfig.h +++ b/src/platform/ESP32/CHIPDevicePlatformConfig.h @@ -100,3 +100,4 @@ #define CHIP_DEVICE_CONFIG_ENABLE_DEVICE_INSTANCE_INFO_PROVIDER CONFIG_ENABLE_ESP32_DEVICE_INSTANCE_INFO_PROVIDER #define CHIP_DEVICE_CONFIG_DISCOVERY_TIMEOUT_SECS CONFIG_CHIP_DISCOVERY_TIMEOUT_SECS #define CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE CONFIG_ENABLE_ESP32_BLE_CONTROLLER +#define CHIP_DEVICE_CONFIG_ENABLE_BG_EVENT_PROCESSING CONFIG_ENABLE_BG_EVENT_PROCESSING