From faefde9467015a55e886d6e4a373819709fc7dd0 Mon Sep 17 00:00:00 2001 From: Tony Date: Mon, 25 May 2026 08:16:28 +0800 Subject: [PATCH] Enhance color handling in DaliDT8: add checks for color status based on code values Signed-off-by: Tony --- src/dt8.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/dt8.cpp b/src/dt8.cpp index 53e613a..e56590b 100644 --- a/src/dt8.cpp +++ b/src/dt8.cpp @@ -280,6 +280,22 @@ std::optional DaliDT8::getColourRaw(int a, int type) { if ((code == 2 || code == 128 || code == 129 || code == 130 || code == 131) && !features->ctCapable()) { return std::nullopt; } + if (code <= 15) { + const auto status = getColorStatus(a); + if (!status.has_value()) return std::nullopt; + if ((code == 0 || code == 1) && !status->xyActive()) { + return std::nullopt; + } + if (code == 2 && !status->ctActive()) { + return std::nullopt; + } + if (code >= 3 && code <= 8 && !status->primaryNActive()) { + return std::nullopt; + } + if (code >= 9 && code <= 15 && !status->rgbwafActive()) { + return std::nullopt; + } + } bool is8bit = false; if (code == 82 || (code >= 9 && code <= 15) || (code >= 201 && code <= 207) || code == 208 ||