Enhance DaliDT8: add support for preferred color type handling and temporary color operations

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-06-03 15:45:38 +08:00
parent d1cc27ae2a
commit 439a2078ba
2 changed files with 84 additions and 12 deletions
+15 -1
View File
@@ -91,6 +91,11 @@ enum class Dt8SceneStoreColorMode {
rgbcw,
};
enum class Dt8PreferredColorType {
xy,
rgbwaf,
};
class DaliDT8 {
public:
explicit DaliDT8(DaliBase& base);
@@ -139,6 +144,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 setTemporaryColourRGBPreferred(int addr, int r, int g, int b,
Dt8PreferredColorType preferredColorType = Dt8PreferredColorType::xy);
bool setColourRGBPreferred(int addr, int r, int g, int b,
Dt8PreferredColorType preferredColorType = Dt8PreferredColorType::xy);
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,
@@ -203,11 +212,15 @@ 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 white = 0, int amber = 0, int freecolour = 254,
int rgbwafControl = -1,
int gateway = -1);
bool storePowerOnLevelSnapshot(int address, int level);
bool storePowerOnLevelColorSnapshot(int address, int level, int r, int g, int b,
Dt8PreferredColorType preferredColorType = Dt8PreferredColorType::xy);
bool storeSystemFailureLevelSnapshot(int address, int level);
bool storeSystemFailureLevelColorSnapshot(int address, int level, int r, int g, int b,
Dt8PreferredColorType preferredColorType = Dt8PreferredColorType::xy);
std::optional<Dt8LevelColorReport> getPowerOnLevelColorReport(int a);
std::optional<Dt8LevelColorReport> getSystemFailureLevelColorReport(int a);
bool storeColourTempLimitRaw(int a, int limitType, int mirek);
@@ -223,6 +236,7 @@ class DaliDT8 {
std::optional<int> getExtendedVersion(int a);
private:
Dt8PreferredColorType resolvePreferredColorType(int address, Dt8PreferredColorType preferredColorType);
std::optional<Dt8LevelColorReport> buildLevelColorReport(int a, std::optional<int> level);
std::vector<int> getReportRGBWAF(int a);