diff --git a/CHANGELOG.md b/CHANGELOG.md index b02aef1f05..95cf9e0210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ### Development versions after 0.10.0 release +#### Build 2008070 + +- Added segment mirroring (`mi` property) (#1017) +- Fixed DMX settings page not displayed (#1070) +- Fixed ArtNet multi universe and improve code style (#1076) +- Renamed global var `local` to `localTime` (#1078) + #### Build 2007190 - Fixed hostname containing illegal characters (#1035) diff --git a/wled00/FX.h b/wled00/FX.h index da8a6942df..27b35f01d8 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -267,10 +267,9 @@ class WS2812FX { uint16_t virtualLength() { uint16_t groupLen = groupLength(); - uint16_t vLength; - vLength = (length() + groupLen - 1) / groupLen; + uint16_t vLength = (length() + groupLen - 1) / groupLen; if (options & MIRROR) - vLength /= 2; // divide by 2 if mirror; leaves a blank LED in the middle if length is odd + vLength = (vLength + 1) /2; // divide by 2 if mirror, leave at least a signle LED return vLength; } } segment; diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 464e9d2aac..2e49f1d45b 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -180,9 +180,11 @@ void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w) #ifdef WLED_CUSTOM_LED_MAPPING if (indexSet < customMappingSize) indexSet = customMappingTable[indexSet]; #endif - if (indexSetRev >= SEGMENT.start && indexSetRev < SEGMENT.stop) bus->SetPixelColor(indexSet + skip, col); - if (IS_MIRROR) //set the corresponding mirrored pixel - bus->SetPixelColor(SEGMENT.stop - (indexSet + skip) + SEGMENT.start - 1, col); + if (indexSetRev >= SEGMENT.start && indexSetRev < SEGMENT.stop) { + bus->SetPixelColor(indexSet + skip, col); + if (IS_MIRROR) //set the corresponding mirrored pixel + bus->SetPixelColor(SEGMENT.stop - (indexSet + skip) + SEGMENT.start - 1, col); + } } } else { //live data, etc. if (reverseMode) i = _length - 1 - i; diff --git a/wled00/json.cpp b/wled00/json.cpp index 0a64f192c9..40dd3f24dd 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -59,6 +59,7 @@ void deserializeSegment(JsonObject elem, byte it) //if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal); seg.setOption(SEG_OPTION_SELECTED, elem["sel"] | seg.getOption(SEG_OPTION_SELECTED)); seg.setOption(SEG_OPTION_REVERSED, elem["rev"] | seg.getOption(SEG_OPTION_REVERSED)); + seg.setOption(SEG_OPTION_MIRROR , elem["mi"] | seg.getOption(SEG_OPTION_MIRROR )); //temporary, strip object gets updated via colorUpdated() if (id == strip.getMainSegmentId()) { @@ -215,12 +216,13 @@ void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id) } } - root["fx"] = seg.mode; - root["sx"] = seg.speed; - root["ix"] = seg.intensity; + root["fx"] = seg.mode; + root["sx"] = seg.speed; + root["ix"] = seg.intensity; root["pal"] = seg.palette; root["sel"] = seg.isSelected(); root["rev"] = seg.getOption(SEG_OPTION_REVERSED); + root["mi"] = seg.getOption(SEG_OPTION_MIRROR); } diff --git a/wled00/set.cpp b/wled00/set.cpp index 66dbb753e2..763162f10a 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -647,6 +647,10 @@ bool handleSet(AsyncWebServerRequest *request, const String& req) pos = req.indexOf("RV="); if (pos > 0) strip.getSegment(main).setOption(SEG_OPTION_REVERSED, req.charAt(pos+3) != '0'); + //Segment reverse + pos = req.indexOf("MI="); + if (pos > 0) strip.getSegment(main).setOption(SEG_OPTION_MIRROR, req.charAt(pos+3) != '0'); + //Segment brightness/opacity pos = req.indexOf("SB="); if (pos > 0) {