Compare commits
2 Commits
bb21973042
...
4eb4af8eb6
Author | SHA1 | Date |
---|---|---|
MartB | 4eb4af8eb6 | |
MartB | fe8ce643b4 |
|
@ -241,9 +241,7 @@ void app_task(void)
|
|||
|
||||
report_handler();
|
||||
|
||||
#if 0 /* NOTE: If set to '1', the latest status of lighting will be stored. */
|
||||
sampleLightAttrsChk();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -290,8 +290,8 @@ const zclAttrInfo_t lightColorCtrl_attrTbl[] =
|
|||
{ZCL_ATTRID_ENHANCED_COLOR_MODE, ZCL_DATA_TYPE_ENUM8, ACCESS_CONTROL_READ, (u8 *)&g_zcl_colorCtrlAttrs.enhancedColorMode},
|
||||
{ZCL_ATTRID_COLOR_CAPABILITIES, ZCL_DATA_TYPE_BITMAP16, ACCESS_CONTROL_READ, (u8 *)&g_zcl_colorCtrlAttrs.colorCapabilities},
|
||||
{ZCL_ATTRID_NUMBER_OF_PRIMARIES, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ, (u8 *)&g_zcl_colorCtrlAttrs.numOfPrimaries},
|
||||
{ZCL_ATTRID_CURRENT_X, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ, (u16 *)&g_zcl_colorCtrlAttrs.currentX},
|
||||
{ZCL_ATTRID_CURRENT_Y, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ, (u16 *)&g_zcl_colorCtrlAttrs.currentY},
|
||||
{ZCL_ATTRID_CURRENT_X, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ | ACCESS_CONTROL_REPORTABLE, (u16 *)&g_zcl_colorCtrlAttrs.currentX},
|
||||
{ZCL_ATTRID_CURRENT_Y, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ | ACCESS_CONTROL_REPORTABLE, (u16 *)&g_zcl_colorCtrlAttrs.currentY},
|
||||
{ZCL_ATTRID_CURRENT_HUE, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ | ACCESS_CONTROL_REPORTABLE, (u8 *)&g_zcl_colorCtrlAttrs.currentHue},
|
||||
{ZCL_ATTRID_ENHANCED_CURRENT_HUE, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ, (u16 *)&g_zcl_colorCtrlAttrs.enhancedCurrentHue},
|
||||
{ZCL_ATTRID_CURRENT_SATURATION, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ | ACCESS_CONTROL_REPORTABLE, (u8 *)&g_zcl_colorCtrlAttrs.currentSaturation},
|
||||
|
|
|
@ -148,17 +148,31 @@ static void sampleLight_zclReadRspCmd(zclReadRspCmd_t *pReadRspCmd)
|
|||
*/
|
||||
static void sampleLight_zclWriteReqCmd(u16 clusterId, zclWriteCmd_t *pWriteReqCmd)
|
||||
{
|
||||
// Check if we got the right clusters, if not return early
|
||||
if (clusterId != ZCL_CLUSTER_GEN_ON_OFF && clusterId != ZCL_CLUSTER_GEN_LEVEL_CONTROL && clusterId != ZCL_CLUSTER_LIGHTING_COLOR_CONTROL) {
|
||||
return;
|
||||
}
|
||||
|
||||
u8 numAttr = pWriteReqCmd->numAttr;
|
||||
zclWriteRec_t *attr = pWriteReqCmd->attrList;
|
||||
|
||||
if (clusterId == ZCL_CLUSTER_GEN_ON_OFF)
|
||||
{
|
||||
// This iterates over the attributes and double checks the attributes are set correctly, so we dont violate the spec.
|
||||
for (u8 i = 0; i < numAttr; i++)
|
||||
{
|
||||
if (attr[i].attrID == ZCL_ATTRID_START_UP_ONOFF)
|
||||
if (clusterId == ZCL_CLUSTER_GEN_ON_OFF && attr[i].attrID == ZCL_ATTRID_START_UP_ONOFF)
|
||||
{
|
||||
zcl_onOffAttr_save();
|
||||
break;
|
||||
}
|
||||
else if (clusterId == ZCL_CLUSTER_LIGHTING_COLOR_CONTROL && attr[i].attrID == ZCL_ATTRID_START_UP_COLOR_TEMPERATURE_MIREDS)
|
||||
{
|
||||
zcl_colorCtrlAttr_save();
|
||||
break;
|
||||
}
|
||||
else if (clusterId == ZCL_CLUSTER_GEN_LEVEL_CONTROL && attr[i].attrID == ZCL_ATTRID_LEVEL_START_UP_CURRENT_LEVEL)
|
||||
{
|
||||
zcl_levelAttr_save();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ static void sampleLight_sceneRecallReqHandler(zclIncomingAddrInfo_t *pAddrInfo,
|
|||
#endif
|
||||
|
||||
#ifdef ZCL_LIGHT_COLOR_CONTROL
|
||||
if (colorMode == ZCL_COLOR_MODE_CURRENT_HUE_SATURATION)
|
||||
if (colorMode == ZCL_COLOR_MODE_COLOR_TEMPERATURE_MIREDS)
|
||||
{
|
||||
zcl_colorCtrlMoveToColorTemperatureCmd_t move2ColorTemp;
|
||||
move2ColorTemp.colorTemperature = colorTemperatureMireds;
|
||||
|
|
Loading…
Reference in New Issue