@@ -2671,37 +2671,30 @@ void ColorControlServer::startUpColorTempCommand(EndpointId endpoint)
2671
2671
2672
2672
if (status == Status::Success && !startUpColorTemp.IsNull ())
2673
2673
{
2674
- uint16_t updatedColorTemp = MAX_TEMPERATURE_VALUE ;
2675
- status = Attributes::ColorTemperatureMireds ::Get (endpoint, &updatedColorTemp );
2674
+ uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE ;
2675
+ Attributes::ColorTempPhysicalMinMireds ::Get (endpoint, &tempPhysicalMin );
2676
2676
2677
- if (status == Status::Success)
2678
- {
2679
- uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE;
2680
- Attributes::ColorTempPhysicalMinMireds::Get (endpoint, &tempPhysicalMin);
2677
+ uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE;
2678
+ Attributes::ColorTempPhysicalMaxMireds::Get (endpoint, &tempPhysicalMax);
2681
2679
2682
- uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE;
2683
- Attributes::ColorTempPhysicalMaxMireds::Get (endpoint, &tempPhysicalMax);
2680
+ if (tempPhysicalMin <= startUpColorTemp.Value () && startUpColorTemp.Value () <= tempPhysicalMax)
2681
+ {
2682
+ // Apply valid startup color temp value that is within physical limits of device.
2683
+ // Otherwise, the startup value is outside the device's supported range, and the
2684
+ // existing setting of ColorTemp attribute will be left unchanged (i.e., treated as
2685
+ // if startup color temp was set to null).
2686
+ uint16_t epIndex = getEndpointIndex (endpoint);
2687
+ MarkAttributeDirty markDirty = SetQuietReportAttribute (quietTemperatureMireds[epIndex], startUpColorTemp.Value (),
2688
+ false /* isEndOfTransition */ , 0 );
2689
+ status = Attributes::ColorTemperatureMireds::Set (endpoint, quietTemperatureMireds[epIndex].value ().Value (), markDirty);
2684
2690
2685
- if (tempPhysicalMin <= startUpColorTemp. Value () && startUpColorTemp. Value () <= tempPhysicalMax )
2691
+ if (status == Status::Success )
2686
2692
{
2687
- // Apply valid startup color temp value that is within physical limits of device.
2688
- // Otherwise, the startup value is outside the device's supported range, and the
2689
- // existing setting of ColorTemp attribute will be left unchanged (i.e., treated as
2690
- // if startup color temp was set to null).
2691
- uint16_t epIndex = getEndpointIndex (endpoint);
2692
- MarkAttributeDirty markDirty =
2693
- SetQuietReportAttribute (quietTemperatureMireds[epIndex], updatedColorTemp, false /* isEndOfTransition */ , 0 );
2694
- status =
2695
- Attributes::ColorTemperatureMireds::Set (endpoint, quietTemperatureMireds[epIndex].value ().Value (), markDirty);
2693
+ // Set ColorMode attributes to reflect ColorTemperature.
2694
+ auto updateColorMode = ColorModeEnum::kColorTemperatureMireds ;
2695
+ Attributes::ColorMode::Set (endpoint, updateColorMode);
2696
2696
2697
- if (status == Status::Success)
2698
- {
2699
- // Set ColorMode attributes to reflect ColorTemperature.
2700
- auto updateColorMode = ColorModeEnum::kColorTemperatureMireds ;
2701
- Attributes::ColorMode::Set (endpoint, updateColorMode);
2702
-
2703
- Attributes::EnhancedColorMode::Set (endpoint, static_cast <EnhancedColorModeEnum>(updateColorMode));
2704
- }
2697
+ Attributes::EnhancedColorMode::Set (endpoint, static_cast <EnhancedColorModeEnum>(updateColorMode));
2705
2698
}
2706
2699
}
2707
2700
}
0 commit comments