Enhance DaliDT8 and Bridge: add support for RGBW, RGBCW, and RGBWAF operations, including temporary dim levels and control handling

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-06-01 03:06:25 +08:00
parent f18f7570ed
commit d1cc27ae2a
5 changed files with 166 additions and 2 deletions
+4
View File
@@ -117,6 +117,10 @@ enum class BridgeOperation {
dt1GetRatedDuration = 77,
dt1GetExtendedVersion = 78,
dt1GetEmergencyDeviceType = 79,
setColourRGBW = 80,
setColourRGBCW = 81,
setColourRGBWAF = 82,
setTemporaryRGBWAFDimLevels = 83,
};
enum class BridgeValueEncoding {
+17
View File
@@ -60,10 +60,13 @@ struct SceneColorReport {
int colorTypeValue = 0;
std::vector<double> xy;
std::optional<int> colorTemperature;
std::vector<int> rgbwaf;
std::optional<int> rgbwafControl;
ColorType colorType() const { return ColorType(colorTypeValue); }
bool hasXy() const { return xy.size() == 2; }
bool hasColorTemperature() const { return colorTemperature.has_value(); }
bool hasRgbwaf() const { return rgbwaf.size() == 6; }
};
struct Dt8LevelColorReport {
@@ -71,16 +74,21 @@ struct Dt8LevelColorReport {
int colorTypeValue = 0;
std::vector<double> xy;
std::optional<int> colorTemperature;
std::vector<int> rgbwaf;
std::optional<int> rgbwafControl;
ColorType colorType() const { return ColorType(colorTypeValue); }
bool hasXy() const { return xy.size() == 2; }
bool hasColorTemperature() const { return colorTemperature.has_value(); }
bool hasRgbwaf() const { return rgbwaf.size() == 6; }
};
enum class Dt8SceneStoreColorMode {
disabled,
colorTemperature,
rgb,
rgbw,
rgbcw,
};
class DaliDT8 {
@@ -113,6 +121,8 @@ class DaliDT8 {
bool setTemporaryRGBDimLevels(int a, int r, int g, int b);
bool setTemporaryWAFDimLevels(int a, int w, int amber, int freecolour);
bool setTemporaryRGBWAFControl(int a, int control);
bool setTemporaryRGBWAFDimLevels(int a, int r, int g, int b, int w, int amber,
int freecolour, int control);
bool setTemporaryColourMask(int a);
bool copyReportToTemporary(int a);
@@ -129,6 +139,10 @@ class DaliDT8 {
std::optional<int> getColourRaw(int a, int type);
std::vector<double> getColour(int a);
bool setColourRGB(int addr, int r, int g, int b);
bool setColourRGBW(int addr, int r, int g, int b, int w);
bool setColourRGBCW(int addr, int r, int g, int b, int coolWhite, int warmWhite);
bool setColourRGBWAF(int addr, int r, int g, int b, int w, int amber, int freecolour,
int control = -1);
std::vector<int> getColourRGB(int a);
bool activateTemporaryColour(int a);
@@ -189,6 +203,8 @@ class DaliDT8 {
bool storeSceneSnapshot(int address, int scene, int brightness,
Dt8SceneStoreColorMode colorMode = Dt8SceneStoreColorMode::disabled,
int colorTemperature = 0, int red = 0, int green = 0, int blue = 0,
int white = 0, int amber = 0, int freecolour = 255,
int rgbwafControl = -1,
int gateway = -1);
bool storePowerOnLevelSnapshot(int address, int level);
bool storeSystemFailureLevelSnapshot(int address, int level);
@@ -208,6 +224,7 @@ class DaliDT8 {
private:
std::optional<Dt8LevelColorReport> buildLevelColorReport(int a, std::optional<int> level);
std::vector<int> getReportRGBWAF(int a);
DaliBase& base_;
};