Skip to content

Commit

Permalink
[QPG] Reduce ram usage (#23681)
Browse files Browse the repository at this point in the history
* 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 <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Mar 28, 2023
1 parent 0ec50d4 commit 1001132
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/lighting-app/qpg/include/LightingManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<void(Action_t)>;
using LightingCallback_fn = void (*)(Action_t);

void SetCallbacks(LightingCallback_fn aActionInitiated_CB, LightingCallback_fn aActionCompleted_CB);

Expand Down
17 changes: 16 additions & 1 deletion examples/platform/qpg/ota/ota.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
3 changes: 2 additions & 1 deletion src/platform/qpg/SystemPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1001132

Please sign in to comment.