From 919191fd8b314376756574b10d0903d945773df5 Mon Sep 17 00:00:00 2001 From: mrv96 Date: Tue, 26 Aug 2025 11:42:30 +0000 Subject: [PATCH 1/7] Add support to custom DMX output value --- wled00/cfg.cpp | 11 +++++++++++ wled00/data/settings_dmx.htm | 23 ++++++++++++++++++----- wled00/dmx_output.cpp | 7 ++----- wled00/set.cpp | 5 +++++ wled00/wled.h | 1 + wled00/wled_server.cpp | 5 +++++ wled00/xml.cpp | 16 ++++++++++++++++ 7 files changed, 58 insertions(+), 10 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index e30be759b6..e1a1ad3be6 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -741,6 +741,12 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(DMXFixtureMap[i],dmx_fixmap[i]); } + JsonArray dmx_chsval = dmx[F("chsval")]; + for (int i = 0; i < dmx_chsval.size(); i++) { + if (i > 14) break; + CJSON(DMXChannelsValue[i],dmx_chsval[i]); + } + CJSON(e131ProxyUniverse, dmx[F("e131proxy")]); #endif @@ -1241,6 +1247,11 @@ void serializeConfig(JsonObject root) { dmx_fixmap.add(DMXFixtureMap[i]); } + JsonArray dmx_chsval = dmx.createNestedArray(F("chsval")); + for (unsigned i = 0; i < 15; i++) { + dmx_chsval.add(DMXChannelsValue[i]); + } + dmx[F("e131proxy")] = e131ProxyUniverse; #endif diff --git a/wled00/data/settings_dmx.htm b/wled00/data/settings_dmx.htm index 391c2bdc97..24955ff1d2 100644 --- a/wled00/data/settings_dmx.htm +++ b/wled00/data/settings_dmx.htm @@ -15,10 +15,20 @@ document.head.appendChild(l); })(); function HW(){window.open("https://kno.wled.ge/interfaces/dmx-output/");} - function GCH(num) { + function GCH(num){ gId('dmxchannels').innerHTML += ""; for (i=0;iChannel " + (i+1) + ":
\n"; + gId('dmxchannels').innerHTML += "Channel " + (i+1) + ":
\n"; + } + for (i=0;i { + if (event.target.value == 0) { + dv.style.display = "inline"; + } else { + dv.style.display = "none"; + } + }); } } function mMap(){ @@ -30,14 +40,17 @@ gId("gapwarning").style.display="none"; } for (i=0;i<15;i++) { + const ch = gId("CH" + (i+1)); if (i>=numCh) { gId("CH"+(i+1) + "s").style.opacity = "0.5"; - gId("CH"+(i+1)).disabled = true; - + ch.disabled = true; + gId("DV"+(i+1)).disabled = true; } else { gId("CH"+(i+1) + "s").style.opacity = "1"; - gId("CH"+(i+1)).disabled = false; + ch.disabled = false; + gId("DV"+(i+1)).disabled = false; } + ch.dispatchEvent(new Event("change")); } } function S(){ diff --git a/wled00/dmx_output.cpp b/wled00/dmx_output.cpp index eace2145e6..f241e10c03 100644 --- a/wled00/dmx_output.cpp +++ b/wled00/dmx_output.cpp @@ -40,8 +40,8 @@ void handleDMXOutput() for (int j = 0; j < DMXChannels; j++) { int DMXAddr = DMXFixtureStart + j; switch (DMXFixtureMap[j]) { - case 0: // Set this channel to 0. Good way to tell strobe- and fade-functions to fuck right off. - dmx.write(DMXAddr, 0); + case 0: // Set this channel to the selected value. + dmx.write(DMXAddr, DMXChannelsValue[j]); break; case 1: // Red dmx.write(DMXAddr, calc_brightness ? (r * brightness) / 255 : r); @@ -58,9 +58,6 @@ void handleDMXOutput() case 5: // Shutter channel. Controls the brightness. dmx.write(DMXAddr, brightness); break; - case 6: // Sets this channel to 255. Like 0, but more wholesome. - dmx.write(DMXAddr, 255); - break; } } } diff --git a/wled00/set.cpp b/wled00/set.cpp index db8b30bac8..39551ae1ef 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -645,6 +645,11 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) t = request->arg(argname).toInt(); DMXFixtureMap[i] = t; } + for (int i=0; i<15; i++) { + String argname = "DV" + String((i+1)); + t = request->arg(argname).toInt(); + DMXChannelsValue[i] = t; + } } #endif diff --git a/wled00/wled.h b/wled00/wled.h index 66b33740d6..6552e95e0e 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -463,6 +463,7 @@ WLED_GLOBAL bool arlsForceMaxBri _INIT(false); // enable to f // dmx CONFIG WLED_GLOBAL byte DMXChannels _INIT(7); // number of channels per fixture WLED_GLOBAL byte DMXFixtureMap[15] _INIT_N(({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); + WLED_GLOBAL byte DMXChannelsValue[15] _INIT_N(({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); // assigns the different channels to different functions. See wled21_dmx.ino for more information. WLED_GLOBAL uint16_t DMXGap _INIT(10); // gap between the fixtures. makes addressing easier because you don't have to memorize odd numbers when climbing up onto a rig. WLED_GLOBAL uint16_t DMXStart _INIT(10); // start address of the first fixture diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index ffb259b858..688328348e 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -148,6 +148,11 @@ static String dmxProcessor(const String& var) mapJS += String(DMXFixtureMap[i]) + ','; } mapJS += F("0];"); + mapJS += F(";\nvar DV=["); + for (int i=0; i<15; i++) { + mapJS += String(DMXChannelsValue[i]) + ','; + } + mapJS += F("0];"); } return mapJS; } diff --git a/wled00/xml.cpp b/wled00/xml.cpp index 194256d82e..0cdc766e9a 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -652,6 +652,22 @@ void getSettingsJS(byte subPage, Print& settingsScript) printSetFormIndex(settingsScript,PSTR("CH13"),DMXFixtureMap[12]); printSetFormIndex(settingsScript,PSTR("CH14"),DMXFixtureMap[13]); printSetFormIndex(settingsScript,PSTR("CH15"),DMXFixtureMap[14]); + + printSetFormValue(settingsScript,PSTR("DV1"),DMXChannelsValue[0]); + printSetFormValue(settingsScript,PSTR("DV2"),DMXChannelsValue[1]); + printSetFormValue(settingsScript,PSTR("DV3"),DMXChannelsValue[2]); + printSetFormValue(settingsScript,PSTR("DV4"),DMXChannelsValue[3]); + printSetFormValue(settingsScript,PSTR("DV5"),DMXChannelsValue[4]); + printSetFormValue(settingsScript,PSTR("DV6"),DMXChannelsValue[5]); + printSetFormValue(settingsScript,PSTR("DV7"),DMXChannelsValue[6]); + printSetFormValue(settingsScript,PSTR("DV8"),DMXChannelsValue[7]); + printSetFormValue(settingsScript,PSTR("DV9"),DMXChannelsValue[8]); + printSetFormValue(settingsScript,PSTR("DV10"),DMXChannelsValue[9]); + printSetFormValue(settingsScript,PSTR("DV11"),DMXChannelsValue[10]); + printSetFormValue(settingsScript,PSTR("DV12"),DMXChannelsValue[11]); + printSetFormValue(settingsScript,PSTR("DV13"),DMXChannelsValue[12]); + printSetFormValue(settingsScript,PSTR("DV14"),DMXChannelsValue[13]); + printSetFormValue(settingsScript,PSTR("DV15"),DMXChannelsValue[14]); } #endif From d58d0c1c54b1a9cae92dcac1baa44913a46efe33 Mon Sep 17 00:00:00 2001 From: mrv96 Date: Tue, 26 Aug 2025 11:46:32 +0000 Subject: [PATCH 2/7] Minor refactor: replace for break with MIN() --- wled00/cfg.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index e1a1ad3be6..cbe5e969f6 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -736,14 +736,12 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(DMXStartLED,dmx[F("start-led")]); JsonArray dmx_fixmap = dmx[F("fixmap")]; - for (int i = 0; i < dmx_fixmap.size(); i++) { - if (i > 14) break; + for (int i = 0; i < MIN(dmx_fixmap.size(), 15); i++) { CJSON(DMXFixtureMap[i],dmx_fixmap[i]); } JsonArray dmx_chsval = dmx[F("chsval")]; - for (int i = 0; i < dmx_chsval.size(); i++) { - if (i > 14) break; + for (int i = 0; i < MIN(dmx_chsval.size(), 15); i++) { CJSON(DMXChannelsValue[i],dmx_chsval[i]); } From 89a38bde27c802d9b8c506909c16a1017be1d1e4 Mon Sep 17 00:00:00 2001 From: mrv96 Date: Thu, 28 Aug 2025 10:11:56 +0200 Subject: [PATCH 3/7] Refactor: roll some unrolled settings prints --- wled00/xml.cpp | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/wled00/xml.cpp b/wled00/xml.cpp index 0cdc766e9a..6c9e5fbfab 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -637,37 +637,17 @@ void getSettingsJS(byte subPage, Print& settingsScript) printSetFormValue(settingsScript,PSTR("CS"),DMXStart); printSetFormValue(settingsScript,PSTR("SL"),DMXStartLED); - printSetFormIndex(settingsScript,PSTR("CH1"),DMXFixtureMap[0]); - printSetFormIndex(settingsScript,PSTR("CH2"),DMXFixtureMap[1]); - printSetFormIndex(settingsScript,PSTR("CH3"),DMXFixtureMap[2]); - printSetFormIndex(settingsScript,PSTR("CH4"),DMXFixtureMap[3]); - printSetFormIndex(settingsScript,PSTR("CH5"),DMXFixtureMap[4]); - printSetFormIndex(settingsScript,PSTR("CH6"),DMXFixtureMap[5]); - printSetFormIndex(settingsScript,PSTR("CH7"),DMXFixtureMap[6]); - printSetFormIndex(settingsScript,PSTR("CH8"),DMXFixtureMap[7]); - printSetFormIndex(settingsScript,PSTR("CH9"),DMXFixtureMap[8]); - printSetFormIndex(settingsScript,PSTR("CH10"),DMXFixtureMap[9]); - printSetFormIndex(settingsScript,PSTR("CH11"),DMXFixtureMap[10]); - printSetFormIndex(settingsScript,PSTR("CH12"),DMXFixtureMap[11]); - printSetFormIndex(settingsScript,PSTR("CH13"),DMXFixtureMap[12]); - printSetFormIndex(settingsScript,PSTR("CH14"),DMXFixtureMap[13]); - printSetFormIndex(settingsScript,PSTR("CH15"),DMXFixtureMap[14]); - - printSetFormValue(settingsScript,PSTR("DV1"),DMXChannelsValue[0]); - printSetFormValue(settingsScript,PSTR("DV2"),DMXChannelsValue[1]); - printSetFormValue(settingsScript,PSTR("DV3"),DMXChannelsValue[2]); - printSetFormValue(settingsScript,PSTR("DV4"),DMXChannelsValue[3]); - printSetFormValue(settingsScript,PSTR("DV5"),DMXChannelsValue[4]); - printSetFormValue(settingsScript,PSTR("DV6"),DMXChannelsValue[5]); - printSetFormValue(settingsScript,PSTR("DV7"),DMXChannelsValue[6]); - printSetFormValue(settingsScript,PSTR("DV8"),DMXChannelsValue[7]); - printSetFormValue(settingsScript,PSTR("DV9"),DMXChannelsValue[8]); - printSetFormValue(settingsScript,PSTR("DV10"),DMXChannelsValue[9]); - printSetFormValue(settingsScript,PSTR("DV11"),DMXChannelsValue[10]); - printSetFormValue(settingsScript,PSTR("DV12"),DMXChannelsValue[11]); - printSetFormValue(settingsScript,PSTR("DV13"),DMXChannelsValue[12]); - printSetFormValue(settingsScript,PSTR("DV14"),DMXChannelsValue[13]); - printSetFormValue(settingsScript,PSTR("DV15"),DMXChannelsValue[14]); + for (int i = 0; i < 15; i++) { + char buf[5]; + snprintf_P(buf, sizeof(buf), PSTR("CH%d"), i+1); + printSetFormIndex(settingsScript,buf,DMXFixtureMap[i]); + } + + for (int i = 0; i < 15; i++) { + char buf[5]; + snprintf_P(buf, sizeof(buf), PSTR("DV%d"), i+1); + printSetFormValue(settingsScript,buf,DMXChannelsValue[i]); + } } #endif From 3c8ed618f4af2a57103f1d36e2d19149451be7b7 Mon Sep 17 00:00:00 2001 From: mrv96 Date: Mon, 1 Sep 2025 11:34:56 +0200 Subject: [PATCH 4/7] Refactor: put max channels per fixture in a define --- wled00/cfg.cpp | 8 ++++---- wled00/const.h | 4 ++++ wled00/set.cpp | 4 ++-- wled00/wled.h | 4 ++-- wled00/wled_server.cpp | 4 ++-- wled00/xml.cpp | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index cbe5e969f6..dab50d0985 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -736,12 +736,12 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(DMXStartLED,dmx[F("start-led")]); JsonArray dmx_fixmap = dmx[F("fixmap")]; - for (int i = 0; i < MIN(dmx_fixmap.size(), 15); i++) { + for (int i = 0; i < MIN(dmx_fixmap.size(), MAX_CHANNELS_PER_FIXTURE); i++) { CJSON(DMXFixtureMap[i],dmx_fixmap[i]); } JsonArray dmx_chsval = dmx[F("chsval")]; - for (int i = 0; i < MIN(dmx_chsval.size(), 15); i++) { + for (int i = 0; i < MIN(dmx_chsval.size(), MAX_CHANNELS_PER_FIXTURE); i++) { CJSON(DMXChannelsValue[i],dmx_chsval[i]); } @@ -1241,12 +1241,12 @@ void serializeConfig(JsonObject root) { dmx[F("start-led")] = DMXStartLED; JsonArray dmx_fixmap = dmx.createNestedArray(F("fixmap")); - for (unsigned i = 0; i < 15; i++) { + for (unsigned i = 0; i < MAX_CHANNELS_PER_FIXTURE; i++) { dmx_fixmap.add(DMXFixtureMap[i]); } JsonArray dmx_chsval = dmx.createNestedArray(F("chsval")); - for (unsigned i = 0; i < 15; i++) { + for (unsigned i = 0; i < MAX_CHANNELS_PER_FIXTURE; i++) { dmx_chsval.add(DMXChannelsValue[i]); } diff --git a/wled00/const.h b/wled00/const.h index 6d1825d574..3fa1247b57 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -686,4 +686,8 @@ static_assert(WLED_MAX_BUSSES <= 32, "WLED_MAX_BUSSES exceeds hard limit"); #define WLED_O2_ATTR __attribute__((optimize("O2"))) +#ifdef WLED_ENABLE_DMX + #define MAX_CHANNELS_PER_FIXTURE 15 +#endif + #endif diff --git a/wled00/set.cpp b/wled00/set.cpp index 39551ae1ef..033f90e11a 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -640,12 +640,12 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) if (t>=0 && t < MAX_LEDS) { DMXStartLED = t; } - for (int i=0; i<15; i++) { + for (int i=0; iarg(argname).toInt(); DMXFixtureMap[i] = t; } - for (int i=0; i<15; i++) { + for (int i=0; iarg(argname).toInt(); DMXChannelsValue[i] = t; diff --git a/wled00/wled.h b/wled00/wled.h index 6552e95e0e..95e6481eba 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -462,8 +462,8 @@ WLED_GLOBAL bool arlsForceMaxBri _INIT(false); // enable to f WLED_GLOBAL uint16_t e131ProxyUniverse _INIT(0); // output this E1.31 (sACN) / ArtNet universe via MAX485 (0 = disabled) // dmx CONFIG WLED_GLOBAL byte DMXChannels _INIT(7); // number of channels per fixture - WLED_GLOBAL byte DMXFixtureMap[15] _INIT_N(({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); - WLED_GLOBAL byte DMXChannelsValue[15] _INIT_N(({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); + WLED_GLOBAL byte DMXFixtureMap[MAX_CHANNELS_PER_FIXTURE] _INIT_N(({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); + WLED_GLOBAL byte DMXChannelsValue[MAX_CHANNELS_PER_FIXTURE] _INIT_N(({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); // assigns the different channels to different functions. See wled21_dmx.ino for more information. WLED_GLOBAL uint16_t DMXGap _INIT(10); // gap between the fixtures. makes addressing easier because you don't have to memorize odd numbers when climbing up onto a rig. WLED_GLOBAL uint16_t DMXStart _INIT(10); // start address of the first fixture diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index 688328348e..ec2e989e48 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -144,12 +144,12 @@ static String dmxProcessor(const String& var) mapJS += F(";\nLC="); mapJS += String(strip.getLengthTotal()); mapJS += F(";\nvar CH=["); - for (int i=0; i<15; i++) { + for (int i=0; i Date: Mon, 1 Sep 2025 12:33:35 +0200 Subject: [PATCH 5/7] Prevent random-like DMX values from settings --- wled00/set.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/set.cpp b/wled00/set.cpp index 033f90e11a..d59b1074d6 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -648,7 +648,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) for (int i=0; iarg(argname).toInt(); - DMXChannelsValue[i] = t; + DMXChannelsValue[i] = constrain(t, 0, 255); } } #endif From 34b74aa215ade0fa4b8c9d81fcd43f3e1fe64d9f Mon Sep 17 00:00:00 2001 From: mrv96 Date: Fri, 26 Sep 2025 11:18:43 +0200 Subject: [PATCH 6/7] Restore DMXFixtureMap case 6 for backward-compat. --- wled00/dmx_output.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wled00/dmx_output.cpp b/wled00/dmx_output.cpp index f241e10c03..28a83662e1 100644 --- a/wled00/dmx_output.cpp +++ b/wled00/dmx_output.cpp @@ -40,7 +40,7 @@ void handleDMXOutput() for (int j = 0; j < DMXChannels; j++) { int DMXAddr = DMXFixtureStart + j; switch (DMXFixtureMap[j]) { - case 0: // Set this channel to the selected value. + case 0: // Set this channel to the selected value (custom DV per channel). dmx.write(DMXAddr, DMXChannelsValue[j]); break; case 1: // Red @@ -58,6 +58,9 @@ void handleDMXOutput() case 5: // Shutter channel. Controls the brightness. dmx.write(DMXAddr, brightness); break; + case 6: // Legacy: "Set to 255" (pre-custom DV). Keep for backward-compatibility. + dmx.write(DMXAddr, 255); + break; } } } From 714c5cbc0987a4b48b9af8955f032204fe33e49b Mon Sep 17 00:00:00 2001 From: mrv96 Date: Wed, 7 Jan 2026 12:16:44 +0000 Subject: [PATCH 7/7] Rename MAX_CHANNELS_PER_FIXTURE define --- wled00/cfg.cpp | 8 ++++---- wled00/const.h | 4 +--- wled00/set.cpp | 4 ++-- wled00/wled.h | 4 ++-- wled00/wled_server.cpp | 16 ++++++++-------- wled00/xml.cpp | 6 +++--- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index dab50d0985..4e0a5ce4bd 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -736,12 +736,12 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(DMXStartLED,dmx[F("start-led")]); JsonArray dmx_fixmap = dmx[F("fixmap")]; - for (int i = 0; i < MIN(dmx_fixmap.size(), MAX_CHANNELS_PER_FIXTURE); i++) { + for (int i = 0; i < MIN(dmx_fixmap.size(), WLED_DMX_MAX_CHANNELS_PER_FIXTURE); i++) { CJSON(DMXFixtureMap[i],dmx_fixmap[i]); } JsonArray dmx_chsval = dmx[F("chsval")]; - for (int i = 0; i < MIN(dmx_chsval.size(), MAX_CHANNELS_PER_FIXTURE); i++) { + for (int i = 0; i < MIN(dmx_chsval.size(), WLED_DMX_MAX_CHANNELS_PER_FIXTURE); i++) { CJSON(DMXChannelsValue[i],dmx_chsval[i]); } @@ -1241,12 +1241,12 @@ void serializeConfig(JsonObject root) { dmx[F("start-led")] = DMXStartLED; JsonArray dmx_fixmap = dmx.createNestedArray(F("fixmap")); - for (unsigned i = 0; i < MAX_CHANNELS_PER_FIXTURE; i++) { + for (unsigned i = 0; i < WLED_DMX_MAX_CHANNELS_PER_FIXTURE; i++) { dmx_fixmap.add(DMXFixtureMap[i]); } JsonArray dmx_chsval = dmx.createNestedArray(F("chsval")); - for (unsigned i = 0; i < MAX_CHANNELS_PER_FIXTURE; i++) { + for (unsigned i = 0; i < WLED_DMX_MAX_CHANNELS_PER_FIXTURE; i++) { dmx_chsval.add(DMXChannelsValue[i]); } diff --git a/wled00/const.h b/wled00/const.h index 3fa1247b57..e4f5b70c6e 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -686,8 +686,6 @@ static_assert(WLED_MAX_BUSSES <= 32, "WLED_MAX_BUSSES exceeds hard limit"); #define WLED_O2_ATTR __attribute__((optimize("O2"))) -#ifdef WLED_ENABLE_DMX - #define MAX_CHANNELS_PER_FIXTURE 15 -#endif +#define WLED_DMX_MAX_CHANNELS_PER_FIXTURE 15 #endif diff --git a/wled00/set.cpp b/wled00/set.cpp index d59b1074d6..5df81de468 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -640,12 +640,12 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) if (t>=0 && t < MAX_LEDS) { DMXStartLED = t; } - for (int i=0; iarg(argname).toInt(); DMXFixtureMap[i] = t; } - for (int i=0; iarg(argname).toInt(); DMXChannelsValue[i] = constrain(t, 0, 255); diff --git a/wled00/wled.h b/wled00/wled.h index 95e6481eba..d3ab346be7 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -462,8 +462,8 @@ WLED_GLOBAL bool arlsForceMaxBri _INIT(false); // enable to f WLED_GLOBAL uint16_t e131ProxyUniverse _INIT(0); // output this E1.31 (sACN) / ArtNet universe via MAX485 (0 = disabled) // dmx CONFIG WLED_GLOBAL byte DMXChannels _INIT(7); // number of channels per fixture - WLED_GLOBAL byte DMXFixtureMap[MAX_CHANNELS_PER_FIXTURE] _INIT_N(({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); - WLED_GLOBAL byte DMXChannelsValue[MAX_CHANNELS_PER_FIXTURE] _INIT_N(({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); + WLED_GLOBAL byte DMXFixtureMap[WLED_DMX_MAX_CHANNELS_PER_FIXTURE] _INIT_N(({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); + WLED_GLOBAL byte DMXChannelsValue[WLED_DMX_MAX_CHANNELS_PER_FIXTURE] _INIT_N(({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); // assigns the different channels to different functions. See wled21_dmx.ino for more information. WLED_GLOBAL uint16_t DMXGap _INIT(10); // gap between the fixtures. makes addressing easier because you don't have to memorize odd numbers when climbing up onto a rig. WLED_GLOBAL uint16_t DMXStart _INIT(10); // start address of the first fixture diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index ec2e989e48..a170ae6b65 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -1,7 +1,7 @@ #include "wled.h" #ifndef WLED_DISABLE_OTA - #include "ota_update.h" + #include "ota_update.h" #endif #include "html_ui.h" #include "html_settings.h" @@ -144,12 +144,12 @@ static String dmxProcessor(const String& var) mapJS += F(";\nLC="); mapJS += String(strip.getLengthTotal()); mapJS += F(";\nvar CH=["); - for (int i=0; iclient()->remoteIP(); - if (((otaSameSubnet && !inSameSubnet(client)) && !strlen(settingsPIN)) || (!otaSameSubnet && !inLocalSubnet(client))) { + if (((otaSameSubnet && !inSameSubnet(client)) && !strlen(settingsPIN)) || (!otaSameSubnet && !inLocalSubnet(client))) { DEBUG_PRINTLN(F("Attempted OTA update from different/non-local subnet!")); serveMessage(request, 401, FPSTR(s_accessdenied), F("Client is not on local subnet."), 254); setOTAReplied(request); @@ -530,7 +530,7 @@ void initServer() serveMessage(request, 401, FPSTR(s_accessdenied), FPSTR(s_unlock_ota), 254); setOTAReplied(request); return; - } + } } handleOTAData(request, index, data, len, isFinal); @@ -698,7 +698,7 @@ void serveSettingsJS(AsyncWebServerRequest* request) request->send_P(401, FPSTR(CONTENT_TYPE_JAVASCRIPT), PSTR("alert('PIN incorrect.');")); return; } - + AsyncResponseStream *response = request->beginResponseStream(FPSTR(CONTENT_TYPE_JAVASCRIPT)); response->addHeader(FPSTR(s_cache_control), FPSTR(s_no_store)); response->addHeader(FPSTR(s_expires), F("0")); diff --git a/wled00/xml.cpp b/wled00/xml.cpp index b1cd866808..63e239fa41 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -413,7 +413,7 @@ void getSettingsJS(byte subPage, Print& settingsScript) #ifndef WLED_DISABLE_INFRARED printSetFormValue(settingsScript,PSTR("IR"),irPin); printSetFormValue(settingsScript,PSTR("IT"),irEnabled); -#endif +#endif printSetFormCheckbox(settingsScript,PSTR("MSO"),!irApplyToAllSelected); } @@ -637,13 +637,13 @@ void getSettingsJS(byte subPage, Print& settingsScript) printSetFormValue(settingsScript,PSTR("CS"),DMXStart); printSetFormValue(settingsScript,PSTR("SL"),DMXStartLED); - for (int i = 0; i < MAX_CHANNELS_PER_FIXTURE; i++) { + for (int i = 0; i < WLED_DMX_MAX_CHANNELS_PER_FIXTURE; i++) { char buf[5]; snprintf_P(buf, sizeof(buf), PSTR("CH%d"), i+1); printSetFormIndex(settingsScript,buf,DMXFixtureMap[i]); } - for (int i = 0; i < MAX_CHANNELS_PER_FIXTURE; i++) { + for (int i = 0; i < WLED_DMX_MAX_CHANNELS_PER_FIXTURE; i++) { char buf[5]; snprintf_P(buf, sizeof(buf), PSTR("DV%d"), i+1); printSetFormValue(settingsScript,buf,DMXChannelsValue[i]);