Primaries are unknown, align with spec, remove reportable from color attributes.

main
MartB 2022-04-04 18:08:18 +02:00
parent 358dc29ff7
commit cde9138dcd
3 changed files with 10 additions and 22 deletions

View File

@ -384,8 +384,8 @@ float LINEAR_TO_SRGB_GAMMA_CORRECTION(const float part)
void hwLight_colorUpdate_XY2RGB(u16 xI, u16 yI, u8 level)
{
float x = xI / 65535.0f;
float y = yI / 65535.0f;
float x = xI / 65536.0f;
float y = yI / 65536.0f;
// This does not locate the closest point in the gamma spectrum of the lamps. possible #todo
const float z = 1.f - x - y;

View File

@ -265,7 +265,7 @@ zcl_lightColorCtrlAttr_t g_zcl_colorCtrlAttrs =
.colorMode = ZCL_COLOR_MODE_COLOR_TEMPERATURE_MIREDS,
.options = 0,
.enhancedColorMode = ZCL_COLOR_MODE_COLOR_TEMPERATURE_MIREDS,
.numOfPrimaries = 0,
.numOfPrimaries = 0xFF, // 0xFF is used if the primaries are unknown
.colorCapabilities = ZCL_COLOR_CAPABILITIES_BIT_COLOR_TEMPERATURE | ZCL_COLOR_CAPABILITIES_BIT_X_Y_ATTRIBUTES | ZCL_COLOR_CAPABILITIES_BIT_HUE_SATURATION,
.currentHue = 0x00,
.currentSaturation = 0x00,
@ -290,11 +290,11 @@ 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 | ACCESS_CONTROL_REPORTABLE, (u8 *)&g_zcl_colorCtrlAttrs.currentX},
{ZCL_ATTRID_CURRENT_Y, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ | ACCESS_CONTROL_REPORTABLE, (u8 *)&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_X, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ, (u8 *)&g_zcl_colorCtrlAttrs.currentX},
{ZCL_ATTRID_CURRENT_Y, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ, (u8 *)&g_zcl_colorCtrlAttrs.currentY},
{ZCL_ATTRID_CURRENT_HUE, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ, (u8 *)&g_zcl_colorCtrlAttrs.currentHue},
{ZCL_ATTRID_ENHANCED_CURRENT_HUE, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ, (u8 *)&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, (u8 *)&g_zcl_colorCtrlAttrs.currentSaturation},
{ZCL_ATTRID_COLOR_LOOP_ACTIVE, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ | ACCESS_CONTROL_REPORTABLE, (u8 *)&g_zcl_colorCtrlAttrs.colorLoopActive},
{ZCL_ATTRID_COLOR_LOOP_DIRECTION, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ | ACCESS_CONTROL_REPORTABLE, (u8 *)&g_zcl_colorCtrlAttrs.colorLoopDirection},
{ZCL_ATTRID_COLOR_LOOP_TIME, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ | ACCESS_CONTROL_REPORTABLE, (u8 *)&g_zcl_colorCtrlAttrs.colorLoopTime},

View File

@ -186,15 +186,11 @@ static void sampleLight_moveToLevelProcess(u8 cmdId, moveToLvl_t *cmd)
}
}
sampleLight_LevelTimerStop();
if (pLevel->remainingTime)
{
sampleLight_LevelTimerStop();
levelTimerEvt = TL_ZB_TIMER_SCHEDULE(sampleLight_levelTimerEvtCb, NULL, ZCL_LEVEL_CHANGE_INTERVAL);
}
else
{
sampleLight_LevelTimerStop();
}
}
/*********************************************************************
@ -255,15 +251,11 @@ static void sampleLight_moveProcess(u8 cmdId, move_t *cmd)
}
}
sampleLight_LevelTimerStop();
if (pLevel->remainingTime)
{
sampleLight_LevelTimerStop();
levelTimerEvt = TL_ZB_TIMER_SCHEDULE(sampleLight_levelTimerEvtCb, NULL, ZCL_LEVEL_CHANGE_INTERVAL);
}
else
{
sampleLight_LevelTimerStop();
}
}
/*********************************************************************
@ -309,15 +301,11 @@ static void sampleLight_stepProcess(u8 cmdId, step_t *cmd)
}
}
sampleLight_LevelTimerStop();
if (pLevel->remainingTime)
{
sampleLight_LevelTimerStop();
levelTimerEvt = TL_ZB_TIMER_SCHEDULE(sampleLight_levelTimerEvtCb, NULL, ZCL_LEVEL_CHANGE_INTERVAL);
}
else
{
sampleLight_LevelTimerStop();
}
}
/*********************************************************************