Fix RGBW color-interlock control (#1325)

This commit is contained in:
Marvin Gaube 2020-10-15 14:48:12 +02:00 committed by GitHub
parent 0c87a9ad2c
commit c9caf44c2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -399,13 +399,13 @@ LightColorValues LightCall::validate_() {
// sets RGB to 100% if only White specified
if (this->white_.has_value()) {
if (traits.get_supports_color_interlock()) {
if (!this->red_.has_value() && !this->green_.has_value() && !this->blue_.has_value()) {
this->red_ = optional<float>(1.0f);
this->green_ = optional<float>(1.0f);
this->blue_ = optional<float>(1.0f);
}
// make white values binary aka 0.0f or 1.0f...this allows brightness to do its job
if (traits.get_supports_color_interlock()) {
if (*this->white_ > 0.0f) {
this->white_ = optional<float>(1.0f);
} else {
@ -415,13 +415,15 @@ LightColorValues LightCall::validate_() {
}
// White to 0% if (exclusively) setting any RGB value that isn't 255,255,255
else if (this->red_.has_value() || this->green_.has_value() || this->blue_.has_value()) {
if (*this->red_ == 1.0f && *this->green_ == 1.0f && *this->blue_ == 1.0f && traits.get_supports_rgb_white_value() &&
traits.get_supports_color_interlock()) {
if (traits.get_supports_color_interlock()) {
if (*this->red_ == 1.0f && *this->green_ == 1.0f && *this->blue_ == 1.0f &&
traits.get_supports_rgb_white_value() && traits.get_supports_color_interlock()) {
this->white_ = optional<float>(1.0f);
} else if (!this->white_.has_value() || !traits.get_supports_rgb_white_value()) {
this->white_ = optional<float>(0.0f);
}
}
}
// if changing Kelvin alone, change to white light
else if (this->color_temperature_.has_value()) {
if (!traits.get_supports_color_interlock()) {