Refactor DALI command handling: streamline send methods and enhance scene color reporting

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Tony
2026-04-28 17:32:32 +08:00
parent 32e7329b3e
commit 9e1244712d
10 changed files with 84 additions and 38 deletions
+27 -4
View File
@@ -381,11 +381,34 @@ std::optional<int> DaliDT8::getPrimaryTy(int a, int n) {
return getColourRaw(a, 66 + 3 * n);
}
std::optional<SceneColorReport> DaliDT8::getSceneColorReport(int a, int sense) {
const auto brightness = base_.getScene(a, sense);
if (!brightness.has_value() || brightness.value() == 255) return std::nullopt;
const int colorTypeValue = getReportColourType(a).value_or(0);
const ColorType colorType(colorTypeValue);
SceneColorReport report;
report.brightness = brightness.value();
report.colorTypeValue = colorTypeValue;
if (colorType.xy()) {
report.xy = getReportColour(a);
return report;
}
if (colorType.ct()) {
report.colorTemperature = getReportColorTemperature(a);
return report;
}
return report;
}
std::vector<double> DaliDT8::getSceneColor(int a, int sense) {
const auto bright = base_.getScene(a, sense);
if (!bright.has_value() || bright.value() == 255) return {};
base_.copyReportColourToTemp(a);
return getColour(a);
const auto report = getSceneColorReport(a, sense);
if (!report.has_value() || !report->colorType().xy() || !report->hasXy()) return {};
return report->xy;
}
bool DaliDT8::storePrimaryTy(int a, int n, int ty) {