Skip to content

Commit e22266b

Browse files
Apply ColorTempPhysicalMaxMireds when ColorTemperatureMaximumMireds f… (#33983)
* Apply ColorTempPhysicalMaxMireds when ColorTemperatureMaximumMireds field is 0. Add tests * Restyled by whitespace * Restyled by prettier-yaml * Change wait time to 1 sec as rate is calculated in step per second * Add code comment, fix typo in test command --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent dacf560 commit e22266b

File tree

3 files changed

+175
-2
lines changed

3 files changed

+175
-2
lines changed

src/app/clusters/color-control-server/color-control-server.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -2693,11 +2693,16 @@ bool ColorControlServer::moveColorTempCommand(app::CommandHandler * commandObj,
26932693
return true;
26942694
}
26952695

2696+
// Per spec, colorTemperatureMinimumMireds field is limited to ColorTempPhysicalMinMireds and
2697+
// when colorTemperatureMinimumMireds field is 0, ColorTempPhysicalMinMireds shall be used (always >= to 0)
26962698
if (colorTemperatureMinimum < tempPhysicalMin)
26972699
{
26982700
colorTemperatureMinimum = tempPhysicalMin;
26992701
}
2700-
if (colorTemperatureMaximum > tempPhysicalMax)
2702+
2703+
// Per spec, colorTemperatureMaximumMireds field is limited to ColorTempPhysicalMaxMireds and
2704+
// when colorTemperatureMaximumMireds field is 0, ColorTempPhysicalMaxMireds shall be used
2705+
if ((colorTemperatureMaximum == 0) || (colorTemperatureMaximum > tempPhysicalMax))
27012706
{
27022707
colorTemperatureMaximum = tempPhysicalMax;
27032708
}
@@ -2804,11 +2809,16 @@ bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj,
28042809
Attributes::ColorTempPhysicalMinMireds::Get(endpoint, &tempPhysicalMin);
28052810
Attributes::ColorTempPhysicalMaxMireds::Get(endpoint, &tempPhysicalMax);
28062811

2812+
// Per spec, colorTemperatureMinimumMireds field is limited to ColorTempPhysicalMinMireds and
2813+
// when colorTemperatureMinimumMireds field is 0, ColorTempPhysicalMinMireds shall be used (always >= to 0)
28072814
if (colorTemperatureMinimum < tempPhysicalMin)
28082815
{
28092816
colorTemperatureMinimum = tempPhysicalMin;
28102817
}
2811-
if (colorTemperatureMaximum > tempPhysicalMax)
2818+
2819+
// Per spec, colorTemperatureMaximumMireds field is limited to ColorTempPhysicalMaxMireds and
2820+
// when colorTemperatureMaximumMireds field is 0, ColorTempPhysicalMaxMireds shall be used
2821+
if ((colorTemperatureMaximum == 0) || (colorTemperatureMaximum > tempPhysicalMax))
28122822
{
28132823
colorTemperatureMaximum = tempPhysicalMax;
28142824
}

src/app/tests/suites/certification/Test_TC_CC_6_2.yaml

+79
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,85 @@ tests:
364364
constraints:
365365
minValue: 0
366366
maxValue: 3
367+
- label:
368+
"Step 6a: TH sends MoveColorTemperature command to DUT with MoveMode =
369+
0x03(down), Rate = 65535 (max value) with
370+
ColorTemperatureMinimumMireds of 0"
371+
PICS: CC.S.F04 && CC.S.C4b.Rsp
372+
command: MoveColorTemperature
373+
arguments:
374+
values:
375+
- name: "MoveMode"
376+
value: 3
377+
- name: "Rate"
378+
value: 65535
379+
- name: "ColorTemperatureMinimumMireds"
380+
value: 0
381+
- name: "ColorTemperatureMaximumMireds"
382+
value: ColorTempPhysicalMaxMiredsValue
383+
- name: "OptionsMask"
384+
value: 0
385+
- name: "OptionsOverride"
386+
value: 0
387+
388+
- label: "Wait 1s"
389+
PICS: CC.S.F04
390+
cluster: "DelayCommands"
391+
command: "WaitForMs"
392+
arguments:
393+
values:
394+
- name: "ms"
395+
value: 1000
396+
397+
- label: "Step 6b: TH reads ColorTemperatureMireds attribute from DUT."
398+
PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp
399+
command: "readAttribute"
400+
attribute: "ColorTemperatureMireds"
401+
response:
402+
value: ColorTempPhysicalMinMiredsValue
403+
constraints:
404+
minValue: ColorTempPhysicalMinMiredsValue
405+
maxValue: ColorTempPhysicalMaxMiredsValue
406+
407+
- label:
408+
"Step 7a: TH sends MoveColorTemperature command to DUT with MoveMode =
409+
0x01(up), Rate = 65535 (max value) with ColorTemperatureMaximumMireds
410+
of 0"
411+
PICS: CC.S.F04 && CC.S.C4b.Rsp
412+
command: MoveColorTemperature
413+
arguments:
414+
values:
415+
- name: "MoveMode"
416+
value: 1
417+
- name: "Rate"
418+
value: 65535
419+
- name: "ColorTemperatureMinimumMireds"
420+
value: ColorTempPhysicalMinMiredsValue
421+
- name: "ColorTemperatureMaximumMireds"
422+
value: 0
423+
- name: "OptionsMask"
424+
value: 0
425+
- name: "OptionsOverride"
426+
value: 0
427+
428+
- label: "Wait 1s"
429+
PICS: CC.S.F04
430+
cluster: "DelayCommands"
431+
command: "WaitForMs"
432+
arguments:
433+
values:
434+
- name: "ms"
435+
value: 1000
436+
437+
- label: "Step 7b: TH reads ColorTemperatureMireds attribute from DUT."
438+
PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp
439+
command: "readAttribute"
440+
attribute: "ColorTemperatureMireds"
441+
response:
442+
value: ColorTempPhysicalMaxMiredsValue
443+
constraints:
444+
minValue: ColorTempPhysicalMinMiredsValue
445+
maxValue: ColorTempPhysicalMaxMiredsValue
367446

368447
- label: "Turn off light that we turned on"
369448
PICS: OO.S.C00.Rsp

src/app/tests/suites/certification/Test_TC_CC_6_3.yaml

+84
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,90 @@ tests:
287287
minValue: 0
288288
maxValue: 3
289289

290+
- label:
291+
"Step 5a: TH sends StepColorTemperature command to DUT with StepMode =
292+
0x01 (up), StepSize = ColorTempPhysicalMaxMireds and TransitionTime =
293+
0 (instant)."
294+
PICS: CC.S.F04 && CC.S.C4c.Rsp
295+
command: "StepColorTemperature"
296+
arguments:
297+
values:
298+
- name: "StepMode"
299+
value: 1
300+
- name: "StepSize"
301+
value: ColorTempPhysicalMaxMiredsValue
302+
- name: "ColorTemperatureMinimumMireds"
303+
value: ColorTempPhysicalMinMiredsValue
304+
- name: "ColorTemperatureMaximumMireds"
305+
value: 0
306+
- name: "TransitionTime"
307+
value: 0
308+
- name: "OptionsMask"
309+
value: 0
310+
- name: "OptionsOverride"
311+
value: 0
312+
313+
- label: "Wait 100ms"
314+
PICS: CC.S.F04
315+
cluster: "DelayCommands"
316+
command: "WaitForMs"
317+
arguments:
318+
values:
319+
- name: "ms"
320+
value: 100
321+
322+
- label: "Step 5b: TH reads ColorTemperatureMireds attribute from DUT."
323+
PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp
324+
command: "readAttribute"
325+
attribute: "ColorTemperatureMireds"
326+
response:
327+
value: ColorTempPhysicalMaxMiredsValue
328+
constraints:
329+
minValue: ColorTempPhysicalMinMiredsValue
330+
maxValue: ColorTempPhysicalMaxMiredsValue
331+
332+
- label:
333+
"Step 6a: TH sends StepColorTemperature command to DUT with StepMode =
334+
0x03 (down), StepSize = ColorTempPhysicalMaxMireds and TransitionTime
335+
= 0 (instant)."
336+
PICS: CC.S.F04 && CC.S.C4c.Rsp
337+
command: "StepColorTemperature"
338+
arguments:
339+
values:
340+
- name: "StepMode"
341+
value: 3
342+
- name: "StepSize"
343+
value: ColorTempPhysicalMaxMiredsValue
344+
- name: "ColorTemperatureMinimumMireds"
345+
value: 0
346+
- name: "ColorTemperatureMaximumMireds"
347+
value: ColorTempPhysicalMaxMiredsValue
348+
- name: "TransitionTime"
349+
value: 0
350+
- name: "OptionsMask"
351+
value: 0
352+
- name: "OptionsOverride"
353+
value: 0
354+
355+
- label: "Wait 100ms"
356+
PICS: CC.S.F04
357+
cluster: "DelayCommands"
358+
command: "WaitForMs"
359+
arguments:
360+
values:
361+
- name: "ms"
362+
value: 100
363+
364+
- label: "Step 6b: TH reads ColorTemperatureMireds attribute from DUT."
365+
PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp
366+
command: "readAttribute"
367+
attribute: "ColorTemperatureMireds"
368+
response:
369+
value: ColorTempPhysicalMinMiredsValue
370+
constraints:
371+
minValue: ColorTempPhysicalMinMiredsValue
372+
maxValue: ColorTempPhysicalMaxMiredsValue
373+
290374
- label: "Turn Off light that we turned on"
291375
PICS: OO.S.C00.Rsp
292376
cluster: "On/Off"

0 commit comments

Comments
 (0)