I made the below code for setting CCT in DALI DT8 drivers as per the discussion on DALI 209 - Device Type 8 - CCT control and DALI DT6-DT8 Sending commands above 255 The DTR setting is working perfectly and I can read back the DTR value using query commands but the CCT is not setting at all.
CODE:
void Dali::setCCT(uint8_t id, long kelvin)
{
if (id < 64 && kelvin <= 6500 && kelvin >= 2000)
{
uint8_t val1 = (1000000 / kelvin) / 256;
uint8_t val2 = (1000000 / kelvin) - (val1 * 256);
dali.setDTR0(val1); ///set val1 as DTR0
delay(10);
dali.setDTR1(val2); ///set val2 as DTR1
delay(10);
dali.enabledt8(); ///enable DT8
delay(10);
dali.transmit((id * 2) + 1, 231); ///set temp color temperature
}
}
I checked all the available documents and even tried sending the command twice (since some of the commands should be sent twice) but no result.
what am I doing wrong here?