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

Apply ColorTempPhysicalMaxMireds when ColorTemperatureMaximumMireds f… #33983

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/app/clusters/color-control-server/color-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2693,11 +2693,16 @@ 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;
}
if (colorTemperatureMaximum > tempPhysicalMax)

// 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;
}
Expand Down Expand Up @@ -2804,11 +2809,16 @@ 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;
}
if (colorTemperatureMaximum > tempPhysicalMax)

// 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;
}
Expand Down
79 changes: 79 additions & 0 deletions src/app/tests/suites/certification/Test_TC_CC_6_2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,85 @@ 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: 3
- name: "Rate"
value: 65535
- name: "ColorTemperatureMinimumMireds"
value: 0
- name: "ColorTemperatureMaximumMireds"
value: ColorTempPhysicalMaxMiredsValue
- name: "OptionsMask"
value: 0
- name: "OptionsOverride"
value: 0

- label: "Wait 1s"
PICS: CC.S.F04
cluster: "DelayCommands"
command: "WaitForMs"
arguments:
values:
- name: "ms"
value: 1000

- 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 1s"
PICS: CC.S.F04
cluster: "DelayCommands"
command: "WaitForMs"
arguments:
values:
- name: "ms"
value: 1000

- 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
Expand Down
84 changes: 84 additions & 0 deletions src/app/tests/suites/certification/Test_TC_CC_6_3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,90 @@ tests:
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
cluster: "On/Off"
Expand Down
Loading