Compare commits

..

2 Commits

4 changed files with 23 additions and 11 deletions

View File

@ -241,9 +241,7 @@ void app_task(void)
report_handler(); report_handler();
#if 0 /* NOTE: If set to '1', the latest status of lighting will be stored. */
sampleLightAttrsChk(); sampleLightAttrsChk();
#endif
} }
} }

View File

@ -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_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_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_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_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, (u16 *)&g_zcl_colorCtrlAttrs.currentY}, {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_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_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}, {ZCL_ATTRID_CURRENT_SATURATION, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ | ACCESS_CONTROL_REPORTABLE, (u8 *)&g_zcl_colorCtrlAttrs.currentSaturation},

View File

@ -148,17 +148,31 @@ static void sampleLight_zclReadRspCmd(zclReadRspCmd_t *pReadRspCmd)
*/ */
static void sampleLight_zclWriteReqCmd(u16 clusterId, zclWriteCmd_t *pWriteReqCmd) 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; u8 numAttr = pWriteReqCmd->numAttr;
zclWriteRec_t *attr = pWriteReqCmd->attrList; 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++)
{ {
for (u8 i = 0; i < numAttr; i++) if (clusterId == ZCL_CLUSTER_GEN_ON_OFF && attr[i].attrID == ZCL_ATTRID_START_UP_ONOFF)
{ {
if (attr[i].attrID == ZCL_ATTRID_START_UP_ONOFF) zcl_onOffAttr_save();
{ break;
zcl_onOffAttr_save(); }
} 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;
} }
} }
} }

View File

@ -75,7 +75,7 @@ static void sampleLight_sceneRecallReqHandler(zclIncomingAddrInfo_t *pAddrInfo,
#endif #endif
#ifdef ZCL_LIGHT_COLOR_CONTROL #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; zcl_colorCtrlMoveToColorTemperatureCmd_t move2ColorTemp;
move2ColorTemp.colorTemperature = colorTemperatureMireds; move2ColorTemp.colorTemperature = colorTemperatureMireds;