Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs] Fix silabs energy mangement app #35658

Merged
merged 8 commits into from
Sep 20, 2024
39 changes: 21 additions & 18 deletions examples/energy-management-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ if (wifi_soc) {
"${examples_plat_dir}",
"${chip_root}/src/lib",
"${examples_common_plat_dir}",
"../energy-management-common/include",
"${chip_root}/examples/energy-management-app/energy-management-common/common/include",
"${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/include",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/include",
]

if (use_wf200) {
Expand Down Expand Up @@ -136,23 +139,23 @@ silabs_executable("energy-management-app") {
}

sources = [
"${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseEventTriggers.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyReportingEventTriggers.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/FakeReadings.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/PowerTopologyDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DEMTestEventTriggers.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/device-energy-management-mode.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseEventTriggers.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseMain.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/EnergyReportingEventTriggers.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/FakeReadings.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/PowerTopologyDelegate.cpp",
"${examples_common_plat_dir}/main.cpp",
"src/AppTask.cpp",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/silabs/wifi_args.gni")

sl_enable_test_event_trigger = true
chip_enable_ota_requestor = false
disable_lcd = true
app_data_model =
Expand Down
1 change: 1 addition & 0 deletions examples/energy-management-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ app_data_model =
chip_enable_ota_requestor = false
chip_enable_openthread = true
disable_lcd = true
sl_enable_test_event_trigger = true

openthread_external_platform =
"${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32"
22 changes: 22 additions & 0 deletions examples/energy-management-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@

#include <platform/CHIPDeviceLayer.h>

#ifdef SL_MATTER_TEST_EVENT_TRIGGER_ENABLED
#include <app/TestEventTriggerDelegate.h>
#include <app/clusters/device-energy-management-server/DeviceEnergyManagementTestEventTriggerHandler.h>
#include <app/clusters/electrical-energy-measurement-server/EnergyReportingTestEventTriggerHandler.h>
#include <app/clusters/energy-evse-server/EnergyEvseTestEventTriggerHandler.h>
#endif

#if (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))
#define EVSE_LED 1
#else
Expand All @@ -66,6 +73,12 @@ using namespace ::chip::DeviceLayer::Silabs;
using namespace ::chip::DeviceLayer::Internal;
using namespace chip::TLV;

#ifdef SL_MATTER_TEST_EVENT_TRIGGER_ENABLED
static EnergyEvseTestEventTriggerHandler sEnergyEvseTestEventTriggerHandler;
static EnergyReportingTestEventTriggerHandler sEnergyReportingTestEventTriggerHandler;
static DeviceEnergyManagementTestEventTriggerHandler sDeviceEnergyManagementTestEventTriggerHandler;
#endif

namespace chip {
namespace app {
namespace Clusters {
Expand Down Expand Up @@ -120,6 +133,15 @@ CHIP_ERROR AppTask::Init()

ApplicationInit();

#ifdef SL_MATTER_TEST_EVENT_TRIGGER_ENABLED
if (Server::GetInstance().GetTestEventTriggerDelegate() != nullptr)
{
Server::GetInstance().GetTestEventTriggerDelegate()->AddHandler(&sEnergyEvseTestEventTriggerHandler);
Server::GetInstance().GetTestEventTriggerDelegate()->AddHandler(&sEnergyReportingTestEventTriggerHandler);
Server::GetInstance().GetTestEventTriggerDelegate()->AddHandler(&sDeviceEnergyManagementTestEventTriggerHandler);
}
#endif

// Update the LCD with the Stored value. Show QR Code if not provisioned
#ifdef DISPLAY_ENABLED
GetLCD().WriteDemoUI(LightMgr().IsLightOn());
Expand Down
5 changes: 5 additions & 0 deletions examples/platform/silabs/provision/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ source_set("storage") {
}

deps = [ "${chip_root}/src/lib" ]

public_deps =
[ "${chip_root}/src/platform/silabs/provision:provision-headers" ]

public_configs = [
"${chip_root}/examples/platform/silabs/efr32:test-event-trigger-config",
]
}
Loading