mirror of
https://github.com/wled/WLED.git
synced 2025-07-15 14:56:32 +00:00
Bugfix: convert cctBlend value back to "%" for UI (#4737)
* Bugfix: convert cctBlend value back to "%" for UI
This commit is contained in:
parent
a53baa9b42
commit
05557ca790
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user