Added mi property to APIs

This commit is contained in:
cschwinne 2020-08-07 00:50:19 +02:00
parent b50e798d55
commit c1cab30daf
5 changed files with 23 additions and 9 deletions

View File

@ -2,6 +2,13 @@
### Development versions after 0.10.0 release ### 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 #### Build 2007190
- Fixed hostname containing illegal characters (#1035) - Fixed hostname containing illegal characters (#1035)

View File

@ -267,10 +267,9 @@ class WS2812FX {
uint16_t virtualLength() uint16_t virtualLength()
{ {
uint16_t groupLen = groupLength(); uint16_t groupLen = groupLength();
uint16_t vLength; uint16_t vLength = (length() + groupLen - 1) / groupLen;
vLength = (length() + groupLen - 1) / groupLen;
if (options & MIRROR) 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; return vLength;
} }
} segment; } segment;

View File

@ -180,10 +180,12 @@ void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w)
#ifdef WLED_CUSTOM_LED_MAPPING #ifdef WLED_CUSTOM_LED_MAPPING
if (indexSet < customMappingSize) indexSet = customMappingTable[indexSet]; if (indexSet < customMappingSize) indexSet = customMappingTable[indexSet];
#endif #endif
if (indexSetRev >= SEGMENT.start && indexSetRev < SEGMENT.stop) bus->SetPixelColor(indexSet + skip, col); if (indexSetRev >= SEGMENT.start && indexSetRev < SEGMENT.stop) {
bus->SetPixelColor(indexSet + skip, col);
if (IS_MIRROR) //set the corresponding mirrored pixel if (IS_MIRROR) //set the corresponding mirrored pixel
bus->SetPixelColor(SEGMENT.stop - (indexSet + skip) + SEGMENT.start - 1, col); bus->SetPixelColor(SEGMENT.stop - (indexSet + skip) + SEGMENT.start - 1, col);
} }
}
} else { //live data, etc. } else { //live data, etc.
if (reverseMode) i = _length - 1 - i; if (reverseMode) i = _length - 1 - i;
#ifdef WLED_CUSTOM_LED_MAPPING #ifdef WLED_CUSTOM_LED_MAPPING

View File

@ -59,6 +59,7 @@ void deserializeSegment(JsonObject elem, byte it)
//if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal); //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_SELECTED, elem["sel"] | seg.getOption(SEG_OPTION_SELECTED));
seg.setOption(SEG_OPTION_REVERSED, elem["rev"] | seg.getOption(SEG_OPTION_REVERSED)); 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() //temporary, strip object gets updated via colorUpdated()
if (id == strip.getMainSegmentId()) { if (id == strip.getMainSegmentId()) {
@ -221,6 +222,7 @@ void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id)
root["pal"] = seg.palette; root["pal"] = seg.palette;
root["sel"] = seg.isSelected(); root["sel"] = seg.isSelected();
root["rev"] = seg.getOption(SEG_OPTION_REVERSED); root["rev"] = seg.getOption(SEG_OPTION_REVERSED);
root["mi"] = seg.getOption(SEG_OPTION_MIRROR);
} }

View File

@ -647,6 +647,10 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
pos = req.indexOf("RV="); pos = req.indexOf("RV=");
if (pos > 0) strip.getSegment(main).setOption(SEG_OPTION_REVERSED, req.charAt(pos+3) != '0'); 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 //Segment brightness/opacity
pos = req.indexOf("SB="); pos = req.indexOf("SB=");
if (pos > 0) { if (pos > 0) {