Merge branch 'master' into merge-master

This commit is contained in:
Blaž Kristan 2022-02-24 13:43:12 +01:00
commit 23d7c3d0fe
20 changed files with 2514 additions and 2497 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

View File

@ -12,7 +12,7 @@
; default_envs = travis_esp8266, travis_esp32 ; default_envs = travis_esp8266, travis_esp32
# Release binaries # Release binaries
default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32s2_saola, esp32c3 default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32_eth_ota1mapp, esp32s2_saola, esp32c3
# Build everything # Build everything
; default_envs = esp32dev, esp8285_4CH_MagicHome, codm-controller-0.6-rev2, codm-controller-0.6, esp32s2_saola, d1_mini_5CH_Shojo_PCB, d1_mini, sp501e, travis_esp8266, travis_esp32, nodemcuv2, esp32_eth, anavi_miracle_controller, esp07, esp01_1m_full, m5atom, h803wf, d1_mini_ota, heltec_wifi_kit_8, esp8285_H801, d1_mini_debug, wemos_shield_esp32, elekstube_ips ; default_envs = esp32dev, esp8285_4CH_MagicHome, codm-controller-0.6-rev2, codm-controller-0.6, esp32s2_saola, d1_mini_5CH_Shojo_PCB, d1_mini, sp501e, travis_esp8266, travis_esp32, nodemcuv2, esp32_eth, anavi_miracle_controller, esp07, esp01_1m_full, m5atom, h803wf, d1_mini_ota, heltec_wifi_kit_8, esp8285_H801, d1_mini_debug, wemos_shield_esp32, elekstube_ips
@ -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
@ -265,7 +266,9 @@ lib_deps = ${esp8266.lib_deps}
[env:esp8266_2m] [env:esp8266_2m]
board = esp_wroom_02 board = esp_wroom_02
platform = ${common.platform_wled_default} platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k} board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP02 build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP02
lib_deps = ${esp8266.lib_deps} lib_deps = ${esp8266.lib_deps}
@ -320,7 +323,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}
@ -334,6 +337,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

@ -461,7 +461,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()];
} }
@ -630,7 +640,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, RGBW32(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

@ -142,7 +142,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();

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
// Autogenerated from wled00/data/style.css, do not edit!! // Autogenerated from wled00/data/style.css, do not edit!!
const uint16_t PAGE_settingsCss_length = 807; const uint16_t PAGE_settingsCss_length = 807;
const uint8_t PAGE_settingsCss[] PROGMEM = { const uint8_t PAGE_settingsCss[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x55, 0x5d, 0x6f, 0x9b, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x55, 0x5d, 0x6f, 0x9b, 0x30,
0x14, 0xfd, 0x2b, 0x4c, 0x51, 0xa5, 0x4e, 0x0a, 0x08, 0x08, 0xd0, 0xcc, 0x68, 0xd2, 0xb4, 0xf7, 0x14, 0xfd, 0x2b, 0x4c, 0x51, 0xa5, 0x4e, 0x0a, 0x08, 0x08, 0xd0, 0xcc, 0x68, 0xd2, 0xb4, 0xf7,
0xbd, 0x55, 0xd3, 0xa4, 0xa9, 0x0f, 0x06, 0x5f, 0x82, 0x15, 0x63, 0x23, 0xdb, 0xac, 0xa4, 0x88, 0xbd, 0x55, 0xd3, 0xa4, 0xa9, 0x0f, 0x06, 0x5f, 0x82, 0x15, 0x63, 0x23, 0xdb, 0xac, 0xa4, 0x88,
0xff, 0x3e, 0x9b, 0x8f, 0x42, 0x52, 0xd4, 0xbe, 0x54, 0x51, 0xa2, 0xe0, 0x6b, 0xae, 0xcf, 0xbd, 0xff, 0x3e, 0x9b, 0x8f, 0x42, 0x52, 0xd4, 0xbe, 0x54, 0x51, 0xa2, 0xe0, 0x6b, 0xae, 0xcf, 0xbd,
@ -65,7 +65,7 @@ const uint8_t PAGE_settingsCss[] PROGMEM = {
// Autogenerated from wled00/data/settings.htm, do not edit!! // Autogenerated from wled00/data/settings.htm, do not edit!!
const uint16_t PAGE_settings_length = 670; const uint16_t PAGE_settings_length = 670;
const uint8_t PAGE_settings[] PROGMEM = { const uint8_t PAGE_settings[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x8d, 0x54, 0xdb, 0x6e, 0xdb, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x8d, 0x54, 0xdb, 0x6e, 0xdb, 0x30,
0x0c, 0x7d, 0xf7, 0x57, 0x68, 0x2e, 0x36, 0x24, 0x40, 0xdc, 0xb4, 0xe9, 0x30, 0x0c, 0xbe, 0x64, 0x0c, 0x7d, 0xf7, 0x57, 0x68, 0x2e, 0x36, 0x24, 0x40, 0xdc, 0xb4, 0xe9, 0x30, 0x0c, 0xbe, 0x64,
0x40, 0xd7, 0x6e, 0x2b, 0xb0, 0xa2, 0x05, 0x7a, 0xdb, 0x1e, 0x65, 0x89, 0x76, 0xb8, 0x5a, 0x92, 0x40, 0xd7, 0x6e, 0x2b, 0xb0, 0xa2, 0x05, 0x7a, 0xdb, 0x1e, 0x65, 0x89, 0x76, 0xb8, 0x5a, 0x92,
0x21, 0xd1, 0x69, 0xb2, 0x20, 0xff, 0x3e, 0xd9, 0x49, 0xd3, 0xae, 0x5d, 0xb0, 0xbc, 0x18, 0x26, 0x21, 0xd1, 0x69, 0xb2, 0x20, 0xff, 0x3e, 0xd9, 0x49, 0xd3, 0xae, 0x5d, 0xb0, 0xbc, 0x18, 0x26,
@ -113,7 +113,7 @@ const uint8_t PAGE_settings[] PROGMEM = {
// Autogenerated from wled00/data/settings_wifi.htm, do not edit!! // Autogenerated from wled00/data/settings_wifi.htm, do not edit!!
const uint16_t PAGE_settings_wifi_length = 1240; const uint16_t PAGE_settings_wifi_length = 1240;
const uint8_t PAGE_settings_wifi[] PROGMEM = { const uint8_t PAGE_settings_wifi[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x57, 0x6d, 0x6f, 0xe2, 0x46, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x57, 0x6d, 0x6f, 0xe2, 0x46,
0x10, 0xfe, 0xee, 0x5f, 0xb1, 0xdd, 0x4a, 0x15, 0x48, 0x60, 0xde, 0x9a, 0x28, 0xa2, 0x36, 0x57, 0x10, 0xfe, 0xee, 0x5f, 0xb1, 0xdd, 0x4a, 0x15, 0x48, 0x60, 0xde, 0x9a, 0x28, 0xa2, 0x36, 0x57,
0x02, 0x34, 0x44, 0xba, 0xe6, 0xa8, 0x40, 0x8d, 0xfa, 0xe9, 0xb4, 0xd8, 0x03, 0xde, 0xc6, 0xde, 0x02, 0x34, 0x44, 0xba, 0xe6, 0xa8, 0x40, 0x8d, 0xfa, 0xe9, 0xb4, 0xd8, 0x03, 0xde, 0xc6, 0xde,
0xf5, 0x79, 0xd7, 0x18, 0x74, 0xbd, 0xff, 0xde, 0x59, 0xdb, 0xbc, 0x87, 0xf4, 0x1a, 0xa1, 0x28, 0xf5, 0x79, 0xd7, 0x18, 0x74, 0xbd, 0xff, 0xde, 0x59, 0xdb, 0xbc, 0x87, 0xf4, 0x1a, 0xa1, 0x28,
@ -197,7 +197,7 @@ const uint8_t PAGE_settings_wifi[] PROGMEM = {
// Autogenerated from wled00/data/settings_leds.htm, do not edit!! // Autogenerated from wled00/data/settings_leds.htm, do not edit!!
const uint16_t PAGE_settings_leds_length = 6911; const uint16_t PAGE_settings_leds_length = 6911;
const uint8_t PAGE_settings_leds[] PROGMEM = { const uint8_t PAGE_settings_leds[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xdd, 0x3c, 0x6b, 0x57, 0xeb, 0x46, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xdd, 0x3c, 0x6b, 0x57, 0xeb, 0x46,
0x92, 0xdf, 0xfd, 0x2b, 0x9a, 0x4e, 0x42, 0xa4, 0x41, 0x18, 0xc9, 0x0f, 0xc2, 0xb5, 0x2d, 0xb3, 0x92, 0xdf, 0xfd, 0x2b, 0x9a, 0x4e, 0x42, 0xa4, 0x41, 0x18, 0xc9, 0x0f, 0xc2, 0xb5, 0x2d, 0xb3,
0x98, 0xfb, 0x08, 0x3b, 0x90, 0xcb, 0xc1, 0x24, 0x99, 0x39, 0x77, 0xee, 0x09, 0x6d, 0xb9, 0x6d, 0x98, 0xfb, 0x08, 0x3b, 0x90, 0xcb, 0xc1, 0x24, 0x99, 0x39, 0x77, 0xee, 0x09, 0x6d, 0xb9, 0x6d,
0xeb, 0x22, 0x4b, 0x1e, 0x49, 0x06, 0xbc, 0xe0, 0xfd, 0x4d, 0xfb, 0x1b, 0xf6, 0x97, 0x6d, 0x55, 0xeb, 0x22, 0x4b, 0x1e, 0x49, 0x06, 0xbc, 0xe0, 0xfd, 0x4d, 0xfb, 0x1b, 0xf6, 0x97, 0x6d, 0x55,
@ -635,7 +635,7 @@ const uint8_t PAGE_settings_leds[] PROGMEM = {
// Autogenerated from wled00/data/settings_dmx.htm, do not edit!! // Autogenerated from wled00/data/settings_dmx.htm, do not edit!!
const uint16_t PAGE_settings_dmx_length = 1324; const uint16_t PAGE_settings_dmx_length = 1324;
const uint8_t PAGE_settings_dmx[] PROGMEM = { const uint8_t PAGE_settings_dmx[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x95, 0x56, 0x5b, 0x6f, 0xdb, 0x36, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x95, 0x56, 0x5b, 0x6f, 0xdb, 0x36,
0x14, 0x7e, 0xd7, 0xaf, 0x60, 0xf9, 0x62, 0x09, 0x71, 0x25, 0x2b, 0x99, 0xbb, 0xd5, 0x91, 0x94, 0x14, 0x7e, 0xd7, 0xaf, 0x60, 0xf9, 0x62, 0x09, 0x71, 0x25, 0x2b, 0x99, 0xbb, 0xd5, 0x91, 0x94,
0xd5, 0x4e, 0xe0, 0x04, 0x68, 0xb2, 0xa2, 0x6e, 0xd7, 0x0d, 0xcb, 0x30, 0xd0, 0x12, 0x6d, 0xb1, 0xd5, 0x4e, 0xe0, 0x04, 0x68, 0xb2, 0xa2, 0x6e, 0xd7, 0x0d, 0xcb, 0x30, 0xd0, 0x12, 0x6d, 0xb1,
0x91, 0x48, 0x8d, 0xa4, 0xec, 0xb8, 0xc3, 0xfe, 0xfb, 0x0e, 0x45, 0x49, 0x76, 0xd3, 0xa6, 0x5d, 0x91, 0x48, 0x8d, 0xa4, 0xec, 0xb8, 0xc3, 0xfe, 0xfb, 0x0e, 0x45, 0x49, 0x76, 0xd3, 0xa6, 0x5d,
@ -724,7 +724,7 @@ const uint8_t PAGE_settings_dmx[] PROGMEM = {
// Autogenerated from wled00/data/settings_ui.htm, do not edit!! // Autogenerated from wled00/data/settings_ui.htm, do not edit!!
const uint16_t PAGE_settings_ui_length = 2784; const uint16_t PAGE_settings_ui_length = 2784;
const uint8_t PAGE_settings_ui[] PROGMEM = { const uint8_t PAGE_settings_ui[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x59, 0x6b, 0x73, 0xdb, 0xb8, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x59, 0x6b, 0x73, 0xdb, 0xb8,
0x15, 0xfd, 0xae, 0x5f, 0x81, 0x20, 0x19, 0xaf, 0x38, 0x66, 0x68, 0xd9, 0xd9, 0x4e, 0x13, 0x49, 0x15, 0xfd, 0xae, 0x5f, 0x81, 0x20, 0x19, 0xaf, 0x38, 0x66, 0x68, 0xd9, 0xd9, 0x4e, 0x13, 0x49,
0x94, 0x1b, 0x3f, 0x92, 0xb8, 0xe3, 0x34, 0x69, 0x64, 0x37, 0xbb, 0x93, 0xf1, 0x78, 0x21, 0x12, 0x94, 0x1b, 0x3f, 0x92, 0xb8, 0xe3, 0x34, 0x69, 0x64, 0x37, 0xbb, 0x93, 0xf1, 0x78, 0x21, 0x12,
0x92, 0x10, 0x83, 0x00, 0x97, 0x00, 0x6d, 0xab, 0x8a, 0xfe, 0x7b, 0xef, 0x05, 0x48, 0x89, 0x92, 0x92, 0x10, 0x83, 0x00, 0x97, 0x00, 0x6d, 0xab, 0x8a, 0xfe, 0x7b, 0xef, 0x05, 0x48, 0x89, 0x92,
@ -904,7 +904,7 @@ const uint8_t PAGE_settings_ui[] PROGMEM = {
// Autogenerated from wled00/data/settings_sync.htm, do not edit!! // Autogenerated from wled00/data/settings_sync.htm, do not edit!!
const uint16_t PAGE_settings_sync_length = 2814; const uint16_t PAGE_settings_sync_length = 2814;
const uint8_t PAGE_settings_sync[] PROGMEM = { const uint8_t PAGE_settings_sync[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x95, 0x1a, 0x5b, 0x77, 0xda, 0x38, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x95, 0x1a, 0x5b, 0x77, 0xda, 0x38,
0xf3, 0xdd, 0xbf, 0x42, 0xeb, 0x87, 0x6e, 0xd8, 0x12, 0x30, 0x10, 0x68, 0x4a, 0xb0, 0xfb, 0x85, 0xf3, 0xdd, 0xbf, 0x42, 0xeb, 0x87, 0x6e, 0xd8, 0x12, 0x30, 0x10, 0x68, 0x4a, 0xb0, 0xfb, 0x85,
0x90, 0x26, 0x39, 0xdb, 0x34, 0x14, 0xd2, 0xed, 0xee, 0xd3, 0x1e, 0x61, 0x0b, 0x70, 0xb0, 0x2d, 0x90, 0x26, 0x39, 0xdb, 0x34, 0x14, 0xd2, 0xed, 0xee, 0xd3, 0x1e, 0x61, 0x0b, 0x70, 0xb0, 0x2d,
0xaf, 0x25, 0xe7, 0x72, 0xf6, 0xec, 0x7f, 0xff, 0x66, 0x24, 0xdb, 0x80, 0xb9, 0xf6, 0x21, 0x46, 0xaf, 0x25, 0xe7, 0x72, 0xf6, 0xec, 0x7f, 0xff, 0x66, 0x24, 0xdb, 0x80, 0xb9, 0xf6, 0x21, 0x46,
@ -1086,7 +1086,7 @@ const uint8_t PAGE_settings_sync[] PROGMEM = {
// Autogenerated from wled00/data/settings_time.htm, do not edit!! // Autogenerated from wled00/data/settings_time.htm, do not edit!!
const uint16_t PAGE_settings_time_length = 2954; const uint16_t PAGE_settings_time_length = 2954;
const uint8_t PAGE_settings_time[] PROGMEM = { const uint8_t PAGE_settings_time[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xcd, 0x1a, 0x6b, 0x73, 0xda, 0xb8, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xcd, 0x1a, 0x6b, 0x73, 0xda, 0xb8,
0xf6, 0xbb, 0x7f, 0x85, 0xea, 0x76, 0xb2, 0xb0, 0xe1, 0x9d, 0x92, 0x12, 0xc0, 0xee, 0x25, 0x40, 0xf6, 0xbb, 0x7f, 0x85, 0xea, 0x76, 0xb2, 0xb0, 0xe1, 0x9d, 0x92, 0x12, 0xc0, 0xee, 0x25, 0x40,
0x9b, 0xb6, 0x81, 0x64, 0x0a, 0xdd, 0xec, 0xf6, 0x31, 0x5b, 0x61, 0x0b, 0x70, 0x62, 0x24, 0xae, 0x9b, 0xb6, 0x81, 0x64, 0x0a, 0xdd, 0xec, 0xf6, 0x31, 0x5b, 0x61, 0x0b, 0x70, 0x62, 0x24, 0xae,
0x25, 0x87, 0xe4, 0xa6, 0xf9, 0xef, 0xf7, 0xc8, 0xb2, 0x0d, 0x26, 0x18, 0x92, 0x6e, 0xef, 0xcc, 0x25, 0x87, 0xe4, 0xa6, 0xf9, 0xef, 0xf7, 0xc8, 0xb2, 0x0d, 0x26, 0x18, 0x92, 0x6e, 0xef, 0xcc,
@ -1277,7 +1277,7 @@ const uint8_t PAGE_settings_time[] PROGMEM = {
// Autogenerated from wled00/data/settings_sec.htm, do not edit!! // Autogenerated from wled00/data/settings_sec.htm, do not edit!!
const uint16_t PAGE_settings_sec_length = 1802; const uint16_t PAGE_settings_sec_length = 1802;
const uint8_t PAGE_settings_sec[] PROGMEM = { const uint8_t PAGE_settings_sec[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x95, 0x57, 0x6d, 0x6f, 0xdb, 0x38, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x95, 0x57, 0x6d, 0x6f, 0xdb, 0x38,
0x12, 0xfe, 0xae, 0x5f, 0xc1, 0xb0, 0x40, 0xd7, 0x06, 0x6c, 0x29, 0x71, 0xef, 0xf6, 0xba, 0x89, 0x12, 0xfe, 0xae, 0x5f, 0xc1, 0xb0, 0x40, 0xd7, 0x06, 0x6c, 0x29, 0x71, 0xef, 0xf6, 0xba, 0x89,
0xa5, 0x5e, 0xd2, 0x38, 0x9b, 0x00, 0xc9, 0x26, 0x88, 0xdd, 0xed, 0x1d, 0x0e, 0x87, 0x82, 0x96, 0xa5, 0x5e, 0xd2, 0x38, 0x9b, 0x00, 0xc9, 0x26, 0x88, 0xdd, 0xed, 0x1d, 0x0e, 0x87, 0x82, 0x96,
0x46, 0x16, 0xd7, 0x32, 0xa9, 0x25, 0x29, 0xbb, 0x46, 0xd1, 0xff, 0x7e, 0x33, 0x94, 0xe4, 0xd8, 0x46, 0x16, 0xd7, 0x32, 0xa9, 0x25, 0x29, 0xbb, 0x46, 0xd1, 0xff, 0x7e, 0x33, 0x94, 0xe4, 0xd8,
@ -1396,7 +1396,7 @@ const uint8_t PAGE_settings_sec[] PROGMEM = {
// Autogenerated from wled00/data/settings_um.htm, do not edit!! // Autogenerated from wled00/data/settings_um.htm, do not edit!!
const uint16_t PAGE_settings_um_length = 1767; const uint16_t PAGE_settings_um_length = 1767;
const uint8_t PAGE_settings_um[] PROGMEM = { const uint8_t PAGE_settings_um[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xa5, 0x57, 0x6d, 0x6f, 0xdb, 0x38, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xa5, 0x57, 0x6d, 0x6f, 0xdb, 0x38,
0x12, 0xfe, 0xee, 0x5f, 0xc1, 0xb0, 0x41, 0x22, 0xc1, 0x8a, 0x6c, 0x37, 0xdb, 0xdb, 0xd4, 0x36, 0x12, 0xfe, 0xee, 0x5f, 0xc1, 0xb0, 0x41, 0x22, 0xc1, 0x8a, 0x6c, 0x37, 0xdb, 0xdb, 0xd4, 0x36,
0xe5, 0xdd, 0xf4, 0xe5, 0x1a, 0xa0, 0xbd, 0x04, 0x48, 0x77, 0x0f, 0x87, 0x20, 0xd8, 0xc8, 0xd2, 0xe5, 0xdd, 0xf4, 0xe5, 0x1a, 0xa0, 0xbd, 0x04, 0x48, 0x77, 0x0f, 0x87, 0x20, 0xd8, 0xc8, 0xd2,
0xc8, 0xe6, 0x46, 0x22, 0x05, 0x92, 0xb2, 0x93, 0x73, 0xfc, 0xdf, 0x77, 0x48, 0xc9, 0xb2, 0xdd, 0xc8, 0xe6, 0x46, 0x22, 0x05, 0x92, 0xb2, 0x93, 0x73, 0xfc, 0xdf, 0x77, 0x48, 0xc9, 0xb2, 0xdd,

File diff suppressed because it is too large Load Diff

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.1-bl7/%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

@ -95,7 +95,7 @@ void changeEffect(uint8_t fx)
strip.setMode(i, fx); strip.setMode(i, fx);
} }
} else { } else {
strip.setMode(strip.getMainSegmentId(), fx); strip.setMode(strip.getFirstSelectedSegId(), fx);
} }
effectCurrent = fx; effectCurrent = fx;
stateChanged = true; stateChanged = true;
@ -110,7 +110,7 @@ void changePalette(uint8_t pal)
seg.palette = pal; seg.palette = pal;
} }
} else { } else {
strip.getSegment(strip.getMainSegmentId()).palette = pal; strip.getFirstSelectedSeg().palette = pal;
} }
effectPalette = pal; effectPalette = pal;
stateChanged = true; stateChanged = true;
@ -128,7 +128,7 @@ void changeEffectSpeed(int8_t amount)
seg.speed = effectSpeed; seg.speed = effectSpeed;
} }
} else { } else {
strip.getSegment(strip.getMainSegmentId()).speed = effectSpeed; strip.getFirstSelectedSeg().speed = effectSpeed;
} }
} else { // if Effect == "solid Color", change the hue of the primary color } else { // if Effect == "solid Color", change the hue of the primary color
CRGB fastled_col; CRGB fastled_col;
@ -151,7 +151,7 @@ void changeEffectSpeed(int8_t amount)
seg.colors[0] = RGBW32(col[0], col[1], col[2], col[3]); seg.colors[0] = RGBW32(col[0], col[1], col[2], col[3]);
} }
} else { } else {
strip.getSegment(strip.getMainSegmentId()).colors[0] = RGBW32(col[0], col[1], col[2], col[3]); strip.getFirstSelectedSeg().colors[0] = RGBW32(col[0], col[1], col[2], col[3]);
} }
} }
stateChanged = true; stateChanged = true;
@ -173,7 +173,7 @@ void changeEffectIntensity(int8_t amount)
seg.intensity = effectIntensity; seg.intensity = effectIntensity;
} }
} else { } else {
strip.getSegment(strip.getMainSegmentId()).speed = effectIntensity; strip.getFirstSelectedSeg().speed = effectIntensity;
} }
} else { // if Effect == "solid Color", change the saturation of the primary color } else { // if Effect == "solid Color", change the saturation of the primary color
CRGB fastled_col; CRGB fastled_col;
@ -194,7 +194,7 @@ void changeEffectIntensity(int8_t amount)
seg.colors[0] = RGBW32(col[0], col[1], col[2], col[3]); seg.colors[0] = RGBW32(col[0], col[1], col[2], col[3]);
} }
} else { } else {
strip.getSegment(strip.getMainSegmentId()).colors[0] = RGBW32(col[0], col[1], col[2], col[3]); strip.getFirstSelectedSeg().colors[0] = RGBW32(col[0], col[1], col[2], col[3]);
} }
} }
stateChanged = true; stateChanged = true;
@ -224,7 +224,7 @@ void changeColor(uint32_t c, int16_t cct=-1)
if (isCCT && cct >= 0) seg.setCCT(cct, i); if (isCCT && cct >= 0) seg.setCCT(cct, i);
} }
} else { } else {
byte i = strip.getMainSegmentId(); byte i = strip.getFirstSelectedSegId();
WS2812FX::Segment& seg = strip.getSegment(i); WS2812FX::Segment& seg = strip.getSegment(i);
byte capabilities = seg.getLightCapabilities(); byte capabilities = seg.getLightCapabilities();
uint32_t mask = 0; uint32_t mask = 0;
@ -238,7 +238,7 @@ void changeColor(uint32_t c, int16_t cct=-1)
} else if (c & mask) seg.setColor(0, c & mask, i); // only apply if not black } else if (c & mask) seg.setColor(0, c & mask, i); // only apply if not black
if (isCCT && cct >= 0) seg.setCCT(cct, i); if (isCCT && cct >= 0) seg.setCCT(cct, i);
} }
setValuesFromMainSeg(); //make transitions graceful setValuesFromFirstSelectedSeg(); //make transitions graceful
stateChanged = true; stateChanged = true;
} }

View File

@ -211,8 +211,10 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
} else if (!elem["frz"] && iarr.isNull()) { //return to regular effect } else if (!elem["frz"] && iarr.isNull()) { //return to regular effect
seg.setOption(SEG_OPTION_FREEZE, false); seg.setOption(SEG_OPTION_FREEZE, false);
} }
//send UDP if not in preset and something changed that is not just selection // send UDP if not in preset and something changed that is not just selection
if (!presetId && (seg.differs(prev) & 0x7F)) stateChanged = true; //if (!presetId && (seg.differs(prev) & 0x7F)) stateChanged = true;
// send UDP if something changed that is not just selection
if (seg.differs(prev) & 0x7F) stateChanged = true;
return; return;
} }
@ -315,9 +317,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,7 +3,7 @@
/* /*
* LED methods * LED methods
*/ */
void setValuesFromMainSeg() void setValuesFromFirstSelectedSeg()
{ {
WS2812FX::Segment& seg = strip.getMainSegment(); WS2812FX::Segment& seg = strip.getMainSegment();
col[0] = R(seg.colors[0]); col[0] = R(seg.colors[0]);
@ -21,23 +21,25 @@ 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) {seg.speed = effectSpeed; stateChanged = true;} if (effectSpeed != selsegPrev.speed) {seg.speed = effectSpeed; stateChanged = true;}
if (effectIntensity != mainsegPrev.intensity) {seg.intensity = effectIntensity; stateChanged = true;} if (effectIntensity != selsegPrev.intensity) {seg.intensity = effectIntensity; stateChanged = true;}
if (effectPalette != mainsegPrev.palette) {seg.palette = effectPalette; stateChanged = true;} if (effectPalette != selsegPrev.palette) {seg.palette = effectPalette; stateChanged = true;}
if (effectCurrent != mainsegPrev.mode) {strip.setMode(i, effectCurrent); stateChanged = true;} if (effectCurrent != selsegPrev.mode) {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]) {seg.setColor(0, col0, i); stateChanged = true;} if (col0 != selsegPrev.colors[0]) {seg.setColor(0, col0, i); stateChanged = true;}
if (col1 != mainsegPrev.colors[1]) {seg.setColor(1, col1, i); stateChanged = true;} if (col1 != selsegPrev.colors[1]) {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;
@ -231,7 +233,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

@ -542,13 +542,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;
@ -569,9 +568,9 @@ 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)};
byte colInSec[4] = {R(col1), G(col1), B(col1), W(col1)}; byte colInSec[4] = {R(col1), G(col1), B(col1), W(col1)};
byte effectIn = selseg.mode; byte effectIn = selseg.mode;
@ -777,7 +776,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
if (intensityChanged) seg.intensity = intensityIn; if (intensityChanged) seg.intensity = intensityIn;
if (paletteChanged) seg.palette = paletteIn; if (paletteChanged) seg.palette = paletteIn;
} }
setValuesFromMainSeg(); // will fill col[] and cloSec[] as well as effectCurrent, ... setValuesFromFirstSelectedSeg(); // will fill col[] and cloSec[] as well as effectCurrent, ...
//set advanced overlay //set advanced overlay
pos = req.indexOf(F("OL=")); pos = req.indexOf(F("OL="));
@ -907,14 +906,15 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
} }
// you can add more if you need // you can add more if you need
if (!apply) return true; // when called by JSON API, do not call stateUpdated() here // global col[], effectCurrent, ... are updated in stateChanged()
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

@ -435,11 +435,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

@ -238,9 +238,9 @@ void initServer()
server.on("/update", HTTP_POST, [](AsyncWebServerRequest *request){ server.on("/update", HTTP_POST, [](AsyncWebServerRequest *request){
if (Update.hasError()) if (Update.hasError())
{ {
serveMessage(request, 500, F("Failed updating firmware!"), F("Please check your file and retry!"), 254); return; serveMessage(request, 500, F("Update failed!"), F("Please check your file and retry!"), 254); return;
} }
serveMessage(request, 200, F("Successfully updated firmware!"), F("Rebooting..."), 131); serveMessage(request, 200, F("Update successful!"), F("Rebooting..."), 131);
doReboot = true; doReboot = true;
},[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){ },[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){
if(!index){ if(!index){
@ -262,7 +262,7 @@ void initServer()
#else #else
server.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){ server.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){
serveMessage(request, 501, "Not implemented", F("OTA updates are disabled in this build."), 254); serveMessage(request, 501, "Not implemented", F("OTA updating is disabled in this build."), 254);
}); });
#endif #endif
} else } else

View File

@ -67,7 +67,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);
} }