Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,8 @@ void Segment::refreshLightCapabilities() const {
if (!strip.cctFromRgb && bus->hasCCT()) capabilities |= SEG_CAPABILITY_CCT;
if (strip.correctWB && (bus->hasRGB() || bus->hasCCT())) capabilities |= SEG_CAPABILITY_CCT; //white balance correction (CCT slider)
if (bus->hasWhite()) {
unsigned aWM = Bus::getGlobalAWMode() == AW_GLOBAL_DISABLED ? bus->getAutoWhiteMode() : Bus::getGlobalAWMode();
// get auto white mode: priority is global -> temp global -> per bus
unsigned aWM = Bus::getGlobalAWMode() == AW_GLOBAL_DISABLED? (Bus::getTempAWMode() == AW_GLOBAL_DISABLED ? bus->getAutoWhiteMode() : Bus::getTempAWMode()) : Bus::getGlobalAWMode();
bool whiteSlider = (aWM == RGBW_MODE_DUAL || aWM == RGBW_MODE_MANUAL_ONLY); // white slider allowed
// if auto white calculation from RGB is active (Accurate/Brighter), force RGB controls even if there are no RGB busses
if (!whiteSlider) capabilities |= SEG_CAPABILITY_RGB;
Expand Down
2 changes: 2 additions & 0 deletions wled00/bus_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ void Bus::calculateCCT(uint32_t c, uint8_t &ww, uint8_t &cw) {
uint32_t Bus::autoWhiteCalc(uint32_t c) const {
unsigned aWM = _autoWhiteMode;
if (_gAWM < AW_GLOBAL_DISABLED) aWM = _gAWM;
else if (_tempAWM < AW_GLOBAL_DISABLED) aWM = _tempAWM; // temporary global AWM active
if (aWM == RGBW_MODE_MANUAL_ONLY) return c;
unsigned w = W(c);
//ignore auto-white calculation if w>0 and mode DUAL (DUAL behaves as BRIGHTER if w==0)
Expand Down Expand Up @@ -1444,6 +1445,7 @@ bool PolyBus::_useParallelI2S = false;
int16_t Bus::_cct = -1;
uint8_t Bus::_cctBlend = 0; // 0 - 127
uint8_t Bus::_gAWM = 255;
uint8_t Bus::_tempAWM = 255;

uint16_t BusDigital::_milliAmpsTotal = 0;

Expand Down
5 changes: 4 additions & 1 deletion wled00/bus_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ class Bus {
static inline int16_t getCCT() { return _cct; }
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 setTempAWMode(uint8_t m) { if (m < 5) _tempAWM = m; else _tempAWM = AW_GLOBAL_DISABLED; }
static inline uint8_t getTempAWMode() { return _tempAWM; }
static inline void setCCT(int16_t cct) { _cct = cct; }
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
Expand All @@ -224,7 +226,8 @@ class Bus {
bool _hasWhite;// : 1;
bool _hasCCT;// : 1;
//} __attribute__ ((packed));
static uint8_t _gAWM;
static uint8_t _gAWM; // global auto white mode
static uint8_t _tempAWM; // temporary global auto white mode, set by JSON API, overriden by _gAWM
// _cct has the following meanings (see calculateCCT() & BusManager::setSegmentCCT()):
// -1 means to extract approximate CCT value in K from RGB (in calcualteCCT())
// [0,255] is the exact CCT value where 0 means warm and 255 cold
Expand Down
5 changes: 5 additions & 0 deletions wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
exitRealtime();
}
}
if (root.containsKey("awm")) {
uint8_t awm = root["awm"] | AW_GLOBAL_DISABLED;
Bus::setTempAWMode(awm);
strip.getMainSegment().refreshLightCapabilities(); // update sliders
}

int it = 0;
JsonVariant segVar = root["seg"];
Expand Down