Bugfix: convert cctBlend value back to "%" for UI (#4737)

* Bugfix: convert cctBlend value back to "%" for UI
This commit is contained in:
Damian Schneider 2025-06-20 10:55:53 +02:00 committed by GitHub
parent a53baa9b42
commit 05557ca790
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -545,7 +545,7 @@ void BusPwm::show() {
unsigned duty = (_data[i] * pwmBri) / 255;
unsigned deadTime = 0;
if (_type == TYPE_ANALOG_2CH && Bus::getCCTBlend() == 0) {
if (_type == TYPE_ANALOG_2CH && Bus::_cctBlend == 0) {
// add dead time between signals (when using dithering, two full 8bit pulses are required)
deadTime = (1+dithering) << bitShift;
// we only need to take care of shortening the signal at (almost) full brightness otherwise pulses may overlap
@ -972,7 +972,7 @@ bool PolyBus::_useParallelI2S = false;
// Bus static member definition
int16_t Bus::_cct = -1;
uint8_t Bus::_cctBlend = 0;
uint8_t Bus::_cctBlend = 0; // 0 - 127
uint8_t Bus::_gAWM = 255;
uint16_t BusDigital::_milliAmpsTotal = 0;

View File

@ -189,9 +189,9 @@ class Bus {
static inline void setGlobalAWMode(uint8_t m) { if (m < 5) _gAWM = m; else _gAWM = AW_GLOBAL_DISABLED; }
static inline uint8_t getGlobalAWMode() { return _gAWM; }
static inline void setCCT(int16_t cct) { _cct = cct; }
static inline uint8_t getCCTBlend() { return _cctBlend; }
static inline void setCCTBlend(uint8_t b) {
_cctBlend = (std::min((int)b,100) * 127) / 100;
static inline uint8_t getCCTBlend() { return (_cctBlend * 100 + 64) / 127; } // returns 0-100, 100% = 127. +64 for rounding
static inline void setCCTBlend(uint8_t b) { // input is 0-100
_cctBlend = (std::min((int)b,100) * 127 + 50) / 100; // +50 for rounding, b=100% -> 127
//compile-time limiter for hardware that can't power both white channels at max
#ifdef WLED_MAX_CCT_BLEND
if (_cctBlend > WLED_MAX_CCT_BLEND) _cctBlend = WLED_MAX_CCT_BLEND;