Actually store all start-up settings in nvram now, and do so periodically!
parent
fe8ce643b4
commit
4eb4af8eb6
|
@ -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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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},
|
||||||
|
|
|
@ -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 (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();
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue