mirror of
https://github.com/wled/WLED.git
synced 2025-07-15 14:56:32 +00:00
Fix.
This commit is contained in:
parent
0dcb56eab5
commit
7a9eff7f35
@ -538,7 +538,6 @@ bool Segment::setColor(uint8_t slot, uint32_t c) { //returns true if changed
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Segment::setCCT(uint16_t k) {
|
void Segment::setCCT(uint16_t k) {
|
||||||
if (!isCCT() || !correctWB) return;
|
|
||||||
if (k > 255) { //kelvin value, convert to 0-255
|
if (k > 255) { //kelvin value, convert to 0-255
|
||||||
if (k < 1900) k = 1900;
|
if (k < 1900) k = 1900;
|
||||||
if (k > 10091) k = 10091;
|
if (k > 10091) k = 10091;
|
||||||
|
@ -441,10 +441,19 @@ void BusPwm::setPixelColor(uint16_t pix, uint32_t c) {
|
|||||||
_data[0] = w;
|
_data[0] = w;
|
||||||
break;
|
break;
|
||||||
case TYPE_ANALOG_2CH: //warm white + cold white
|
case TYPE_ANALOG_2CH: //warm white + cold white
|
||||||
|
#ifdef WLED_USE_IC_CCT
|
||||||
|
_data[0] = w;
|
||||||
|
_data[1] = cct;
|
||||||
|
#else
|
||||||
Bus::calculateCCT(c, _data[0], _data[1]);
|
Bus::calculateCCT(c, _data[0], _data[1]);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case TYPE_ANALOG_5CH: //RGB + warm white + cold white
|
case TYPE_ANALOG_5CH: //RGB + warm white + cold white
|
||||||
|
#ifdef WLED_USE_IC_CCT
|
||||||
|
_data[4] = cct;
|
||||||
|
#else
|
||||||
Bus::calculateCCT(c, w, _data[4]);
|
Bus::calculateCCT(c, w, _data[4]);
|
||||||
|
#endif
|
||||||
case TYPE_ANALOG_4CH: //RGBW
|
case TYPE_ANALOG_4CH: //RGBW
|
||||||
_data[3] = w;
|
_data[3] = w;
|
||||||
case TYPE_ANALOG_3CH: //standard dumb RGB
|
case TYPE_ANALOG_3CH: //standard dumb RGB
|
||||||
|
@ -194,10 +194,6 @@ class Bus {
|
|||||||
cct = (approximateKelvinFromRGB(c) - 1900) >> 5;
|
cct = (approximateKelvinFromRGB(c) - 1900) >> 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WLED_USE_IC_CCT
|
|
||||||
ww = w;
|
|
||||||
cw = cct;
|
|
||||||
#else
|
|
||||||
//0 - linear (CCT 127 = 50% warm, 50% cold), 127 - additive CCT blending (CCT 127 = 100% warm, 100% cold)
|
//0 - linear (CCT 127 = 50% warm, 50% cold), 127 - additive CCT blending (CCT 127 = 100% warm, 100% cold)
|
||||||
if (cct < _cctBlend) ww = 255;
|
if (cct < _cctBlend) ww = 255;
|
||||||
else ww = ((255-cct) * 255) / (255 - _cctBlend);
|
else ww = ((255-cct) * 255) / (255 - _cctBlend);
|
||||||
@ -206,7 +202,6 @@ class Bus {
|
|||||||
|
|
||||||
ww = (w * ww) / 255; //brightness scaling
|
ww = (w * ww) / 255; //brightness scaling
|
||||||
cw = (w * cw) / 255;
|
cw = (w * cw) / 255;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
inline void setAutoWhiteMode(uint8_t m) { if (m < 5) _autoWhiteMode = m; }
|
inline void setAutoWhiteMode(uint8_t m) { if (m < 5) _autoWhiteMode = m; }
|
||||||
inline uint8_t getAutoWhiteMode() { return _autoWhiteMode; }
|
inline uint8_t getAutoWhiteMode() { return _autoWhiteMode; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user