mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Fix esphome/issues#947 - RGBW(W) white brightness (#925)
This commit is contained in:
parent
854d735ab3
commit
11069085e3
1 changed files with 3 additions and 3 deletions
|
@ -185,7 +185,7 @@ class LightColorValues {
|
|||
/// Convert these light color values to an RGBW representation and write them to red, green, blue, white.
|
||||
void as_rgbw(float *red, float *green, float *blue, float *white) const {
|
||||
this->as_rgb(red, green, blue);
|
||||
*white = this->state_ * this->white_;
|
||||
*white = this->state_ * this->brightness_ * this->white_;
|
||||
}
|
||||
|
||||
/// Convert these light color values to an RGBWW representation with the given parameters.
|
||||
|
@ -196,8 +196,8 @@ class LightColorValues {
|
|||
const float ww_fraction = (color_temp - color_temperature_cw) / (color_temperature_ww - color_temperature_cw);
|
||||
const float cw_fraction = 1.0f - ww_fraction;
|
||||
const float max_cw_ww = std::max(ww_fraction, cw_fraction);
|
||||
*cold_white = this->state_ * this->white_ * (cw_fraction / max_cw_ww);
|
||||
*warm_white = this->state_ * this->white_ * (ww_fraction / max_cw_ww);
|
||||
*cold_white = this->state_ * this->brightness_ * this->white_ * (cw_fraction / max_cw_ww);
|
||||
*warm_white = this->state_ * this->brightness_ * this->white_ * (ww_fraction / max_cw_ww);
|
||||
}
|
||||
|
||||
/// Convert these light color values to an CWWW representation with the given parameters.
|
||||
|
|
Loading…
Reference in a new issue