From ba8cb33ad44f3afb2fa2fc7a9347df6dc24dcbd3 Mon Sep 17 00:00:00 2001 From: Adam Bodurka Date: Tue, 22 Nov 2022 22:38:31 +0100 Subject: [PATCH] [QPG] Reduce ram usage (#23681) * Applied SDP011-1231 and SDP011-1233 changes * Changed std::function to plain pointer * Fixed hardfault on OTA button * Restyled by clang-format Co-authored-by: Restyled.io --- .../lighting-app/qpg/include/LightingManager.h | 2 +- examples/platform/qpg/ota/ota.cpp | 17 ++++++++++++++++- src/platform/qpg/SystemPlatformConfig.h | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/examples/lighting-app/qpg/include/LightingManager.h b/examples/lighting-app/qpg/include/LightingManager.h index b1cb0ab9ad1a18..96800a62ccaa6b 100644 --- a/examples/lighting-app/qpg/include/LightingManager.h +++ b/examples/lighting-app/qpg/include/LightingManager.h @@ -56,7 +56,7 @@ class LightingManager uint8_t GetLevel(); bool InitiateAction(Action_t aAction, int32_t aActor, uint16_t size, uint8_t * value); - using LightingCallback_fn = std::function; + using LightingCallback_fn = void (*)(Action_t); void SetCallbacks(LightingCallback_fn aActionInitiated_CB, LightingCallback_fn aActionCompleted_CB); diff --git a/examples/platform/qpg/ota/ota.cpp b/examples/platform/qpg/ota/ota.cpp index 6661b58290ebb4..b37a62d3ab1d76 100644 --- a/examples/platform/qpg/ota/ota.cpp +++ b/examples/platform/qpg/ota/ota.cpp @@ -81,5 +81,20 @@ void InitializeOTARequestor(void) void TriggerOTAQuery(void) { - GetRequestorInstance()->TriggerImmediateQuery(); + CHIP_ERROR err = CHIP_NO_ERROR; + OTARequestorInterface * requestor = GetRequestorInstance(); + + if (requestor != nullptr) + { + err = requestor->TriggerImmediateQuery(kUndefinedFabricIndex); + + if (CHIP_NO_ERROR != err) + { + ChipLogError(DeviceLayer, "Failed trigger OTA query: %" CHIP_ERROR_FORMAT, err.Format()); + } + } + else + { + ChipLogProgress(DeviceLayer, "No OTA requestor instance, can't query OTA"); + } } diff --git a/src/platform/qpg/SystemPlatformConfig.h b/src/platform/qpg/SystemPlatformConfig.h index 78d4757355226c..44ec1f75120e01 100644 --- a/src/platform/qpg/SystemPlatformConfig.h +++ b/src/platform/qpg/SystemPlatformConfig.h @@ -35,5 +35,6 @@ struct ChipDeviceEvent; // ==================== Platform Adaptations ==================== #define CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME 1 #define CHIP_SYSTEM_CONFIG_EVENT_OBJECT_TYPE const struct ::chip::DeviceLayer::ChipDeviceEvent * - +#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 8 // ========== Platform-specific Configuration Overrides ========= +#define CHIP_CONFIG_ENABLE_SERVER_IM_EVENT 0