Skip to content

Commit

Permalink
[QPG] QPG SDK feature updates (#33436)
Browse files Browse the repository at this point in the history
* [QPG] QPG SDK feature updates.

* Add LED behavior to identify effects
* Add saving total operational hours in NVM
* Enable reset sequence to trigger BLE advertisements for lock application
* Fix powercycle counting with JLink Reset triggers
* Update status LED behaviour
* Add missing python requirements
* Fix filename in ot-qorvo
* Update CurrentHue and CurrentSaturation storage
* Adjust .zap after TE2
* Disable sleep for FTD devices
* Update Matter software version to include used Matter standard and SDK version
* Fix -Werror=undef on Qorvo variables using GN build flow
* Restore hsv instaed off xy color as we are now saving hsv not xy
* Enable momentary switch feature for generic switch endpoint
* Update attributes and commands to comply with General Diagnostic Cluster requirements
* Remove versions for OTA image from qpg_sdk files
* Move location of mbedtls-config
* Add BLE manager adjustments
* Fix light-switch and thermostat product IDs
* Trigger advertising on greater or equal than 3 resets

* [QPG] Fix CI checks

* Bump ot-qorvo
* Fix paths in zap files
* Remove persistent-storage example from qpg action
* Sync light.matter with light.zap
* Update qpg_sdk repo submodule
* Remove shell example from qpg action
* Fix missing argument declaration and assignment
* Restyled by gn

---------

Co-authored-by: Adam Bodurka <[email protected]>
Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
3 people authored and pull[bot] committed Nov 15, 2024
1 parent 1d6853c commit 1002497
Show file tree
Hide file tree
Showing 46 changed files with 622 additions and 183 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/examples-qpg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ jobs:
--enable-flashbundle \
--target qpg-qpg6105-lock \
--target qpg-qpg6105-light \
--target qpg-qpg6105-shell \
--target qpg-qpg6105-persistent-storage \
--target qpg-qpg6105-light-switch \
--target qpg-qpg6105-thermostat \
build \
Expand Down
2 changes: 2 additions & 0 deletions config/qpg/chip-gn/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ env
GN_ROOT_TARGET=$(dirname "$0")
CHIP_ROOT=$GN_ROOT_TARGET/../../../
OUTDIR=$CHIP_ROOT/out
GN_ARGS="qpg_target_ic=\"qpg6105\" qpg_flavour=\"_ext_flash\""

mkdir -p "$OUTDIR"
gn \
Expand All @@ -33,6 +34,7 @@ gn \
--export-compile-commands \
gen \
--check \
--args="$GN_ARGS" \
--fail-on-unused-args \
"$OUTDIR"
ninja -C "$OUTDIR"
2 changes: 1 addition & 1 deletion examples/light-switch-app/qpg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ qpg_executable("light_switch_app") {
}
}

ldscript = "${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_${qpg_target_ic}/QorvoStack_${qpg_target_ic}.ld"
ldscript = "${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_${qpg_target_ic}${qpg_flavour}/QorvoStack_${qpg_target_ic}${qpg_flavour}.ld"

inputs = [ ldscript ]

Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/qpg/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ chip_enable_icd_lit = true
chip_stack_lock_tracking = "none"

matter_device_vid = "0xFFF1"
matter_device_pid = "0x8006"
matter_device_pid = "0x8004"

pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip"
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"
17 changes: 15 additions & 2 deletions examples/light-switch-app/qpg/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,18 @@
* CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
*
* A uint32_t identifying the software version running on the device.
* First two bytes are reflecting the Matter standard
* Last two bytes are reflecting the SDK version of which the first nibble of the first byte represents the major
* version and the second nibble of the first byte has the minor number. The last byte holds the patch number.
* example for SDK v0.1.5 with Matter v1.2 standard:
* 0x01020105
*/
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0003 // Can't be removed, needed for OTA file generation.
#ifndef OTA_TEST_IMAGE
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x01020105
#else
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x01020106
#endif
#endif

/**
Expand All @@ -53,7 +62,11 @@
* {MAJOR_VERSION}.0d{MINOR_VERSION}
*/
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.1" // Can't be removed, needed for OTA file generation.
#ifndef OTA_TEST_IMAGE
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.2-0.1.5"
#else
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.2-0.1.6"
#endif
#endif

/**
Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/qpg/include/SwitchManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class SwitchManager
};

void Init(void);
static void GenericSwitchInitialPress(void);
static void GenericSwitchReleasePress(void);
static void GenericSwitchInitialPressHandler(AppEvent * aEvent);
static void GenericSwitchReleasePressHandler(AppEvent * aEvent);
static void ToggleHandler(AppEvent * aEvent);
static void LevelHandler(AppEvent * aEvent);
static void ColorHandler(AppEvent * aEvent);
Expand Down
16 changes: 10 additions & 6 deletions examples/light-switch-app/qpg/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,13 @@ void AppTask::ButtonEventHandler(uint8_t btnIdx, bool btnPressed)
case APP_FUNCTION2_SWITCH: {
if (!btnPressed)
{
ChipLogProgress(NotSpecified, "Switch initial press");
SwitchMgr().GenericSwitchInitialPress();
ChipLogProgress(NotSpecified, "Switch release press");
button_event.Handler = SwitchMgr().GenericSwitchReleasePressHandler;
}
else
{
ChipLogProgress(NotSpecified, "Switch release press");
SwitchMgr().GenericSwitchReleasePress();
ChipLogProgress(NotSpecified, "Switch initial press");
button_event.Handler = SwitchMgr().GenericSwitchInitialPressHandler;
}
break;
}
Expand Down Expand Up @@ -516,11 +516,15 @@ void AppTask::UpdateLEDs(void)
// If the system has ble connection(s) uptill the stage above, THEN blink
// the LEDs at an even rate of 100ms.
//
// Otherwise, blink the LED ON for a very short time.
// Otherwise, turn the LED OFF.
if (sIsThreadProvisioned && sIsThreadEnabled)
{
qvIO_LedSet(SYSTEM_STATE_LED, true);
}
else if (sIsThreadProvisioned && !sIsThreadEnabled)
{
qvIO_LedBlink(SYSTEM_STATE_LED, 950, 50);
}
else if (sHaveBLEConnections)
{
qvIO_LedBlink(SYSTEM_STATE_LED, 100, 100);
Expand All @@ -532,7 +536,7 @@ void AppTask::UpdateLEDs(void)
else
{
// not commissioned yet
qvIO_LedBlink(SYSTEM_STATE_LED, 50, 950);
qvIO_LedSet(SYSTEM_STATE_LED, false);
}
}

Expand Down
32 changes: 26 additions & 6 deletions examples/light-switch-app/qpg/src/SwitchManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,40 @@ void SwitchManager::ColorHandler(AppEvent * aEvent)
DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast<intptr_t>(data));
}

void SwitchManager::GenericSwitchInitialPress(void)
void SwitchManager::GenericSwitchInitialPressHandler(AppEvent * aEvent)
{
// Press moves Position from 0 (idle) to 1 (press)
uint8_t newPosition = 1;

SystemLayer().ScheduleLambda(
[newPosition] { chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition); });
if (aEvent->Type != AppEvent::kEventType_Button)
{
ChipLogError(NotSpecified, "Event type not supported!");
return;
}

ChipLogProgress(NotSpecified, "GenericSwitchInitialPress new position %d", newPosition);
SystemLayer().ScheduleLambda([newPosition] {
chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition);
// InitialPress event takes newPosition as event data
chip::app::Clusters::SwitchServer::Instance().OnInitialPress(GENERICSWITCH_ENDPOINT_ID, newPosition);
});
}

void SwitchManager::GenericSwitchReleasePress(void)
void SwitchManager::GenericSwitchReleasePressHandler(AppEvent * aEvent)
{
// Release moves Position from 1 (press) to 0
uint8_t newPosition = 0;

SystemLayer().ScheduleLambda(
[newPosition] { chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition); });
if (aEvent->Type != AppEvent::kEventType_Button)
{
ChipLogError(NotSpecified, "Event type not supported!");
return;
}

ChipLogProgress(NotSpecified, "GenericSwitchReleasePress new position %d", newPosition);
SystemLayer().ScheduleLambda([newPosition] {
chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition);
// Short Release event takes newPosition as event data
chip::app::Clusters::SwitchServer::Instance().OnShortRelease(GENERICSWITCH_ENDPOINT_ID, newPosition);
});
}
12 changes: 9 additions & 3 deletions examples/light-switch-app/qpg/zap/switch.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2404,6 +2404,8 @@ endpoint 0 {
ram attribute lastNetworkingStatus;
ram attribute lastNetworkID;
ram attribute lastConnectErrorValue;
callback attribute supportedThreadFeatures;
callback attribute threadVersion;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
Expand Down Expand Up @@ -2441,19 +2443,21 @@ endpoint 0 {
callback attribute networkInterfaces;
callback attribute rebootCount;
callback attribute upTime;
callback attribute totalOperationalHours;
callback attribute bootReason;
callback attribute activeHardwareFaults;
callback attribute activeRadioFaults;
callback attribute activeNetworkFaults;
ram attribute testEventTriggersEnabled default = 0;
callback attribute testEventTriggersEnabled default = false;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
callback attribute featureMap;
callback attribute clusterRevision;

handle command TestEventTrigger;
handle command TimeSnapshot;
handle command TimeSnapshotResponse;
}

server cluster SoftwareDiagnostics {
Expand Down Expand Up @@ -2729,13 +2733,15 @@ endpoint 2 {
}

server cluster Switch {
emits event InitialPress;
emits event ShortRelease;
ram attribute numberOfPositions default = 2;
ram attribute currentPosition default = 0;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 1;
ram attribute featureMap default = 6;
ram attribute clusterRevision default = 1;
}
}
Expand Down
Loading

0 comments on commit 1002497

Please sign in to comment.