diff --git a/wled00/FX.h b/wled00/FX.h index 131088126..c4725ec97 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -817,7 +817,8 @@ class WS2812FX { // 96 bytes uint16_t getLengthPhysical(void), getLengthTotal(void), // will include virtual/nonexistent pixels in matrix - getFps(); + getFps(), + getMappedPixelIndex(uint16_t index); inline uint16_t getFrameTime(void) { return _frametime; } // returns amount of time a frame should take (in ms) inline uint16_t getMinShowDelay(void) { return MIN_SHOW_DELAY; } // returns minimum amount of time strip.service() can be delayed (constant) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 3a762afb4..96e397aba 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -886,8 +886,7 @@ void Segment::refreshLightCapabilities() { if (start < Segment::maxWidth * Segment::maxHeight) { // we are withing 2D matrix (includes 1D segments) for (int y = startY; y < stopY; y++) for (int x = start; x < stop; x++) { - uint16_t index = x + Segment::maxWidth * y; - if (index < strip.customMappingSize) index = strip.customMappingTable[index]; // convert logical address to physical + uint16_t index = strip.getMappedPixelIndex(x + Segment::maxWidth * y); // convert logical address to physical if (index < 0xFFFFU) { if (segStartIdx > index) segStartIdx = index; if (segStopIdx < index) segStopIdx = index; @@ -1212,13 +1211,13 @@ void WS2812FX::service() { } void IRAM_ATTR WS2812FX::setPixelColor(unsigned i, uint32_t col) { - if (i < customMappingSize) i = customMappingTable[i]; + i = getMappedPixelIndex(i); if (i >= _length) return; BusManager::setPixelColor(i, col); } uint32_t IRAM_ATTR WS2812FX::getPixelColor(uint16_t i) { - if (i < customMappingSize) i = customMappingTable[i]; + i = getMappedPixelIndex(i); if (i >= _length) return 0; return BusManager::getPixelColor(i); } @@ -1691,6 +1690,14 @@ bool WS2812FX::deserializeMap(uint8_t n) { return true; } +uint16_t IRAM_ATTR WS2812FX::getMappedPixelIndex(uint16_t index) { + // convert logical address to physical + if (index < customMappingSize + && (realtimeMode == REALTIME_MODE_INACTIVE || realtimeRespectLedMaps)) index = customMappingTable[index]; + + return index; +} + WS2812FX* WS2812FX::instance = nullptr; diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index a4a1e3372..bea7ef237 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -429,6 +429,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { JsonObject if_live = interfaces["live"]; CJSON(receiveDirect, if_live["en"]); // UDP/Hyperion realtime CJSON(useMainSegmentOnly, if_live[F("mso")]); + CJSON(realtimeRespectLedMaps, if_live[F("rlm")]); CJSON(e131Port, if_live["port"]); // 5568 if (e131Port == DDP_DEFAULT_PORT) e131Port = E131_DEFAULT_PORT; // prevent double DDP port allocation CJSON(e131Multicast, if_live[F("mc")]); @@ -896,6 +897,7 @@ void serializeConfig() { JsonObject if_live = interfaces.createNestedObject("live"); if_live["en"] = receiveDirect; // UDP/Hyperion realtime if_live[F("mso")] = useMainSegmentOnly; + if_live[F("rlm")] = realtimeRespectLedMaps; if_live["port"] = e131Port; if_live[F("mc")] = e131Multicast; diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index e34f2bd54..942c32311 100644 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -19,7 +19,7 @@ scE.setAttribute("type", "text/javascript"); scE.setAttribute("async", async); d.body.appendChild(scE); - // success event + // success event scE.addEventListener("load", () => { //console.log("File loaded"); GetV();SetVal(); @@ -156,7 +156,8 @@ Make this instance discoverable:

Realtime

Receive UDP realtime:
-Use main segment only:

+Use main segment only:
+Respect LED Maps:

Network DMX input
Type: