Refactor DALI command handling: streamline send methods and enhance scene color reporting
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
+27
-4
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user