Enhance DaliDT8: add RGBWAF control modes and methods for temporary color scene storage
Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
+27
@@ -240,6 +240,18 @@ bool DaliDT8::setTemporaryWAFDimLevels(int a, int w, int amber, int freecolour)
|
||||
base_.dtSelect(8) && base_.sendExtCmd(addr, DALI_CMD_DT8_SET_TEMPORARY_WAF_DIM_LEVELS);
|
||||
}
|
||||
|
||||
int DaliDT8::rgbwafControlValue(bool red, bool green, bool blue, bool white, bool amber,
|
||||
bool freecolour, Dt8RgbwafControlMode mode) {
|
||||
int value = static_cast<int>(mode) << 6;
|
||||
if (red) value |= 0x01;
|
||||
if (green) value |= 0x02;
|
||||
if (blue) value |= 0x04;
|
||||
if (white) value |= 0x08;
|
||||
if (amber) value |= 0x10;
|
||||
if (freecolour) value |= 0x20;
|
||||
return value & 0xFF;
|
||||
}
|
||||
|
||||
bool DaliDT8::setTemporaryRGBWAFControl(int a, int control) {
|
||||
const int storedControl = std::clamp(control, 0, 254);
|
||||
const int addr = a * 2 + 1;
|
||||
@@ -247,6 +259,13 @@ bool DaliDT8::setTemporaryRGBWAFControl(int a, int control) {
|
||||
base_.sendExtCmd(addr, DALI_CMD_DT8_SET_TEMPORARY_RGBWAF_CONTROL);
|
||||
}
|
||||
|
||||
bool DaliDT8::setTemporaryRGBWAFChannelControl(int a, bool red, bool green, bool blue,
|
||||
bool white, bool amber, bool freecolour,
|
||||
Dt8RgbwafControlMode mode) {
|
||||
return setTemporaryRGBWAFControl(
|
||||
a, rgbwafControlValue(red, green, blue, white, amber, freecolour, mode));
|
||||
}
|
||||
|
||||
bool DaliDT8::setTemporaryRGBWAFDimLevels(int a, int r, int g, int b, int w, int amber,
|
||||
int freecolour, int control) {
|
||||
return setTemporaryRGBDimLevels(a, r, g, b) && setTemporaryWAFDimLevels(a, w, amber, freecolour) &&
|
||||
@@ -456,6 +475,14 @@ bool DaliDT8::storeSceneSnapshot(int address, int scene, int brightness,
|
||||
return base_.dtSelect(8) && base_.storeDTRAsSceneBright(address, sceneIndex);
|
||||
}
|
||||
|
||||
bool DaliDT8::storeCurrentTemporaryColourAsScene(int address, int scene, int brightness) {
|
||||
const int sceneBrightness = std::clamp(brightness, 0, 255);
|
||||
const int sceneIndex = std::clamp(scene, 0, 15);
|
||||
if (!base_.setDTR(sceneBrightness)) return false;
|
||||
// DT SELECT is one-shot and SET DTR consumes any earlier selection.
|
||||
return base_.dtSelect(8) && base_.storeDTRAsSceneBright(address, sceneIndex);
|
||||
}
|
||||
|
||||
bool DaliDT8::storePowerOnLevelSnapshot(int address, int level) {
|
||||
const int storedLevel = std::clamp(level, 0, 254);
|
||||
// DT SELECT is one-shot and SET DTR consumes any earlier selection.
|
||||
|
||||
Reference in New Issue
Block a user