Main seg replaced by first selected in internal interfaces

Version bump to 0.13.0-b7
Various small improvements
This commit is contained in:
cschwinne 2022-02-23 19:20:07 +01:00
parent 94a0199955
commit ed90b638a9
20 changed files with 113 additions and 102 deletions

View File

@ -45,7 +45,7 @@ body:
attributes: attributes:
label: What version of WLED? label: What version of WLED?
description: You can find this in by going to Config -> Security & Updates -> Scroll to Bottom. Copy and paste the entire line after "Server message" description: You can find this in by going to Config -> Security & Updates -> Scroll to Bottom. Copy and paste the entire line after "Server message"
placeholder: "e.g. WLED 0.13.0-b4 (build 2110110)" placeholder: "e.g. WLED 0.13.0-b7 (build 2202222)"
validations: validations:
required: true required: true
- type: dropdown - type: dropdown

View File

@ -2,6 +2,12 @@
### Builds after release 0.12.0 ### Builds after release 0.12.0
#### Build 2202222
- Version bump to 0.13.0-b7 "Toki"
- Fixed HTTP API commands not applying to all selected segments in some conditions
- Blynk support is not compiled in by default on ESP32 builds
#### Build 2202210 #### Build 2202210
- Fixed HTTP API commands not applying to all selected segments if called from JSON - Fixed HTTP API commands not applying to all selected segments if called from JSON

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "wled", "name": "wled",
"version": "0.13.0-b6", "version": "0.13.0-b7",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

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

View File

@ -35,6 +35,7 @@ default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32s
; default_envs = wemos_shield_esp32 ; default_envs = wemos_shield_esp32
; default_envs = m5atom ; default_envs = m5atom
; default_envs = esp32_eth ; default_envs = esp32_eth
; default_envs = esp32_eth_ota1mapp
; default_envs = esp32s2_saola ; default_envs = esp32s2_saola
src_dir = ./wled00 src_dir = ./wled00
@ -318,7 +319,7 @@ lib_deps = ${esp8266.lib_deps}
board = esp32dev board = esp32dev
platform = ${esp32.platform} platform = ${esp32.platform}
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32 #-D WLED_DISABLE_BROWNOUT_DET build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32 -D WLED_DISABLE_BLYNK #-D WLED_DISABLE_BROWNOUT_DET
lib_deps = ${esp32.lib_deps} lib_deps = ${esp32.lib_deps}
monitor_filters = esp32_exception_decoder monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions} board_build.partitions = ${esp32.default_partitions}
@ -332,6 +333,11 @@ build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_Ethernet -D
lib_deps = ${esp32.lib_deps} lib_deps = ${esp32.lib_deps}
board_build.partitions = ${esp32.default_partitions} board_build.partitions = ${esp32.default_partitions}
# ESP32 ETH build that fits in old 1M app space (disables Blynk, Cronixie, and Hue sync)
[env:esp32_eth_ota1mapp]
extends = env:esp32_eth
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_Ethernet_OTA -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1 -D WLED_DISABLE_BLYNK -D WLED_DISABLE_CRONIXIE -D WLED_DISABLE_HUESYNC
[env:esp32s2_saola] [env:esp32s2_saola]
board = esp32-s2-saola-1 board = esp32-s2-saola-1
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip

View File

@ -468,7 +468,7 @@ public:
void lampUdated() { void lampUdated() {
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification) //call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa // 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa
//setValuesFromMainSeg(); //to make transition work on main segment (should no longer be required) //setValuesFromFirstSelectedSeg(); //to make transition work on main segment (should no longer be required)
stateUpdated(CALL_MODE_BUTTON); stateUpdated(CALL_MODE_BUTTON);
updateInterfaces(CALL_MODE_BUTTON); updateInterfaces(CALL_MODE_BUTTON);
} }

View File

@ -622,6 +622,7 @@ class WS2812FX {
setMode(uint8_t segid, uint8_t m), setMode(uint8_t segid, uint8_t m),
setColor(uint8_t slot, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0), setColor(uint8_t slot, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0),
setColor(uint8_t slot, uint32_t c), setColor(uint8_t slot, uint32_t c),
setCCT(uint16_t k),
setBrightness(uint8_t b), setBrightness(uint8_t b),
setRange(uint16_t i, uint16_t i2, uint32_t col), setRange(uint16_t i, uint16_t i2, uint32_t col),
setShowCallback(show_callback cb), setShowCallback(show_callback cb),
@ -660,6 +661,7 @@ class WS2812FX {
getPaletteCount(void), getPaletteCount(void),
getMaxSegments(void), getMaxSegments(void),
getActiveSegmentsNum(void), getActiveSegmentsNum(void),
getFirstSelectedSegId(void),
getMainSegmentId(void), getMainSegmentId(void),
getLastActiveSegmentId(void), getLastActiveSegmentId(void),
getTargetFps(void), getTargetFps(void),
@ -689,11 +691,11 @@ class WS2812FX {
currentColor(uint32_t colorNew, uint8_t tNr), currentColor(uint32_t colorNew, uint8_t tNr),
gamma32(uint32_t), gamma32(uint32_t),
getLastShow(void), getLastShow(void),
getPixelColor(uint16_t), getPixelColor(uint16_t);
getColor(void);
WS2812FX::Segment WS2812FX::Segment
&getSegment(uint8_t n), &getSegment(uint8_t n),
&getFirstSelectedSeg(void),
&getMainSegment(void); &getMainSegment(void);
WS2812FX::Segment* WS2812FX::Segment*

View File

@ -409,6 +409,15 @@ void WS2812FX::setColor(uint8_t slot, uint32_t c) {
} }
} }
void WS2812FX::setCCT(uint16_t k) {
for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++)
{
if (_segments[i].isActive() && _segments[i].isSelected()) {
_segments[i].setCCT(k, i);
}
}
}
void WS2812FX::setBrightness(uint8_t b) { void WS2812FX::setBrightness(uint8_t b) {
if (gammaCorrectBri) b = gamma8(b); if (gammaCorrectBri) b = gamma8(b);
if (_brightness == b) return; if (_brightness == b) return;
@ -431,18 +440,19 @@ uint8_t WS2812FX::getMaxSegments(void) {
return MAX_NUM_SEGMENTS; return MAX_NUM_SEGMENTS;
} }
void WS2812FX::setMainSegmentId(uint8_t n) { uint8_t WS2812FX::getFirstSelectedSegId(void)
if (n >= MAX_NUM_SEGMENTS) return; {
if (_segments[n].isActive() && _segments[n].isSelected()) {
_mainSegment = n; return;
}
for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++)
{ {
if (_segments[i].isActive() && _segments[i].isSelected()) { if (_segments[i].isActive() && _segments[i].isSelected()) return i;
_mainSegment = i; return;
}
} }
//if none selected, use supplied n if active, or first active // if none selected, use the main segment
return getMainSegmentId();
}
void WS2812FX::setMainSegmentId(uint8_t n) {
if (n >= MAX_NUM_SEGMENTS) return;
//use supplied n if active, or first active
if (_segments[n].isActive()) { if (_segments[n].isActive()) {
_mainSegment = n; return; _mainSegment = n; return;
} }
@ -476,10 +486,6 @@ uint8_t WS2812FX::getActiveSegmentsNum(void) {
return c; return c;
} }
uint32_t WS2812FX::getColor(void) {
return _segments[getMainSegmentId()].colors[0];
}
uint32_t WS2812FX::getPixelColor(uint16_t i) uint32_t WS2812FX::getPixelColor(uint16_t i)
{ {
i = realPixelIndex(i); i = realPixelIndex(i);
@ -501,6 +507,10 @@ WS2812FX::Segment& WS2812FX::getSegment(uint8_t id) {
return _segments[id]; return _segments[id];
} }
WS2812FX::Segment& WS2812FX::getFirstSelectedSeg(void) {
return _segments[getFirstSelectedSegId()];
}
WS2812FX::Segment& WS2812FX::getMainSegment(void) { WS2812FX::Segment& WS2812FX::getMainSegment(void) {
return _segments[getMainSegmentId()]; return _segments[getMainSegmentId()];
} }
@ -629,7 +639,7 @@ void WS2812FX::setSegment(uint8_t n, uint16_t i1, uint16_t i2, uint8_t grouping,
delete[] seg.name; delete[] seg.name;
seg.name = nullptr; seg.name = nullptr;
} }
//if main segment is deleted, set first selected/active as main segment // if main segment is deleted, set first active as main segment
if (n == _mainSegment) setMainSegmentId(0); if (n == _mainSegment) setMainSegmentId(0);
return; return;
} }

View File

@ -72,36 +72,32 @@ void onAlexaChange(EspalexaDevice* dev)
{ {
if (espalexaDevice->getColorMode() == EspalexaColorMode::ct) //shade of white if (espalexaDevice->getColorMode() == EspalexaColorMode::ct) //shade of white
{ {
byte rgbw[4];
uint16_t ct = espalexaDevice->getCt(); uint16_t ct = espalexaDevice->getCt();
if (!ct) return; if (!ct) return;
uint16_t k = 1000000 / ct; //mireds to kelvin uint16_t k = 1000000 / ct; //mireds to kelvin
if (strip.hasCCTBus()) { if (strip.hasCCTBus()) {
uint8_t segid = strip.getMainSegmentId(); strip.setCCT(k);
WS2812FX::Segment& seg = strip.getSegment(segid); rgbw[0]= 0; rgbw[1]= 0; rgbw[2]= 0; rgbw[3]= 255;
seg.setCCT(k, segid);
col[0]= 0; col[1]= 0; col[2]= 0; col[3]= 255;
} else if (strip.hasWhiteChannel()) { } else if (strip.hasWhiteChannel()) {
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: rgbw[0]=255; rgbw[1]=255; rgbw[2]=255; rgbw[3]=255; break;
case 234: col[0]=127; col[1]=127; col[2]=127; col[3]=255; break; case 234: rgbw[0]=127; rgbw[1]=127; rgbw[2]=127; rgbw[3]=255; break;
case 284: col[0]= 0; col[1]= 0; col[2]= 0; col[3]=255; break; case 284: rgbw[0]= 0; rgbw[1]= 0; rgbw[2]= 0; rgbw[3]=255; break;
case 350: col[0]=130; col[1]= 90; col[2]= 0; col[3]=255; break; case 350: rgbw[0]=130; rgbw[1]= 90; rgbw[2]= 0; rgbw[3]=255; break;
case 383: col[0]=255; col[1]=153; col[2]= 0; col[3]=255; break; case 383: rgbw[0]=255; rgbw[1]=153; rgbw[2]= 0; rgbw[3]=255; break;
default : colorKtoRGB(k, col); default : colorKtoRGB(k, rgbw);
} }
} else { } else {
colorKtoRGB(k, col); colorKtoRGB(k, rgbw);
} }
strip.setColor(0, rgbw[0], rgbw[1], rgbw[2], rgbw[3]);
} else { } else {
uint32_t color = espalexaDevice->getRGB(); uint32_t color = espalexaDevice->getRGB();
strip.setColor(0, color);
col[0] = ((color >> 16) & 0xFF);
col[1] = ((color >> 8) & 0xFF);
col[2] = ( color & 0xFF);
col[3] = 0;
} }
colorUpdated(CALL_MODE_ALEXA); stateUpdated(CALL_MODE_ALEXA);
} }
} }

View File

@ -144,7 +144,7 @@ bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient = 0);
#endif #endif
//led.cpp //led.cpp
void setValuesFromMainSeg(); void setValuesFromFirstSelectedSeg();
void resetTimebase(); void resetTimebase();
void toggleOnOff(); void toggleOnOff();
void applyBri(); void applyBri();

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.13.0-b6<br>Download the latest binary: <a Installed version: 0.13.0-b7<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" required><br><input </a><br><input type="file" class="bt" name="update" required><br><input

View File

@ -451,7 +451,7 @@ onclick='uploadFile(d.Sf.data2,"/cfg.json")'><br></div><div style="color:#fa0">
Incorrect configuration may require a factory reset or re-flashing of your ESP. Incorrect configuration may require a factory reset or re-flashing of your ESP.
</div>For security reasons, passwords are not backed up.<h3>About</h3><a </div>For security reasons, passwords are not backed up.<h3>About</h3><a
href="https://github.com/Aircoookie/WLED/" target="_blank">WLED</a> href="https://github.com/Aircoookie/WLED/" target="_blank">WLED</a>
version 0.13.0-b6<br><br><a version 0.13.0-b7<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>

View File

@ -189,7 +189,7 @@ void sendImprovInfoResponse() {
out[11] = 4; //Firmware len ("WLED") out[11] = 4; //Firmware len ("WLED")
out[12] = 'W'; out[13] = 'L'; out[14] = 'E'; out[15] = 'D'; out[12] = 'W'; out[13] = 'L'; out[14] = 'E'; out[15] = 'D';
uint8_t lengthSum = 17; uint8_t lengthSum = 17;
uint8_t vlen = sprintf_P(out+lengthSum,PSTR("0.13.0-b6/%i"),VERSION); uint8_t vlen = sprintf_P(out+lengthSum,PSTR("0.13.0-b7/%i"),VERSION);
out[16] = vlen; lengthSum += vlen; out[16] = vlen; lengthSum += vlen;
uint8_t hlen = 7; uint8_t hlen = 7;
#ifdef ESP8266 #ifdef ESP8266

View File

@ -135,7 +135,7 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
byte sz = colX.size(); byte sz = colX.size();
if (sz == 0) continue; //do nothing on empty array if (sz == 0) continue; //do nothing on empty array
byte cp = copyArray(colX, rgbw, 4); copyArray(colX, rgbw, 4);
colValid = true; colValid = true;
} }
@ -328,9 +328,6 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
} }
} }
//refresh main segment (ensure it is selected, if there are any selected segments)
strip.setMainSegmentId(strip.getMainSegmentId());
#ifndef WLED_DISABLE_CRONIXIE #ifndef WLED_DISABLE_CRONIXIE
if (root["nx"].is<const char*>()) { if (root["nx"].is<const char*>()) {
strncpy(cronixieDisplay, root["nx"], 6); strncpy(cronixieDisplay, root["nx"], 6);

View File

@ -3,9 +3,9 @@
/* /*
* LED methods * LED methods
*/ */
void setValuesFromMainSeg() void setValuesFromFirstSelectedSeg()
{ {
WS2812FX::Segment& seg = strip.getMainSegment(); WS2812FX::Segment& seg = strip.getFirstSelectedSeg();
colorFromUint32(seg.colors[0]); colorFromUint32(seg.colors[0]);
colorFromUint32(seg.colors[1], true); colorFromUint32(seg.colors[1], true);
effectCurrent = seg.mode; effectCurrent = seg.mode;
@ -15,28 +15,30 @@ void setValuesFromMainSeg()
} }
//applies global legacy values (col, colSec, effectCurrent...) // applies global legacy values (col, colSec, effectCurrent...)
// problem: if the first selected segment already has the value to be set, other selected segments are not updated
void applyValuesToSelectedSegs() void applyValuesToSelectedSegs()
{ {
//copy of main segment to tell if value was updated // copy of first selected segment to tell if value was updated
WS2812FX::Segment mainsegPrev = strip.getMainSegment(); uint8_t firstSel = strip.getFirstSelectedSegId();
WS2812FX::Segment selsegPrev = strip.getSegment(firstSel);
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) { for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
WS2812FX::Segment& seg = strip.getSegment(i); WS2812FX::Segment& seg = strip.getSegment(i);
if (i != strip.getMainSegmentId() && (!seg.isActive() || !seg.isSelected())) continue; if (i != firstSel && (!seg.isActive() || !seg.isSelected())) continue;
if (effectSpeed != mainsegPrev.speed) { if (effectSpeed != selsegPrev.speed) {
seg.speed = effectSpeed; stateChanged = true;} seg.speed = effectSpeed; stateChanged = true;}
if (effectIntensity != mainsegPrev.intensity) { if (effectIntensity != selsegPrev.intensity) {
seg.intensity = effectIntensity; stateChanged = true;} seg.intensity = effectIntensity; stateChanged = true;}
if (effectPalette != mainsegPrev.palette) { if (effectPalette != selsegPrev.palette) {
seg.palette = effectPalette; stateChanged = true;} seg.palette = effectPalette; stateChanged = true;}
if (effectCurrent != mainsegPrev.mode) { if (effectCurrent != selsegPrev.mode) {
strip.setMode(i, effectCurrent); stateChanged = true;} strip.setMode(i, effectCurrent); stateChanged = true;}
uint32_t col0 = RGBW32(col[0],col[1],col[2],col[3]); uint32_t col0 = RGBW32(col[0],col[1],col[2],col[3]);
uint32_t col1 = RGBW32(colSec[0], colSec[1], colSec[2], colSec[3]); uint32_t col1 = RGBW32(colSec[0], colSec[1], colSec[2], colSec[3]);
if (col0 != mainsegPrev.colors[0]) { if (col0 != selsegPrev.colors[0]) {
seg.setColor(0, col0, i); stateChanged = true;} seg.setColor(0, col0, i); stateChanged = true;}
if (col1 != mainsegPrev.colors[1]) { if (col1 != selsegPrev.colors[1]) {
seg.setColor(1, col1, i); stateChanged = true;} seg.setColor(1, col1, i); stateChanged = true;}
} }
} }
@ -92,7 +94,7 @@ void applyFinalBri() {
void stateUpdated(byte callMode) { void stateUpdated(byte callMode) {
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification) //call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa 11: ws send only 12: button preset // 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa 11: ws send only 12: button preset
setValuesFromMainSeg(); setValuesFromFirstSelectedSeg();
if (bri != briOld || stateChanged) { if (bri != briOld || stateChanged) {
if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0; if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0;
@ -232,7 +234,7 @@ void handleNightlight()
colNlT[1] = effectSpeed; colNlT[1] = effectSpeed;
colNlT[2] = effectPalette; colNlT[2] = effectPalette;
strip.setMode(strip.getMainSegmentId(), FX_MODE_STATIC); //make sure seg runtime is reset if left in sunrise mode strip.setMode(strip.getFirstSelectedSegId(), FX_MODE_STATIC); // make sure seg runtime is reset if it was in sunrise mode
effectCurrent = FX_MODE_SUNRISE; effectCurrent = FX_MODE_SUNRISE;
effectSpeed = nightlightDelayMins; effectSpeed = nightlightDelayMins;
effectPalette = 0; effectPalette = 0;

View File

@ -604,13 +604,12 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
DEBUG_PRINTLN(req); DEBUG_PRINTLN(req);
//segment select (sets main segment) //segment select (sets main segment)
byte prevMain = strip.getMainSegmentId();
pos = req.indexOf(F("SM=")); pos = req.indexOf(F("SM="));
if (pos > 0) { if (pos > 0) {
strip.setMainSegmentId(getNumVal(&req, pos)); strip.setMainSegmentId(getNumVal(&req, pos));
} }
byte selectedSeg = strip.getMainSegmentId();
if (selectedSeg != prevMain) setValuesFromMainSeg(); byte selectedSeg = strip.getFirstSelectedSegId();
bool singleSegment = false; bool singleSegment = false;
@ -631,7 +630,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
selseg.setOption(SEG_OPTION_SELECTED, t); selseg.setOption(SEG_OPTION_SELECTED, t);
} }
// temporary values, write directly to segments, globals are updated by setValuesFromMainSeg() // temporary values, write directly to segments, globals are updated by setValuesFromFirstSelectedSeg()
uint32_t col0 = selseg.colors[0]; uint32_t col0 = selseg.colors[0];
uint32_t col1 = selseg.colors[1]; uint32_t col1 = selseg.colors[1];
byte colIn[4] = {R(col0), G(col0), B(col0), W(col0)}; byte colIn[4] = {R(col0), G(col0), B(col0), W(col0)};
@ -969,13 +968,13 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
// global col[], effectCurrent, ... are updated in stateChanged() // global col[], effectCurrent, ... are updated in stateChanged()
if (!apply) return true; // when called by JSON API, do not call colorUpdated() here if (!apply) return true; // when called by JSON API, do not call colorUpdated() here
//internal call, does not send XML response
pos = req.indexOf(F("IN"));
if (pos < 1) XML_response(request);
pos = req.indexOf(F("&NN")); //do not send UDP notifications this time pos = req.indexOf(F("&NN")); //do not send UDP notifications this time
stateUpdated((pos > 0) ? CALL_MODE_NO_NOTIFY : CALL_MODE_DIRECT_CHANGE); stateUpdated((pos > 0) ? CALL_MODE_NO_NOTIFY : CALL_MODE_DIRECT_CHANGE);
// internal call, does not send XML response
pos = req.indexOf(F("IN"));
if (pos < 1) XML_response(request);
return true; return true;
} }

View File

@ -292,28 +292,19 @@ void handleNotifications()
//apply colors from notification to main segment, only if not syncing full segments //apply colors from notification to main segment, only if not syncing full segments
if ((receiveNotificationColor || !someSel) && (version < 11 || !receiveSegmentOptions)) { if ((receiveNotificationColor || !someSel) && (version < 11 || !receiveSegmentOptions)) {
col[0] = udpIn[3]; // primary color, only apply white if intented (version > 0)
col[1] = udpIn[4]; strip.setColor(0, RGBW32(udpIn[3], udpIn[4], udpIn[5], (version > 0) ? udpIn[10] : 0));
col[2] = udpIn[5]; if (version > 1) {
if (version > 0) //sending module's white val is intended strip.setColor(1, RGBW32(udpIn[12], udpIn[13], udpIn[14], udpIn[15])); // secondary color
{ }
col[3] = udpIn[10]; if (version > 6) {
if (version > 1) { strip.setColor(2, RGBW32(udpIn[20], udpIn[21], udpIn[22], udpIn[23])); // tertiary color
colSec[0] = udpIn[12]; if (version > 9 && version < 200 && udpIn[37] < 255) { // valid CCT/Kelvin value
colSec[1] = udpIn[13]; uint8_t cct = udpIn[38];
colSec[2] = udpIn[14]; if (udpIn[37] > 0) { //Kelvin
colSec[3] = udpIn[15]; cct = (((udpIn[37] << 8) + udpIn[38]) - 1900) >> 5;
}
if (version > 6) {
strip.setColor(2, RGBW32(udpIn[20], udpIn[21], udpIn[22], udpIn[23])); //tertiary color
if (version > 9 && version < 200 && udpIn[37] < 255) { //valid CCT/Kelvin value
uint8_t cct = udpIn[38];
if (udpIn[37] > 0) { //Kelvin
cct = (((udpIn[37] << 8) + udpIn[38]) - 1900) >> 5;
}
uint8_t segid = strip.getMainSegmentId();
strip.getSegment(segid).setCCT(cct, segid);
} }
strip.setCCT(cct);
} }
} }
} }
@ -362,11 +353,17 @@ void handleNotifications()
stateChanged = true; stateChanged = true;
} }
if (applyEffects && (version < 11 || !receiveSegmentOptions)) { //simple effect sync, applies to all selected // simple effect sync, applies to all selected segments
if (udpIn[8] < strip.getModeCount()) effectCurrent = udpIn[8]; if (applyEffects && (version < 11 || !receiveSegmentOptions)) {
effectSpeed = udpIn[9]; for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
if (version > 2) effectIntensity = udpIn[16]; WS2812FX::Segment& seg = strip.getSegment(i);
if (version > 4 && udpIn[19] < strip.getPaletteCount()) effectPalette = udpIn[19]; if (!seg.isActive() || !seg.isSelected()) continue;
if (udpIn[8] < strip.getModeCount()) strip.setMode(i, udpIn[8]);
seg.speed = udpIn[9];
if (version > 2) seg.intensity = udpIn[16];
if (version > 4 && udpIn[19] < strip.getPaletteCount()) seg.palette = udpIn[19];
}
stateChanged = true;
} }
if (applyEffects && version > 5) { if (applyEffects && version > 5) {
@ -411,7 +408,7 @@ void handleNotifications()
if (nightlightActive) nightlightDelayMins = udpIn[7]; if (nightlightActive) nightlightDelayMins = udpIn[7];
if (receiveNotificationBrightness || !someSel) bri = udpIn[2]; if (receiveNotificationBrightness || !someSel) bri = udpIn[2];
colorUpdated(CALL_MODE_NOTIFICATION); stateUpdated(CALL_MODE_NOTIFICATION);
return; return;
} }

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.13.0-b6 @version 0.13.0-b7
@author Christian Schwinne @author Christian Schwinne
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2202211 #define VERSION 2202222
//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

View File

@ -439,11 +439,7 @@ void deEEP() {
strip.getSegment(j).setOption(SEG_OPTION_ON, 1); strip.getSegment(j).setOption(SEG_OPTION_ON, 1);
} }
} }
setValuesFromMainSeg();
serializeState(pObj, true, false, true); serializeState(pObj, true, false, true);
strip.resetSegments();
setValuesFromMainSeg();
} }
} }

View File

@ -70,7 +70,7 @@ void XML_response(AsyncWebServerRequest *request, char* dest)
oappend(SET_F(" (live)")); oappend(SET_F(" (live)"));
} }
oappend(SET_F("</ds><ss>")); oappend(SET_F("</ds><ss>"));
oappendi(strip.getMainSegmentId()); oappendi(strip.getFirstSelectedSegId());
oappend(SET_F("</ss></vs>")); oappend(SET_F("</ss></vs>"));
if (request != nullptr) request->send(200, "text/xml", obuf); if (request != nullptr) request->send(200, "text/xml", obuf);
} }