[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 <commits@restyled.io>
diff --git a/examples/lighting-app/qpg/include/LightingManager.h b/examples/lighting-app/qpg/include/LightingManager.h
index b1cb0ab..96800a6 100644
--- a/examples/lighting-app/qpg/include/LightingManager.h
+++ b/examples/lighting-app/qpg/include/LightingManager.h
@@ -56,7 +56,7 @@
     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);
 
diff --git a/examples/platform/qpg/ota/ota.cpp b/examples/platform/qpg/ota/ota.cpp
index 6661b58..b37a62d 100644
--- a/examples/platform/qpg/ota/ota.cpp
+++ b/examples/platform/qpg/ota/ota.cpp
@@ -81,5 +81,20 @@
 
 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 78d4757..44ec1f7 100644
--- a/src/platform/qpg/SystemPlatformConfig.h
+++ b/src/platform/qpg/SystemPlatformConfig.h
@@ -35,5 +35,6 @@
 // ==================== 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