diff --git a/platformio.ini b/platformio.ini
index c0467c8f3..345d66d91 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -389,7 +389,7 @@ platform = ${esp32.platform}
board = ttgo-t7-v14-mini32
board_build.f_flash = 80000000L
board_build.flash_mode = qio
-board_build.partitions = ${esp32.default_partitions}
+board_build.partitions = tools/WLED_ESP32-wrover_4MB.csv
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_WROVER
-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue ;; Older ESP32 (rev.<3) need a PSRAM fix (increases static RAM used) https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html
diff --git a/tools/WLED_ESP32-wrover_4MB.csv b/tools/WLED_ESP32-wrover_4MB.csv
index a179a89d0..39c88e543 100644
--- a/tools/WLED_ESP32-wrover_4MB.csv
+++ b/tools/WLED_ESP32-wrover_4MB.csv
@@ -1,6 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
-app0, app, ota_0, 0x10000, 0x180000,
-app1, app, ota_1, 0x190000,0x180000,
-spiffs, data, spiffs, 0x310000,0xF0000,
+app0, app, ota_0, 0x10000, 0x1A0000,
+app1, app, ota_1, 0x1B0000,0x1A0000,
+spiffs, data, spiffs, 0x350000,0xB0000,
diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp
index eeb9a15e4..88b4cc32b 100644
--- a/wled00/bus_manager.cpp
+++ b/wled00/bus_manager.cpp
@@ -9,6 +9,8 @@
#include "bus_wrapper.h"
#include "bus_manager.h"
+extern bool cctICused;
+
//colors.cpp
uint32_t colorBalanceFromKelvin(uint16_t kelvin, uint32_t rgb);
@@ -210,7 +212,7 @@ void BusDigital::show() {
if (_data) {
size_t channels = getNumberOfChannels();
- int16_t oldCCT = _cct; // temporarily save bus CCT
+ int16_t oldCCT = Bus::_cct; // temporarily save bus CCT
for (size_t i=0; i<_len; i++) {
size_t offset = i * channels;
uint8_t co = _colorOrderMap.getPixelColorOrder(i+_start, _colorOrder);
@@ -229,7 +231,7 @@ void BusDigital::show() {
// unfortunately as a segment may span multiple buses or a bus may contain multiple segments and each segment may have different CCT
// we need to extract and appy CCT value for each pixel individually even though all buses share the same _cct variable
// TODO: there is an issue if CCT is calculated from RGB value (_cct==-1), we cannot do that with double buffer
- _cct = _data[offset+channels-1];
+ Bus::_cct = _data[offset+channels-1];
Bus::calculateCCT(c, cctWW, cctCW);
}
uint16_t pix = i;
@@ -241,7 +243,7 @@ void BusDigital::show() {
if (_skip) PolyBus::setPixelColor(_busPtr, _iType, 0, 0, _colorOrderMap.getPixelColorOrder(_start, _colorOrder)); // paint skipped pixels black
#endif
for (int i=1; i<_skip; i++) PolyBus::setPixelColor(_busPtr, _iType, i, 0, _colorOrderMap.getPixelColorOrder(_start, _colorOrder)); // paint skipped pixels black
- _cct = oldCCT;
+ Bus::_cct = oldCCT;
} else {
if (newBri < _bri) {
uint16_t hwLen = _len;
@@ -291,7 +293,7 @@ void IRAM_ATTR BusDigital::setPixelColor(uint16_t pix, uint32_t c) {
if (!_valid) return;
uint8_t cctWW = 0, cctCW = 0;
if (hasWhite()) c = autoWhiteCalc(c);
- if (_cct >= 1900) c = colorBalanceFromKelvin(_cct, c); //color correction from CCT
+ if (Bus::_cct >= 1900) c = colorBalanceFromKelvin(Bus::_cct, c); //color correction from CCT
if (_data) {
size_t offset = pix * getNumberOfChannels();
if (hasRGB()) {
@@ -302,7 +304,7 @@ void IRAM_ATTR BusDigital::setPixelColor(uint16_t pix, uint32_t c) {
if (hasWhite()) _data[offset++] = W(c);
// unfortunately as a segment may span multiple buses or a bus may contain multiple segments and each segment may have different CCT
// we need to store CCT value for each pixel (if there is a color correction in play, convert K in CCT ratio)
- if (hasCCT()) _data[offset] = _cct >= 1900 ? (_cct - 1900) >> 5 : (_cct < 0 ? 127 : _cct); // TODO: if _cct == -1 we simply ignore it
+ if (hasCCT()) _data[offset] = Bus::_cct >= 1900 ? (Bus::_cct - 1900) >> 5 : (Bus::_cct < 0 ? 127 : Bus::_cct); // TODO: if _cct == -1 we simply ignore it
} else {
if (_reversed) pix = _len - pix -1;
pix += _skip;
@@ -428,8 +430,8 @@ BusPwm::BusPwm(BusConfig &bc)
void BusPwm::setPixelColor(uint16_t pix, uint32_t c) {
if (pix != 0 || !_valid) return; //only react to first pixel
if (_type != TYPE_ANALOG_3CH) c = autoWhiteCalc(c);
- if (_cct >= 1900 && (_type == TYPE_ANALOG_3CH || _type == TYPE_ANALOG_4CH)) {
- c = colorBalanceFromKelvin(_cct, c); //color correction from CCT
+ if (Bus::_cct >= 1900 && (_type == TYPE_ANALOG_3CH || _type == TYPE_ANALOG_4CH)) {
+ c = colorBalanceFromKelvin(Bus::_cct, c); //color correction from CCT
}
uint8_t r = R(c);
uint8_t g = G(c);
@@ -441,19 +443,18 @@ void BusPwm::setPixelColor(uint16_t pix, uint32_t c) {
_data[0] = w;
break;
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]);
- #endif
+ if (cctICused) {
+ _data[0] = w;
+ _data[1] = Bus::_cct < 0 || Bus::_cct > 255 ? 127 : Bus::_cct;
+ } else {
+ Bus::calculateCCT(c, _data[0], _data[1]);
+ }
break;
case TYPE_ANALOG_5CH: //RGB + warm white + cold white
- #ifdef WLED_USE_IC_CCT
- _data[4] = cct;
- #else
- Bus::calculateCCT(c, w, _data[4]);
- #endif
+ if (cctICused)
+ _data[4] = Bus::_cct < 0 || Bus::_cct > 255 ? 127 : Bus::_cct;
+ else
+ Bus::calculateCCT(c, w, _data[4]);
case TYPE_ANALOG_4CH: //RGBW
_data[3] = w;
case TYPE_ANALOG_3CH: //standard dumb RGB
@@ -618,7 +619,7 @@ BusNetwork::BusNetwork(BusConfig &bc)
void BusNetwork::setPixelColor(uint16_t pix, uint32_t c) {
if (!_valid || pix >= _len) return;
if (_rgbw) c = autoWhiteCalc(c);
- if (_cct >= 1900) c = colorBalanceFromKelvin(_cct, c); //color correction from CCT
+ if (Bus::_cct >= 1900) c = colorBalanceFromKelvin(Bus::_cct, c); //color correction from CCT
uint16_t offset = pix * _UDPchannels;
_data[offset] = R(c);
_data[offset+1] = G(c);
diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp
index a1794a755..4dd1d133a 100644
--- a/wled00/cfg.cpp
+++ b/wled00/cfg.cpp
@@ -110,6 +110,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
Bus::setGlobalAWMode(hw_led[F("rgbwm")] | AW_GLOBAL_DISABLED);
CJSON(correctWB, hw_led["cct"]);
CJSON(cctFromRgb, hw_led[F("cr")]);
+ CJSON(cctICused, hw_led[F("ic")]);
CJSON(strip.cctBlending, hw_led[F("cb")]);
Bus::setCCTBlend(strip.cctBlending);
strip.setTargetFps(hw_led["fps"]); //NOP if 0, default 42 FPS
@@ -767,6 +768,7 @@ void serializeConfig() {
hw_led[F("ledma")] = 0; // no longer used
hw_led["cct"] = correctWB;
hw_led[F("cr")] = cctFromRgb;
+ hw_led[F("ic")] = cctICused;
hw_led[F("cb")] = strip.cctBlending;
hw_led["fps"] = strip.getTargetFps();
hw_led[F("rgbwm")] = Bus::getGlobalAWMode(); // global auto white mode override
diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm
index fee523ffc..dddedd471 100644
--- a/wled00/data/settings_leds.htm
+++ b/wled00/data/settings_leds.htm
@@ -866,6 +866,7 @@ Swap:
Calculate CCT from RGB:
+ CCT IC used (Athom 15W):
CCT additive blending: %