Skip to content

Commit 21a88c7

Browse files
adamb-qwiktor-qorvo
authored andcommitted
[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
1 parent 244fd8c commit 21a88c7

34 files changed

+558
-149
lines changed

examples/light-switch-app/qpg/args.gni

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ chip_enable_icd_lit = true
3030
chip_stack_lock_tracking = "none"
3131

3232
matter_device_vid = "0xFFF1"
33-
matter_device_pid = "0x8006"
33+
matter_device_pid = "0x8004"
3434

3535
pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip"
3636
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"

examples/light-switch-app/qpg/include/CHIPProjectConfig.h

+15-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,18 @@
4040
* CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
4141
*
4242
* A uint32_t identifying the software version running on the device.
43+
* First two bytes are reflecting the Matter standard
44+
* Last two bytes are reflecting the SDK version of which the first nibble of the first byte represents the major
45+
* version and the second nibble of the first byte has the minor number. The last byte holds the patch number.
46+
* example for SDK v0.1.5 with Matter v1.2 standard:
47+
* 0x01020105
4348
*/
4449
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
45-
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0003 // Can't be removed, needed for OTA file generation.
50+
#ifndef OTA_TEST_IMAGE
51+
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x01020105
52+
#else
53+
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x01020106
54+
#endif
4655
#endif
4756

4857
/**
@@ -53,7 +62,11 @@
5362
* {MAJOR_VERSION}.0d{MINOR_VERSION}
5463
*/
5564
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
56-
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.1" // Can't be removed, needed for OTA file generation.
65+
#ifndef OTA_TEST_IMAGE
66+
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.2-0.1.5"
67+
#else
68+
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.2-0.1.6"
69+
#endif
5770
#endif
5871

5972
/**

examples/light-switch-app/qpg/include/SwitchManager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ class SwitchManager
5454
};
5555

5656
void Init(void);
57-
static void GenericSwitchInitialPress(void);
58-
static void GenericSwitchReleasePress(void);
57+
static void GenericSwitchInitialPressHandler(AppEvent * aEvent);
58+
static void GenericSwitchReleasePressHandler(AppEvent * aEvent);
5959
static void ToggleHandler(AppEvent * aEvent);
6060
static void LevelHandler(AppEvent * aEvent);
6161
static void ColorHandler(AppEvent * aEvent);

examples/light-switch-app/qpg/src/AppTask.cpp

+10-6
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,13 @@ void AppTask::ButtonEventHandler(uint8_t btnIdx, bool btnPressed)
297297
case APP_FUNCTION2_SWITCH: {
298298
if (!btnPressed)
299299
{
300-
ChipLogProgress(NotSpecified, "Switch initial press");
301-
SwitchMgr().GenericSwitchInitialPress();
300+
ChipLogProgress(NotSpecified, "Switch release press");
301+
button_event.Handler = SwitchMgr().GenericSwitchReleasePressHandler;
302302
}
303303
else
304304
{
305-
ChipLogProgress(NotSpecified, "Switch release press");
306-
SwitchMgr().GenericSwitchReleasePress();
305+
ChipLogProgress(NotSpecified, "Switch initial press");
306+
button_event.Handler = SwitchMgr().GenericSwitchInitialPressHandler;
307307
}
308308
break;
309309
}
@@ -516,11 +516,15 @@ void AppTask::UpdateLEDs(void)
516516
// If the system has ble connection(s) uptill the stage above, THEN blink
517517
// the LEDs at an even rate of 100ms.
518518
//
519-
// Otherwise, blink the LED ON for a very short time.
519+
// Otherwise, turn the LED OFF.
520520
if (sIsThreadProvisioned && sIsThreadEnabled)
521521
{
522522
qvIO_LedSet(SYSTEM_STATE_LED, true);
523523
}
524+
else if (sIsThreadProvisioned && !sIsThreadEnabled)
525+
{
526+
qvIO_LedBlink(SYSTEM_STATE_LED, 950, 50);
527+
}
524528
else if (sHaveBLEConnections)
525529
{
526530
qvIO_LedBlink(SYSTEM_STATE_LED, 100, 100);
@@ -532,7 +536,7 @@ void AppTask::UpdateLEDs(void)
532536
else
533537
{
534538
// not commissioned yet
535-
qvIO_LedBlink(SYSTEM_STATE_LED, 50, 950);
539+
qvIO_LedSet(SYSTEM_STATE_LED, false);
536540
}
537541
}
538542

examples/light-switch-app/qpg/src/SwitchManager.cpp

+26-6
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,40 @@ void SwitchManager::ColorHandler(AppEvent * aEvent)
107107
DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast<intptr_t>(data));
108108
}
109109

110-
void SwitchManager::GenericSwitchInitialPress(void)
110+
void SwitchManager::GenericSwitchInitialPressHandler(AppEvent * aEvent)
111111
{
112112
// Press moves Position from 0 (idle) to 1 (press)
113113
uint8_t newPosition = 1;
114114

115-
SystemLayer().ScheduleLambda(
116-
[newPosition] { chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition); });
115+
if (aEvent->Type != AppEvent::kEventType_Button)
116+
{
117+
ChipLogError(NotSpecified, "Event type not supported!");
118+
return;
119+
}
120+
121+
ChipLogProgress(NotSpecified, "GenericSwitchInitialPress new position %d", newPosition);
122+
SystemLayer().ScheduleLambda([newPosition] {
123+
chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition);
124+
// InitialPress event takes newPosition as event data
125+
chip::app::Clusters::SwitchServer::Instance().OnInitialPress(GENERICSWITCH_ENDPOINT_ID, newPosition);
126+
});
117127
}
118128

119-
void SwitchManager::GenericSwitchReleasePress(void)
129+
void SwitchManager::GenericSwitchReleasePressHandler(AppEvent * aEvent)
120130
{
121131
// Release moves Position from 1 (press) to 0
122132
uint8_t newPosition = 0;
123133

124-
SystemLayer().ScheduleLambda(
125-
[newPosition] { chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition); });
134+
if (aEvent->Type != AppEvent::kEventType_Button)
135+
{
136+
ChipLogError(NotSpecified, "Event type not supported!");
137+
return;
138+
}
139+
140+
ChipLogProgress(NotSpecified, "GenericSwitchReleasePress new position %d", newPosition);
141+
SystemLayer().ScheduleLambda([newPosition] {
142+
chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition);
143+
// Short Release event takes newPosition as event data
144+
chip::app::Clusters::SwitchServer::Instance().OnShortRelease(GENERICSWITCH_ENDPOINT_ID, newPosition);
145+
});
126146
}

examples/light-switch-app/qpg/zap/switch.matter

+9-3
Original file line numberDiff line numberDiff line change
@@ -2404,6 +2404,8 @@ endpoint 0 {
24042404
ram attribute lastNetworkingStatus;
24052405
ram attribute lastNetworkID;
24062406
ram attribute lastConnectErrorValue;
2407+
callback attribute supportedThreadFeatures;
2408+
callback attribute threadVersion;
24072409
callback attribute generatedCommandList;
24082410
callback attribute acceptedCommandList;
24092411
callback attribute eventList;
@@ -2441,19 +2443,21 @@ endpoint 0 {
24412443
callback attribute networkInterfaces;
24422444
callback attribute rebootCount;
24432445
callback attribute upTime;
2446+
callback attribute totalOperationalHours;
24442447
callback attribute bootReason;
24452448
callback attribute activeHardwareFaults;
24462449
callback attribute activeRadioFaults;
24472450
callback attribute activeNetworkFaults;
2448-
ram attribute testEventTriggersEnabled default = 0;
2451+
callback attribute testEventTriggersEnabled default = false;
24492452
callback attribute generatedCommandList;
24502453
callback attribute acceptedCommandList;
2451-
callback attribute eventList;
24522454
callback attribute attributeList;
24532455
callback attribute featureMap;
24542456
callback attribute clusterRevision;
24552457

24562458
handle command TestEventTrigger;
2459+
handle command TimeSnapshot;
2460+
handle command TimeSnapshotResponse;
24572461
}
24582462

24592463
server cluster SoftwareDiagnostics {
@@ -2729,13 +2733,15 @@ endpoint 2 {
27292733
}
27302734

27312735
server cluster Switch {
2736+
emits event InitialPress;
2737+
emits event ShortRelease;
27322738
ram attribute numberOfPositions default = 2;
27332739
ram attribute currentPosition default = 0;
27342740
callback attribute generatedCommandList;
27352741
callback attribute acceptedCommandList;
27362742
callback attribute eventList;
27372743
callback attribute attributeList;
2738-
ram attribute featureMap default = 1;
2744+
ram attribute featureMap default = 6;
27392745
ram attribute clusterRevision default = 1;
27402746
}
27412747
}

0 commit comments

Comments
 (0)