From 901ab7a6fcd4b1c6445f5a85f1cc49b46b144ba3 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Thu, 30 Mar 2023 12:35:45 +0100 Subject: [PATCH] Trying to move DMX Input setting to sync menu --- wled00/data/settings_sync.htm | 11 +++++++++++ wled00/dmx.cpp | 14 ++++++++++---- wled00/wled.h | 6 ++++++ wled00/xml.cpp | 8 ++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index 19ff4b1b..4a73de11 100644 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -12,6 +12,8 @@ function hideNoDMX(){gId("dmxOnOff2").style.display="none";} //WLEDMM function hideNoLOX(){gId("loxOnOff2").style.display="none";} //WLEDMM function hideNoADA(){gId("adaOnOff2").style.display="none";} //WLEDMM + function hideDMXInput(){gId("dmxInput").style.display="none";} //WLEDMM + function hideNoDMXInput(){gId("dmxInputOff").style.display="none";} //WLEDMM function H(){window.open("https://mm.kno.wled.ge/interfaces/udp-notifier/");} function B(){window.open("/settings","_self");} function adj(){if (d.Sf.DI.value == 6454) {if (d.Sf.EU.value == 1) d.Sf.EU.value = 0;} @@ -172,6 +174,15 @@ Timeout: ms
Force max brightness:
Disable realtime gamma correction:
Realtime LED offset: +
+ DMX Pins
+ DMX RX:
+ DMX TX:
+ DMX Enable:
+
+
+
This firmware build does not include DMX Input support.
+

This firmware build does not include DMX output support.
diff --git a/wled00/dmx.cpp b/wled00/dmx.cpp index fde05c7a..f20fbd8e 100644 --- a/wled00/dmx.cpp +++ b/wled00/dmx.cpp @@ -102,10 +102,13 @@ void handleDMX() {} dmx_port_t dmxPort = 2; void initDMX() { /* Set the DMX hardware pins to the pins that we want to use. */ - int dmxTransmitPin = 2; - int dmxReceivePin = 27; - int dmxEnablePin = 26; - dmx_set_pin(dmxPort, dmxTransmitPin, dmxReceivePin, dmxEnablePin); + if(dmxReceivePin > 0) { + dmx_set_pin(dmxPort, dmxTransmitPin, dmxReceivePin, dmxEnablePin); + } + else { + USER_PRINTLN("DMX input disabled due to dmxReceivePin not being set"); + return; + } /* Now we can install the DMX driver! We'll tell it which DMX port to use and which interrupt priority it should have. If you aren't sure which interrupt @@ -118,6 +121,9 @@ bool dmxIsConnected = false; unsigned long dmxLastUpdate = 0; void handleDMXInput() { + if(dmxReceivePin < 1) { + return; + } byte dmxdata[DMX_PACKET_SIZE]; dmx_packet_t packet; unsigned long now = millis(); diff --git a/wled00/wled.h b/wled00/wled.h index 92e355c6..e40a57ea 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -394,6 +394,12 @@ WLED_GLOBAL bool arlsForceMaxBri _INIT(false); // enable to f #endif WLED_GLOBAL uint16_t e131ProxyUniverse _INIT(0); // output this E1.31 (sACN) / ArtNet universe via MAX485 (0 = disabled) #endif +#ifdef WLED_ENABLE_DMX_INPUT + WLED_GLOBAL int dmxTransmitPin _INIT(0); + WLED_GLOBAL int dmxReceivePin _INIT(0); + WLED_GLOBAL int dmxEnablePin _INIT(0); +#endif + WLED_GLOBAL uint16_t e131Universe _INIT(1); // settings for E1.31 (sACN) protocol (only DMX_MODE_MULTIPLE_* can span over consequtive universes) WLED_GLOBAL uint16_t e131Port _INIT(5568); // DMX in port. E1.31 default is 5568, Art-Net is 6454 WLED_GLOBAL byte e131Priority _INIT(0); // E1.31 port priority (if != 0 priority handling is active) diff --git a/wled00/xml.cpp b/wled00/xml.cpp index f4dc309b..94318dd4 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -530,6 +530,14 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W sappend('v',SET_F("EU"),e131Universe); #ifdef WLED_ENABLE_DMX oappend(SET_F("hideNoDMX();")); // WLEDMM hide "not compiled in" message +#endif +#ifndef WLED_ENABLE_DMX_INPUT + oappend(SET_F("hideDMXInput();")); // WLEDMM hide "dmx input" settings +#else + oappend(SET_F("hideNoDMXInput();")); // WLEDMM hide "not compiled in" message + sappend('v',SET_F("DMR"),dmxTransmitPin); + sappend('v',SET_F("DMT"),dmxReceivePin); + sappend('v',SET_F("DME"),dmxEnablePin); #endif sappend('v',SET_F("DA"),DMXAddress); sappend('v',SET_F("XX"),DMXSegmentSpacing);