Merge pull request #1836 from Aircoookie/blackmagic

Defeat the black magic
This commit is contained in:
Aircoookie 2021-03-29 02:53:37 +02:00 committed by GitHub
commit 4a1ecc7b72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 2143 additions and 2139 deletions

View File

@ -1,6 +1,13 @@
## WLED changelog ## WLED changelog
### Development versions after 0.11.1 release ### Development versions between 0.11.1 and 0.12.0 releases
#### Build 2103290
- Version bump to 0.12.0-b4 "Hikari"
- Experimental use of espressif32@3.1.1
- Fixed RGBW mode disabled after LED settings saved
- Fixed infrared support not compiled in if IRPIN is not defined
#### Build 2103230 #### Build 2103230
@ -233,7 +240,7 @@
#### Build 2011153 #### Build 2011153
- Fixed an ESP32 end-of-file issue - Fixed an ESP32 end-of-file issue
- Fixed useRGBW not read from cfg.json - Fixed strip.isRgbw not read from cfg.json
#### Build 2011152 #### Build 2011152

View File

@ -1,6 +1,6 @@
{ {
"name": "wled", "name": "wled",
"version": "0.12.0-b2", "version": "0.12.0-b4",
"description": "Tools for WLED project", "description": "Tools for WLED project",
"main": "tools/cdata.js", "main": "tools/cdata.js",
"directories": { "directories": {

View File

@ -259,7 +259,7 @@ build_flags = ${common.build_flags_esp8266} -D LEDPIN=1 -D WLED_DISABLE_INFRARED
[env:esp32dev] [env:esp32dev]
board = esp32dev board = esp32dev
platform = espressif32@2.0 platform = espressif32@3.1.1
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} build_flags = ${common.build_flags_esp32}
lib_ignore = lib_ignore =
@ -268,7 +268,7 @@ lib_ignore =
[env:esp32_eth] [env:esp32_eth]
board = esp32-poe board = esp32-poe
platform = espressif32@2.0 platform = espressif32@3.1.1
upload_speed = 921600 upload_speed = 921600
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1 build_flags = ${common.build_flags_esp32} -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1
@ -387,7 +387,7 @@ build_flags = ${common.build_flags_esp8266} -D USE_WS2801
[env:custom32_LEDPIN_16] [env:custom32_LEDPIN_16]
board = esp32dev board = esp32dev
platform = espressif32@2.0 platform = espressif32@3.1.1
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D LEDPIN=16 -D RLYPIN=19 build_flags = ${common.build_flags_esp32} -D LEDPIN=16 -D RLYPIN=19
lib_ignore = lib_ignore =
@ -396,7 +396,7 @@ lib_ignore =
[env:custom32_APA102] [env:custom32_APA102]
board = esp32dev board = esp32dev
platform = espressif32@2.0 platform = espressif32@3.1.1
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D USE_APA102 build_flags = ${common.build_flags_esp32} -D USE_APA102
lib_ignore = lib_ignore =
@ -405,7 +405,7 @@ lib_ignore =
[env:custom32_TOUCHPIN_T0] [env:custom32_TOUCHPIN_T0]
board = esp32dev board = esp32dev
platform = espressif32@2.0 platform = espressif32@3.1.1
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D TOUCHPIN=T0 build_flags = ${common.build_flags_esp32} -D TOUCHPIN=T0
lib_ignore = lib_ignore =
@ -414,7 +414,7 @@ lib_ignore =
[env:wemos_shield_esp32] [env:wemos_shield_esp32]
board = esp32dev board = esp32dev
platform = espressif32@2.0 platform = espressif32@3.1.1
upload_port = /dev/cu.SLAB_USBtoUART upload_port = /dev/cu.SLAB_USBtoUART
monitor_port = /dev/cu.SLAB_USBtoUART monitor_port = /dev/cu.SLAB_USBtoUART
upload_speed = 460800 upload_speed = 460800
@ -431,7 +431,7 @@ build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39
lib_ignore = lib_ignore =
ESPAsyncTCP ESPAsyncTCP
ESPAsyncUDP ESPAsyncUDP
platform = espressif32@2.0 platform = espressif32@3.1.1
[env:sp501e] [env:sp501e]
board = esp_wroom_02 board = esp_wroom_02

View File

@ -4,7 +4,7 @@ default_envs = d1_mini
[env:esp32dev] [env:esp32dev]
board = esp32dev board = esp32dev
platform = espressif32@2.0 platform = espressif32@3.1.1
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = build_flags =
${common.build_flags_esp32} ${common.build_flags_esp32}

View File

@ -584,7 +584,7 @@ class WS2812FX {
} }
void void
finalizeInit(bool supportWhite, uint16_t countPixels, bool skipFirst), finalizeInit(uint16_t countPixels, bool skipFirst),
service(void), service(void),
blur(uint8_t), blur(uint8_t),
fill(uint32_t), fill(uint32_t),
@ -608,6 +608,7 @@ class WS2812FX {
setPixelSegment(uint8_t n); setPixelSegment(uint8_t n);
bool bool
isRgbw = false,
gammaCorrectBri = false, gammaCorrectBri = false,
gammaCorrectCol = true, gammaCorrectCol = true,
applyToAllSelected = true, applyToAllSelected = true,
@ -813,7 +814,6 @@ class WS2812FX {
void handle_palette(void); void handle_palette(void);
bool bool
_useRgbw = false,
_skipFirstMode, _skipFirstMode,
_triggered; _triggered;

View File

@ -44,11 +44,9 @@
*/ */
//do not call this method from system context (network callback) //do not call this method from system context (network callback)
void WS2812FX::finalizeInit(bool supportWhite, uint16_t countPixels, bool skipFirst) void WS2812FX::finalizeInit(uint16_t countPixels, bool skipFirst)
{ {
if (supportWhite == _useRgbw && countPixels == _length && _skipFirstMode == skipFirst) return;
RESET_RUNTIME; RESET_RUNTIME;
_useRgbw = supportWhite;
_length = countPixels; _length = countPixels;
_skipFirstMode = skipFirst; _skipFirstMode = skipFirst;
@ -163,7 +161,7 @@ uint16_t WS2812FX::realPixelIndex(uint16_t i) {
void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w) void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w)
{ {
//auto calculate white channel value if enabled //auto calculate white channel value if enabled
if (_useRgbw) { if (isRgbw) {
if (rgbwMode == RGBW_MODE_AUTO_BRIGHTER || (w == 0 && (rgbwMode == RGBW_MODE_DUAL || rgbwMode == RGBW_MODE_LEGACY))) if (rgbwMode == RGBW_MODE_AUTO_BRIGHTER || (w == 0 && (rgbwMode == RGBW_MODE_DUAL || rgbwMode == RGBW_MODE_LEGACY)))
{ {
//white value is set to lowest RGB channel //white value is set to lowest RGB channel
@ -278,7 +276,7 @@ void WS2812FX::show(void) {
} }
if (_useRgbw) //RGBW led total output with white LEDs enabled is still 50mA, so each channel uses less if (isRgbw) //RGBW led total output with white LEDs enabled is still 50mA, so each channel uses less
{ {
powerSum *= 3; powerSum *= 3;
powerSum = powerSum >> 2; //same as /= 4 powerSum = powerSum >> 2; //same as /= 4

View File

@ -67,7 +67,7 @@ void onAlexaChange(EspalexaDevice* dev)
if (espalexaDevice->getColorMode() == EspalexaColorMode::ct) //shade of white if (espalexaDevice->getColorMode() == EspalexaColorMode::ct) //shade of white
{ {
uint16_t ct = espalexaDevice->getCt(); uint16_t ct = espalexaDevice->getCt();
if (useRGBW) if (strip.isRgbw)
{ {
switch (ct) { //these values empirically look good on RGBW switch (ct) { //these values empirically look good on RGBW
case 199: col[0]=255; col[1]=255; col[2]=255; col[3]=255; break; case 199: col[0]=255; col[1]=255; col[2]=255; col[3]=255; break;

View File

@ -99,7 +99,7 @@ void deserializeConfig() {
JsonArray ins = hw_led["ins"]; JsonArray ins = hw_led["ins"];
uint8_t s = 0; //bus iterator uint8_t s = 0; //bus iterator
useRGBW = false; strip.isRgbw = false;
busses.removeAll(); busses.removeAll();
uint32_t mem = 0; uint32_t mem = 0;
for (JsonObject elm : ins) { for (JsonObject elm : ins) {
@ -127,13 +127,13 @@ void deserializeConfig() {
uint8_t ledType = elm["type"] | TYPE_WS2812_RGB; uint8_t ledType = elm["type"] | TYPE_WS2812_RGB;
bool reversed = elm["rev"]; bool reversed = elm["rev"];
//RGBW mode is enabled if at least one of the strips is RGBW //RGBW mode is enabled if at least one of the strips is RGBW
useRGBW = (useRGBW || BusManager::isRgbw(ledType)); strip.isRgbw = (strip.isRgbw || BusManager::isRgbw(ledType));
s++; s++;
BusConfig bc = BusConfig(ledType, pins, start, length, colorOrder, reversed); BusConfig bc = BusConfig(ledType, pins, start, length, colorOrder, reversed);
mem += busses.memUsage(bc); mem += busses.memUsage(bc);
if (mem <= MAX_LED_MEMORY) busses.add(bc); if (mem <= MAX_LED_MEMORY) busses.add(bc);
} }
strip.finalizeInit(useRGBW, ledCount, skipFirstLed); strip.finalizeInit(ledCount, skipFirstLed);
if (hw_led["rev"]) busses.getBus(0)->reversed = true; //set 0.11 global reversed setting for first bus if (hw_led["rev"]) busses.getBus(0)->reversed = true; //set 0.11 global reversed setting for first bus
JsonObject hw_btn_ins_0 = hw[F("btn")][F("ins")][0]; JsonObject hw_btn_ins_0 = hw[F("btn")][F("ins")][0];
@ -491,7 +491,7 @@ void serializeConfig() {
if (irPin>=0) { if (irPin>=0) {
JsonObject hw_ir = hw.createNestedObject("ir"); JsonObject hw_ir = hw.createNestedObject("ir");
hw_ir["pin"] = irPin; hw_ir["pin"] = irPin;
hw_ir[F("type"] = irEnabled; // the byte 'irEnabled' does contain the IR-Remote Type ( 0=disabled ) hw_ir[F("type")] = irEnabled; // the byte 'irEnabled' does contain the IR-Remote Type ( 0=disabled )
} }
#endif #endif

View File

@ -64,7 +64,7 @@ void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
case 4: rgb[0]=t,rgb[1]=p,rgb[2]=255;break; case 4: rgb[0]=t,rgb[1]=p,rgb[2]=255;break;
case 5: rgb[0]=255,rgb[1]=p,rgb[2]=q; case 5: rgb[0]=255,rgb[1]=p,rgb[2]=q;
} }
if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) colorRGBtoRGBW(col); if (strip.isRgbw && strip.rgbwMode == RGBW_MODE_LEGACY) colorRGBtoRGBW(col);
} }
void colorKtoRGB(uint16_t kelvin, byte* rgb) //white spectrum to rgb, calc void colorKtoRGB(uint16_t kelvin, byte* rgb) //white spectrum to rgb, calc
@ -111,7 +111,7 @@ void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb, bins
} else { } else {
rgb[0]=237;rgb[1]=255;rgb[2]=239;//150 rgb[0]=237;rgb[1]=255;rgb[2]=239;//150
} }
if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) colorRGBtoRGBW(col); if (strip.isRgbw && strip.rgbwMode == RGBW_MODE_LEGACY) colorRGBtoRGBW(col);
} }
#ifndef WLED_DISABLE_HUESYNC #ifndef WLED_DISABLE_HUESYNC
@ -169,7 +169,7 @@ void colorXYtoRGB(float x, float y, byte* rgb) //coordinates to rgb (https://www
rgb[0] = 255.0*r; rgb[0] = 255.0*r;
rgb[1] = 255.0*g; rgb[1] = 255.0*g;
rgb[2] = 255.0*b; rgb[2] = 255.0*b;
if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) colorRGBtoRGBW(col); if (strip.isRgbw && strip.rgbwMode == RGBW_MODE_LEGACY) colorRGBtoRGBW(col);
} }
void colorRGBtoXY(byte* rgb, float* xy) //rgb to coordinates (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy) void colorRGBtoXY(byte* rgb, float* xy) //rgb to coordinates (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)

View File

@ -913,6 +913,7 @@ input[type=number]::-webkit-outer-spin-button {
} }
.lstI { .lstI {
position: sticky;
overflow: hidden; overflow: hidden;
} }
@ -930,7 +931,6 @@ input[type=number]::-webkit-outer-spin-button {
} }
.lstI.sticky, .lstI.selected { .lstI.sticky, .lstI.selected {
position: sticky;
z-index: 1; z-index: 1;
} }

View File

@ -42,7 +42,7 @@ function B(){window.history.back()}function U(){document.getElementById("uf").st
.bt{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.3ch solid #333;display:inline-block;font-size:20px;margin:8px;margin-top:12px}input[type=file]{font-size:16px}body{font-family:Verdana,sans-serif;text-align:center;background:#222;color:#fff;line-height:200%}#msg{display:none} .bt{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.3ch solid #333;display:inline-block;font-size:20px;margin:8px;margin-top:12px}input[type=file]{font-size:16px}body{font-family:Verdana,sans-serif;text-align:center;background:#222;color:#fff;line-height:200%}#msg{display:none}
</style></head><body><h2>WLED Software Update</h2><form method="POST" </style></head><body><h2>WLED Software Update</h2><form method="POST"
action="/update" id="uf" enctype="multipart/form-data" onsubmit="U()"> action="/update" id="uf" enctype="multipart/form-data" onsubmit="U()">
Installed version: 0.12.0-b2<br>Download the latest binary: <a Installed version: 0.12.0-b4<br>Download the latest binary: <a
href="https://github.com/Aircoookie/WLED/releases" target="_blank"><img href="https://github.com/Aircoookie/WLED/releases" target="_blank"><img
src="https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square"> src="https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square">
</a><br><input type="file" class="bt" name="update" accept=".bin" required><br> </a><br><input type="file" class="bt" name="update" accept=".bin" required><br>

View File

@ -375,7 +375,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
<h3>Software Update</h3><button type="button" onclick="U()">Manual OTA Update <h3>Software Update</h3><button type="button" onclick="U()">Manual OTA Update
</button><br>Enable ArduinoOTA: <input type="checkbox" name="AO"><br><h3>About </button><br>Enable ArduinoOTA: <input type="checkbox" name="AO"><br><h3>About
</h3><a href="https://github.com/Aircoookie/WLED/" target="_blank">WLED</a> </h3><a href="https://github.com/Aircoookie/WLED/" target="_blank">WLED</a>
version 0.12.0-b2<br><br><a version 0.12.0-b4<br><br><a
href="https://github.com/Aircoookie/WLED/wiki/Contributors-and-credits" href="https://github.com/Aircoookie/WLED/wiki/Contributors-and-credits"
target="_blank">Contributors, dependencies and special thanks</a><br> target="_blank">Contributors, dependencies and special thanks</a><br>
A huge thank you to everyone who helped me create WLED!<br><br> A huge thank you to everyone who helped me create WLED!<br><br>

File diff suppressed because it is too large Load Diff

View File

@ -345,19 +345,19 @@ void decodeIR40(uint32_t code)
case IR40_MAGENTA : colorFromUint24(COLOR_MAGENTA); break; case IR40_MAGENTA : colorFromUint24(COLOR_MAGENTA); break;
case IR40_PINK : colorFromUint24(COLOR_PINK); break; case IR40_PINK : colorFromUint24(COLOR_PINK); break;
case IR40_WARMWHITE2 : { case IR40_WARMWHITE2 : {
if (useRGBW) { colorFromUint32(COLOR2_WARMWHITE2); effectCurrent = 0; } if (strip.isRgbw) { colorFromUint32(COLOR2_WARMWHITE2); effectCurrent = 0; }
else colorFromUint24(COLOR_WARMWHITE2); } break; else colorFromUint24(COLOR_WARMWHITE2); } break;
case IR40_WARMWHITE : { case IR40_WARMWHITE : {
if (useRGBW) { colorFromUint32(COLOR2_WARMWHITE); effectCurrent = 0; } if (strip.isRgbw) { colorFromUint32(COLOR2_WARMWHITE); effectCurrent = 0; }
else colorFromUint24(COLOR_WARMWHITE); } break; else colorFromUint24(COLOR_WARMWHITE); } break;
case IR40_WHITE : { case IR40_WHITE : {
if (useRGBW) { colorFromUint32(COLOR2_NEUTRALWHITE); effectCurrent = 0; } if (strip.isRgbw) { colorFromUint32(COLOR2_NEUTRALWHITE); effectCurrent = 0; }
else colorFromUint24(COLOR_NEUTRALWHITE); } break; else colorFromUint24(COLOR_NEUTRALWHITE); } break;
case IR40_COLDWHITE : { case IR40_COLDWHITE : {
if (useRGBW) { colorFromUint32(COLOR2_COLDWHITE); effectCurrent = 0; } if (strip.isRgbw) { colorFromUint32(COLOR2_COLDWHITE); effectCurrent = 0; }
else colorFromUint24(COLOR_COLDWHITE); } break; else colorFromUint24(COLOR_COLDWHITE); } break;
case IR40_COLDWHITE2 : { case IR40_COLDWHITE2 : {
if (useRGBW) { colorFromUint32(COLOR2_COLDWHITE2); effectCurrent = 0; } if (strip.isRgbw) { colorFromUint32(COLOR2_COLDWHITE2); effectCurrent = 0; }
else colorFromUint24(COLOR_COLDWHITE2); } break; else colorFromUint24(COLOR_COLDWHITE2); } break;
case IR40_WPLUS : relativeChangeWhite(10); break; case IR40_WPLUS : relativeChangeWhite(10); break;
case IR40_WMINUS : relativeChangeWhite(-10, 5); break; case IR40_WMINUS : relativeChangeWhite(-10, 5); break;
@ -402,21 +402,21 @@ void decodeIR44(uint32_t code)
case IR44_MAGENTA : colorFromUint24(COLOR_MAGENTA); break; case IR44_MAGENTA : colorFromUint24(COLOR_MAGENTA); break;
case IR44_PINK : colorFromUint24(COLOR_PINK); break; case IR44_PINK : colorFromUint24(COLOR_PINK); break;
case IR44_WHITE : { case IR44_WHITE : {
if (useRGBW) { if (strip.isRgbw) {
if (col[3] > 0) col[3] = 0; if (col[3] > 0) col[3] = 0;
else { colorFromUint32(COLOR2_NEUTRALWHITE); effectCurrent = 0; } else { colorFromUint32(COLOR2_NEUTRALWHITE); effectCurrent = 0; }
} else colorFromUint24(COLOR_NEUTRALWHITE); } break; } else colorFromUint24(COLOR_NEUTRALWHITE); } break;
case IR44_WARMWHITE2 : { case IR44_WARMWHITE2 : {
if (useRGBW) { colorFromUint32(COLOR2_WARMWHITE2); effectCurrent = 0; } if (strip.isRgbw) { colorFromUint32(COLOR2_WARMWHITE2); effectCurrent = 0; }
else colorFromUint24(COLOR_WARMWHITE2); } break; else colorFromUint24(COLOR_WARMWHITE2); } break;
case IR44_WARMWHITE : { case IR44_WARMWHITE : {
if (useRGBW) { colorFromUint32(COLOR2_WARMWHITE); effectCurrent = 0; } if (strip.isRgbw) { colorFromUint32(COLOR2_WARMWHITE); effectCurrent = 0; }
else colorFromUint24(COLOR_WARMWHITE); } break; else colorFromUint24(COLOR_WARMWHITE); } break;
case IR44_COLDWHITE : { case IR44_COLDWHITE : {
if (useRGBW) { colorFromUint32(COLOR2_COLDWHITE); effectCurrent = 0; } if (strip.isRgbw) { colorFromUint32(COLOR2_COLDWHITE); effectCurrent = 0; }
else colorFromUint24(COLOR_COLDWHITE); } break; else colorFromUint24(COLOR_COLDWHITE); } break;
case IR44_COLDWHITE2 : { case IR44_COLDWHITE2 : {
if (useRGBW) { colorFromUint32(COLOR2_COLDWHITE2); effectCurrent = 0; } if (strip.isRgbw) { colorFromUint32(COLOR2_COLDWHITE2); effectCurrent = 0; }
else colorFromUint24(COLOR_COLDWHITE2); } break; else colorFromUint24(COLOR_COLDWHITE2); } break;
case IR44_REDPLUS : relativeChange(&effectCurrent, 1, 0, MODE_COUNT); break; case IR44_REDPLUS : relativeChange(&effectCurrent, 1, 0, MODE_COUNT); break;
case IR44_REDMINUS : relativeChange(&effectCurrent, -1, 0); break; case IR44_REDMINUS : relativeChange(&effectCurrent, -1, 0); break;

View File

@ -313,15 +313,15 @@ void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id, bool fo
if (id == strip.getMainSegmentId() && i < 2) //temporary, to make transition work on main segment if (id == strip.getMainSegmentId() && i < 2) //temporary, to make transition work on main segment
{ {
if (i == 0) { if (i == 0) {
colX.add(col[0]); colX.add(col[1]); colX.add(col[2]); if (useRGBW) colX.add(col[3]); colX.add(col[0]); colX.add(col[1]); colX.add(col[2]); if (strip.isRgbw) colX.add(col[3]);
} else { } else {
colX.add(colSec[0]); colX.add(colSec[1]); colX.add(colSec[2]); if (useRGBW) colX.add(colSec[3]); colX.add(colSec[0]); colX.add(colSec[1]); colX.add(colSec[2]); if (strip.isRgbw) colX.add(colSec[3]);
} }
} else { } else {
colX.add((seg.colors[i] >> 16) & 0xFF); colX.add((seg.colors[i] >> 16) & 0xFF);
colX.add((seg.colors[i] >> 8) & 0xFF); colX.add((seg.colors[i] >> 8) & 0xFF);
colX.add((seg.colors[i]) & 0xFF); colX.add((seg.colors[i]) & 0xFF);
if (useRGBW) if (strip.isRgbw)
colX.add((seg.colors[i] >> 24) & 0xFF); colX.add((seg.colors[i] >> 24) & 0xFF);
} }
} }
@ -421,8 +421,8 @@ void serializeInfo(JsonObject root)
JsonObject leds = root.createNestedObject("leds"); JsonObject leds = root.createNestedObject("leds");
leds[F("count")] = ledCount; leds[F("count")] = ledCount;
leds[F("rgbw")] = useRGBW; leds[F("rgbw")] = strip.isRgbw;
leds[F("wv")] = useRGBW && (strip.rgbwMode == RGBW_MODE_MANUAL_ONLY || strip.rgbwMode == RGBW_MODE_DUAL); //should a white channel slider be displayed? leds[F("wv")] = strip.isRgbw && (strip.rgbwMode == RGBW_MODE_MANUAL_ONLY || strip.rgbwMode == RGBW_MODE_DUAL); //should a white channel slider be displayed?
JsonArray leds_pin = leds.createNestedArray("pin"); JsonArray leds_pin = leds.createNestedArray("pin");
leds_pin.add(LEDPIN); leds_pin.add(LEDPIN);

View File

@ -50,14 +50,14 @@ void setAllLeds() {
{ {
strip.setBrightness(scaledBri(briT)); strip.setBrightness(scaledBri(briT));
} }
if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) if (strip.isRgbw && strip.rgbwMode == RGBW_MODE_LEGACY)
{ {
colorRGBtoRGBW(col); colorRGBtoRGBW(col);
colorRGBtoRGBW(colSec); colorRGBtoRGBW(colSec);
} }
strip.setColor(0, col[0], col[1], col[2], col[3]); strip.setColor(0, col[0], col[1], col[2], col[3]);
strip.setColor(1, colSec[0], colSec[1], colSec[2], colSec[3]); strip.setColor(1, colSec[0], colSec[1], colSec[2], colSec[3]);
if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) if (strip.isRgbw && strip.rgbwMode == RGBW_MODE_LEGACY)
{ {
col[3] = 0; colSec[3] = 0; col[3] = 0; colSec[3] = 0;
} }

View File

@ -105,17 +105,22 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
pins[i] = (request->arg(lp).length() > 0) ? request->arg(lp).toInt() : 255; pins[i] = (request->arg(lp).length() > 0) ? request->arg(lp).toInt() : 255;
} }
type = request->arg(lt).toInt(); type = request->arg(lt).toInt();
//if (isRgbw(type)) strip.isRgbw = true; //30fps
//strip.isRgbw = true;
if (request->hasArg(lc) && request->arg(lc).toInt() > 0) { if (request->hasArg(lc) && request->arg(lc).toInt() > 0) {
length = request->arg(lc).toInt(); length = request->arg(lc).toInt();
} else { } else {
break; // no parameter break; // no parameter
} }
colorOrder = request->arg(co).toInt(); colorOrder = request->arg(co).toInt();
start = (request->hasArg(ls)) ? request->arg(ls).toInt() : 0; start = (request->hasArg(ls)) ? request->arg(ls).toInt() : 0;
if (busConfigs[s] != nullptr) delete busConfigs[s]; if (busConfigs[s] != nullptr) delete busConfigs[s];
busConfigs[s] = new BusConfig(type, pins, start, length, colorOrder, request->hasArg(cv)); busConfigs[s] = new BusConfig(type, pins, start, length, colorOrder, request->hasArg(cv));
//if (BusManager::isRgbw(type)) strip.isRgbw = true; //20fps
//strip.isRgbw = true;
doInitBusses = true; doInitBusses = true;
} }
@ -158,7 +163,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
strip.ablMilliampsMax = request->arg(F("MA")).toInt(); strip.ablMilliampsMax = request->arg(F("MA")).toInt();
strip.milliampsPerLed = request->arg(F("LA")).toInt(); strip.milliampsPerLed = request->arg(F("LA")).toInt();
useRGBW = request->hasArg(F("EW"));
strip.rgbwMode = request->arg(F("AW")).toInt(); strip.rgbwMode = request->arg(F("AW")).toInt();
briS = request->arg(F("CA")).toInt(); briS = request->arg(F("CA")).toInt();

View File

@ -241,13 +241,16 @@ void WLED::loop()
doInitBusses = false; doInitBusses = false;
busses.removeAll(); busses.removeAll();
uint32_t mem = 0; uint32_t mem = 0;
strip.isRgbw = false;
for (uint8_t i = 0; i < WLED_MAX_BUSSES; i++) { for (uint8_t i = 0; i < WLED_MAX_BUSSES; i++) {
if (busConfigs[i] == nullptr) break; if (busConfigs[i] == nullptr) break;
mem += busses.memUsage(*busConfigs[i]); mem += busses.memUsage(*busConfigs[i]);
if (mem <= MAX_LED_MEMORY) busses.add(*busConfigs[i]); if (mem <= MAX_LED_MEMORY) busses.add(*busConfigs[i]);
//if (BusManager::isRgbw(busConfigs[i]->type)) strip.isRgbw = true;
strip.isRgbw = (strip.isRgbw || BusManager::isRgbw(busConfigs[i]->type));
delete busConfigs[i]; busConfigs[i] = nullptr; delete busConfigs[i]; busConfigs[i] = nullptr;
} }
strip.finalizeInit(useRGBW, ledCount, skipFirstLed); strip.finalizeInit(ledCount, skipFirstLed);
yield(); yield();
serializeConfig(); serializeConfig();
} }
@ -394,7 +397,7 @@ void WLED::beginStrip()
if (ledCount > MAX_LEDS || ledCount == 0) if (ledCount > MAX_LEDS || ledCount == 0)
ledCount = 30; ledCount = 30;
strip.finalizeInit(useRGBW, ledCount, skipFirstLed); strip.finalizeInit(ledCount, skipFirstLed);
strip.setBrightness(0); strip.setBrightness(0);
strip.setShowCallback(handleOverlayDraw); strip.setShowCallback(handleOverlayDraw);

View File

@ -3,12 +3,12 @@
/* /*
Main sketch, global variable declarations Main sketch, global variable declarations
@title WLED project sketch @title WLED project sketch
@version 0.12.0-b2 @version 0.12.0-b4
@author Christian Schwinne @author Christian Schwinne
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2103230 #define VERSION 2103290
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG
@ -135,12 +135,6 @@
Comment out this error message to build regardless. Comment out this error message to build regardless.
#endif #endif
#if !defined(IRPIN) || IRPIN < 0
#ifndef WLED_DISABLE_INFRARED
#define WLED_DISABLE_INFRARED
#endif
#endif
#ifndef WLED_DISABLE_INFRARED #ifndef WLED_DISABLE_INFRARED
#include <IRremoteESP8266.h> #include <IRremoteESP8266.h>
#include <IRrecv.h> #include <IRrecv.h>
@ -174,7 +168,7 @@
#endif #endif
// Global Variable definitions // Global Variable definitions
WLED_GLOBAL char versionString[] _INIT("0.12.0-b2"); WLED_GLOBAL char versionString[] _INIT("0.12.0-b4");
#define WLED_CODENAME "Hikari" #define WLED_CODENAME "Hikari"
// AP and OTA default passwords (for maximum security change them!) // AP and OTA default passwords (for maximum security change them!)
@ -231,7 +225,6 @@ WLED_GLOBAL bool noWifiSleep _INIT(false); // disabling
// LED CONFIG // LED CONFIG
WLED_GLOBAL uint16_t ledCount _INIT(30); // overcurrent prevented by ABL WLED_GLOBAL uint16_t ledCount _INIT(30); // overcurrent prevented by ABL
WLED_GLOBAL bool useRGBW _INIT(false); // SK6812 strips can contain an extra White channel
WLED_GLOBAL bool turnOnAtBoot _INIT(true); // turn on LEDs at power-up WLED_GLOBAL bool turnOnAtBoot _INIT(true); // turn on LEDs at power-up
WLED_GLOBAL byte bootPreset _INIT(0); // save preset to load after power-up WLED_GLOBAL byte bootPreset _INIT(0); // save preset to load after power-up

View File

@ -143,7 +143,7 @@ void loadSettingsFromEEPROM()
arlsOffset = EEPROM.read(368); arlsOffset = EEPROM.read(368);
if (!EEPROM.read(367)) arlsOffset = -arlsOffset; if (!EEPROM.read(367)) arlsOffset = -arlsOffset;
turnOnAtBoot = EEPROM.read(369); turnOnAtBoot = EEPROM.read(369);
useRGBW = EEPROM.read(372); strip.isRgbw = EEPROM.read(372);
//374 - strip.paletteFade //374 - strip.paletteFade
apBehavior = EEPROM.read(376); apBehavior = EEPROM.read(376);
@ -406,7 +406,7 @@ void deEEP() {
JsonArray colarr = segObj.createNestedArray("col"); JsonArray colarr = segObj.createNestedArray("col");
byte numChannels = (useRGBW)? 4:3; byte numChannels = (strip.isRgbw)? 4:3;
for (uint8_t k = 0; k < 3; k++) //k=0 primary (i+2) k=1 secondary (i+6) k=2 tertiary color (i+12) for (uint8_t k = 0; k < 3; k++) //k=0 primary (i+2) k=1 secondary (i+6) k=2 tertiary color (i+12)
{ {

View File

@ -318,8 +318,7 @@ void getSettingsJS(byte subPage, char* dest)
} }
sappend('v',SET_F("CA"),briS); sappend('v',SET_F("CA"),briS);
//sappend('c',SET_F("EW"),useRGBW);
//sappend('i',SET_F("CO"),strip.getColorOrder());
sappend('v',SET_F("AW"),strip.rgbwMode); sappend('v',SET_F("AW"),strip.rgbwMode);
sappend('c',SET_F("BO"),turnOnAtBoot); sappend('c',SET_F("BO"),turnOnAtBoot);