From c1da2cdbd86c586c284731a83bc2f7664983f8e2 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Mon, 17 Jun 2024 19:19:47 -0400 Subject: [PATCH 1/5] Apply ColorTempPhysicalMaxMireds when ColorTemperatureMaximumMireds field is 0. Add tests --- .../color-control-server.cpp | 4 +- .../suites/certification/Test_TC_CC_6_2.yaml | 77 +++++++++++++++++ .../suites/certification/Test_TC_CC_6_3.yaml | 84 +++++++++++++++++++ 3 files changed, 163 insertions(+), 2 deletions(-) diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index 784bca88b85955..92aa480bbb9d2f 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -2697,7 +2697,7 @@ bool ColorControlServer::moveColorTempCommand(app::CommandHandler * commandObj, { colorTemperatureMinimum = tempPhysicalMin; } - if (colorTemperatureMaximum > tempPhysicalMax) + if ((colorTemperatureMaximum == 0) || (colorTemperatureMaximum > tempPhysicalMax)) { colorTemperatureMaximum = tempPhysicalMax; } @@ -2808,7 +2808,7 @@ bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj, { colorTemperatureMinimum = tempPhysicalMin; } - if (colorTemperatureMaximum > tempPhysicalMax) + if ((colorTemperatureMaximum == 0) || (colorTemperatureMaximum > tempPhysicalMax)) { colorTemperatureMaximum = tempPhysicalMax; } diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml index fcb4f1c7691e8c..07c54f5985d6f5 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml @@ -364,6 +364,83 @@ tests: constraints: minValue: 0 maxValue: 3 + - label: + "Step 6a: TH sends MoveColorTemperature command to DUT with MoveMode = + 0x03(down), Rate = 65535 (max value) with ColorTemperatureMinimumMireds of 0" + PICS: CC.S.F04 && CC.S.C4b.Rsp + command: MoveColorTemperature + arguments: + values: + - name: "MoveMode" + value: 1 + - name: "Rate" + value: 65535 + - name: "ColorTemperatureMinimumMireds" + value: 0 + - name: "ColorTemperatureMaximumMireds" + value: ColorTempPhysicalMaxMiredsValue + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Wait 100ms" + PICS: CC.S.F04 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: "Step 6b: TH reads ColorTemperatureMireds attribute from DUT." + PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp + command: "readAttribute" + attribute: "ColorTemperatureMireds" + response: + value: ColorTempPhysicalMinMiredsValue + constraints: + minValue: ColorTempPhysicalMinMiredsValue + maxValue: ColorTempPhysicalMaxMiredsValue + + - label: + "Step 7a: TH sends MoveColorTemperature command to DUT with MoveMode = + 0x01(up), Rate = 65535 (max value) with ColorTemperatureMaximumMireds of 0" + PICS: CC.S.F04 && CC.S.C4b.Rsp + command: MoveColorTemperature + arguments: + values: + - name: "MoveMode" + value: 1 + - name: "Rate" + value: 65535 + - name: "ColorTemperatureMinimumMireds" + value: ColorTempPhysicalMinMiredsValue + - name: "ColorTemperatureMaximumMireds" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Wait 100ms" + PICS: CC.S.F04 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: "Step 7b: TH reads ColorTemperatureMireds attribute from DUT." + PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp + command: "readAttribute" + attribute: "ColorTemperatureMireds" + response: + value: ColorTempPhysicalMaxMiredsValue + constraints: + minValue: ColorTempPhysicalMinMiredsValue + maxValue: ColorTempPhysicalMaxMiredsValue - label: "Turn off light that we turned on" PICS: OO.S.C00.Rsp diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml index 934a4a3bfc243a..8200a072841583 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml @@ -286,6 +286,90 @@ tests: constraints: minValue: 0 maxValue: 3 + + - label: + "Step 5a: TH sends StepColorTemperature command to DUT with StepMode = + 0x01 (up), StepSize = ColorTempPhysicalMaxMireds and TransitionTime = 0 (instant)." + PICS: CC.S.F04 && CC.S.C4c.Rsp + command: "StepColorTemperature" + arguments: + values: + - name: "StepMode" + value: 1 + - name: "StepSize" + value: + ColorTempPhysicalMaxMiredsValue + - name: "ColorTemperatureMinimumMireds" + value: ColorTempPhysicalMinMiredsValue + - name: "ColorTemperatureMaximumMireds" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Wait 100ms" + PICS: CC.S.F04 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: "Step 5b: TH reads ColorTemperatureMireds attribute from DUT." + PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp + command: "readAttribute" + attribute: "ColorTemperatureMireds" + response: + value: ColorTempPhysicalMaxMiredsValue + constraints: + minValue: ColorTempPhysicalMinMiredsValue + maxValue: ColorTempPhysicalMaxMiredsValue + + - label: + "Step 6a: TH sends StepColorTemperature command to DUT with StepMode = + 0x03 (down), StepSize = ColorTempPhysicalMaxMireds and TransitionTime = 0 (instant)." + PICS: CC.S.F04 && CC.S.C4c.Rsp + command: "StepColorTemperature" + arguments: + values: + - name: "StepMode" + value: 3 + - name: "StepSize" + value: + ColorTempPhysicalMaxMiredsValue + - name: "ColorTemperatureMinimumMireds" + value: 0 + - name: "ColorTemperatureMaximumMireds" + value: ColorTempPhysicalMaxMiredsValue + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Wait 100ms" + PICS: CC.S.F04 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: "Step 6b: TH reads ColorTemperatureMireds attribute from DUT." + PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp + command: "readAttribute" + attribute: "ColorTemperatureMireds" + response: + value: ColorTempPhysicalMinMiredsValue + constraints: + minValue: ColorTempPhysicalMinMiredsValue + maxValue: ColorTempPhysicalMaxMiredsValue - label: "Turn Off light that we turned on" PICS: OO.S.C00.Rsp From 09851734eec48c3cee5c526966766aa4fb5d1750 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 18 Jun 2024 11:48:56 +0000 Subject: [PATCH 2/5] Restyled by whitespace --- src/app/tests/suites/certification/Test_TC_CC_6_2.yaml | 2 +- src/app/tests/suites/certification/Test_TC_CC_6_3.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml index 07c54f5985d6f5..9e62aae1bf1932 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml @@ -402,7 +402,7 @@ tests: constraints: minValue: ColorTempPhysicalMinMiredsValue maxValue: ColorTempPhysicalMaxMiredsValue - + - label: "Step 7a: TH sends MoveColorTemperature command to DUT with MoveMode = 0x01(up), Rate = 65535 (max value) with ColorTemperatureMaximumMireds of 0" diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml index 8200a072841583..df63be18321b40 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml @@ -286,7 +286,7 @@ tests: constraints: minValue: 0 maxValue: 3 - + - label: "Step 5a: TH sends StepColorTemperature command to DUT with StepMode = 0x01 (up), StepSize = ColorTempPhysicalMaxMireds and TransitionTime = 0 (instant)." @@ -328,7 +328,7 @@ tests: constraints: minValue: ColorTempPhysicalMinMiredsValue maxValue: ColorTempPhysicalMaxMiredsValue - + - label: "Step 6a: TH sends StepColorTemperature command to DUT with StepMode = 0x03 (down), StepSize = ColorTempPhysicalMaxMireds and TransitionTime = 0 (instant)." From 8bf7c391932d3dc5ff706df9703102e4d43b28b5 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 18 Jun 2024 11:49:00 +0000 Subject: [PATCH 3/5] Restyled by prettier-yaml --- .../tests/suites/certification/Test_TC_CC_6_2.yaml | 6 ++++-- .../tests/suites/certification/Test_TC_CC_6_3.yaml | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml index 9e62aae1bf1932..2f0cfa4f7bbd94 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml @@ -366,7 +366,8 @@ tests: maxValue: 3 - label: "Step 6a: TH sends MoveColorTemperature command to DUT with MoveMode = - 0x03(down), Rate = 65535 (max value) with ColorTemperatureMinimumMireds of 0" + 0x03(down), Rate = 65535 (max value) with + ColorTemperatureMinimumMireds of 0" PICS: CC.S.F04 && CC.S.C4b.Rsp command: MoveColorTemperature arguments: @@ -405,7 +406,8 @@ tests: - label: "Step 7a: TH sends MoveColorTemperature command to DUT with MoveMode = - 0x01(up), Rate = 65535 (max value) with ColorTemperatureMaximumMireds of 0" + 0x01(up), Rate = 65535 (max value) with ColorTemperatureMaximumMireds + of 0" PICS: CC.S.F04 && CC.S.C4b.Rsp command: MoveColorTemperature arguments: diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml index df63be18321b40..437ef78af33f27 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml @@ -289,7 +289,8 @@ tests: - label: "Step 5a: TH sends StepColorTemperature command to DUT with StepMode = - 0x01 (up), StepSize = ColorTempPhysicalMaxMireds and TransitionTime = 0 (instant)." + 0x01 (up), StepSize = ColorTempPhysicalMaxMireds and TransitionTime = + 0 (instant)." PICS: CC.S.F04 && CC.S.C4c.Rsp command: "StepColorTemperature" arguments: @@ -297,8 +298,7 @@ tests: - name: "StepMode" value: 1 - name: "StepSize" - value: - ColorTempPhysicalMaxMiredsValue + value: ColorTempPhysicalMaxMiredsValue - name: "ColorTemperatureMinimumMireds" value: ColorTempPhysicalMinMiredsValue - name: "ColorTemperatureMaximumMireds" @@ -331,7 +331,8 @@ tests: - label: "Step 6a: TH sends StepColorTemperature command to DUT with StepMode = - 0x03 (down), StepSize = ColorTempPhysicalMaxMireds and TransitionTime = 0 (instant)." + 0x03 (down), StepSize = ColorTempPhysicalMaxMireds and TransitionTime + = 0 (instant)." PICS: CC.S.F04 && CC.S.C4c.Rsp command: "StepColorTemperature" arguments: @@ -339,8 +340,7 @@ tests: - name: "StepMode" value: 3 - name: "StepSize" - value: - ColorTempPhysicalMaxMiredsValue + value: ColorTempPhysicalMaxMiredsValue - name: "ColorTemperatureMinimumMireds" value: 0 - name: "ColorTemperatureMaximumMireds" From 61d0fa116afe8cddff603b49bf80b11e1d6d92d1 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Tue, 18 Jun 2024 09:53:10 -0400 Subject: [PATCH 4/5] Change wait time to 1 sec as rate is calculated in step per second --- src/app/tests/suites/certification/Test_TC_CC_6_2.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml index 2f0cfa4f7bbd94..b622fee698ba75 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml @@ -385,14 +385,14 @@ tests: - name: "OptionsOverride" value: 0 - - label: "Wait 100ms" + - label: "Wait 1s" PICS: CC.S.F04 cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 100 + value: 1000 - label: "Step 6b: TH reads ColorTemperatureMireds attribute from DUT." PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp @@ -425,14 +425,14 @@ tests: - name: "OptionsOverride" value: 0 - - label: "Wait 100ms" + - label: "Wait 1s" PICS: CC.S.F04 cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 100 + value: 1000 - label: "Step 7b: TH reads ColorTemperatureMireds attribute from DUT." PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp From 1502cd6ca4f3236d09125788ce41648a264e77b3 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Tue, 18 Jun 2024 13:30:42 -0400 Subject: [PATCH 5/5] Add code comment, fix typo in test command --- .../color-control-server/color-control-server.cpp | 10 ++++++++++ src/app/tests/suites/certification/Test_TC_CC_6_2.yaml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index 92aa480bbb9d2f..558703a8f12fce 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -2693,10 +2693,15 @@ bool ColorControlServer::moveColorTempCommand(app::CommandHandler * commandObj, return true; } + // Per spec, colorTemperatureMinimumMireds field is limited to ColorTempPhysicalMinMireds and + // when colorTemperatureMinimumMireds field is 0, ColorTempPhysicalMinMireds shall be used (always >= to 0) if (colorTemperatureMinimum < tempPhysicalMin) { colorTemperatureMinimum = tempPhysicalMin; } + + // Per spec, colorTemperatureMaximumMireds field is limited to ColorTempPhysicalMaxMireds and + // when colorTemperatureMaximumMireds field is 0, ColorTempPhysicalMaxMireds shall be used if ((colorTemperatureMaximum == 0) || (colorTemperatureMaximum > tempPhysicalMax)) { colorTemperatureMaximum = tempPhysicalMax; @@ -2804,10 +2809,15 @@ bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj, Attributes::ColorTempPhysicalMinMireds::Get(endpoint, &tempPhysicalMin); Attributes::ColorTempPhysicalMaxMireds::Get(endpoint, &tempPhysicalMax); + // Per spec, colorTemperatureMinimumMireds field is limited to ColorTempPhysicalMinMireds and + // when colorTemperatureMinimumMireds field is 0, ColorTempPhysicalMinMireds shall be used (always >= to 0) if (colorTemperatureMinimum < tempPhysicalMin) { colorTemperatureMinimum = tempPhysicalMin; } + + // Per spec, colorTemperatureMaximumMireds field is limited to ColorTempPhysicalMaxMireds and + // when colorTemperatureMaximumMireds field is 0, ColorTempPhysicalMaxMireds shall be used if ((colorTemperatureMaximum == 0) || (colorTemperatureMaximum > tempPhysicalMax)) { colorTemperatureMaximum = tempPhysicalMax; diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml index b622fee698ba75..f5259372823048 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml @@ -373,7 +373,7 @@ tests: arguments: values: - name: "MoveMode" - value: 1 + value: 3 - name: "Rate" value: 65535 - name: "ColorTemperatureMinimumMireds"