Trying to move DMX Input setting to sync menu

This commit is contained in:
Will Tatam
2023-03-30 12:35:45 +01:00
parent d530b3b8b7
commit 901ab7a6fc
4 changed files with 35 additions and 4 deletions

View File

@@ -12,6 +12,8 @@
function hideNoDMX(){gId("dmxOnOff2").style.display="none";} //WLEDMM function hideNoDMX(){gId("dmxOnOff2").style.display="none";} //WLEDMM
function hideNoLOX(){gId("loxOnOff2").style.display="none";} //WLEDMM function hideNoLOX(){gId("loxOnOff2").style.display="none";} //WLEDMM
function hideNoADA(){gId("adaOnOff2").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 H(){window.open("https://mm.kno.wled.ge/interfaces/udp-notifier/");}
function B(){window.open("/settings","_self");} 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;} function adj(){if (d.Sf.DI.value == 6454) {if (d.Sf.EU.value == 1) d.Sf.EU.value = 0;}
@@ -172,6 +174,15 @@ Timeout: <input name="ET" type="number" min="1" max="65000" required> ms<br>
Force max brightness: <input type="checkbox" name="FB"><br> Force max brightness: <input type="checkbox" name="FB"><br>
Disable realtime gamma correction: <input type="checkbox" name="RG"><br> Disable realtime gamma correction: <input type="checkbox" name="RG"><br>
Realtime LED offset: <input name="WO" type="number" min="-255" max="255" required> Realtime LED offset: <input name="WO" type="number" min="-255" max="255" required>
<div id="dmxInput"> <!--WLEDMM-->
DMX Pins<br/>
DMX RX: <input name="DMR" type="number" min="-1" max="99"><br/>
DMX TX: <input name="DMT" type="number" min="-1" max="99"><br/>
DMX Enable: <input name="DME" type="number" min="-1" max="99"><br/>
</div>
<div id="dmxInputOff"> <!--WLEDMM-->
<br><em style="color:darkorange">This firmware build does not include DMX Input support. <br></em>
</div>
<div id="dmxOnOff2"> <!--WLEDMM--> <div id="dmxOnOff2"> <!--WLEDMM-->
<br><em style="color:darkorange">This firmware build does not include DMX output support. <br></em> <br><em style="color:darkorange">This firmware build does not include DMX output support. <br></em>
</div> </div>

View File

@@ -102,10 +102,13 @@ void handleDMX() {}
dmx_port_t dmxPort = 2; dmx_port_t dmxPort = 2;
void initDMX() { void initDMX() {
/* Set the DMX hardware pins to the pins that we want to use. */ /* Set the DMX hardware pins to the pins that we want to use. */
int dmxTransmitPin = 2; if(dmxReceivePin > 0) {
int dmxReceivePin = 27; dmx_set_pin(dmxPort, dmxTransmitPin, dmxReceivePin, dmxEnablePin);
int dmxEnablePin = 26; }
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 /* 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 which interrupt priority it should have. If you aren't sure which interrupt
@@ -118,6 +121,9 @@ bool dmxIsConnected = false;
unsigned long dmxLastUpdate = 0; unsigned long dmxLastUpdate = 0;
void handleDMXInput() { void handleDMXInput() {
if(dmxReceivePin < 1) {
return;
}
byte dmxdata[DMX_PACKET_SIZE]; byte dmxdata[DMX_PACKET_SIZE];
dmx_packet_t packet; dmx_packet_t packet;
unsigned long now = millis(); unsigned long now = millis();

View File

@@ -394,6 +394,12 @@ WLED_GLOBAL bool arlsForceMaxBri _INIT(false); // enable to f
#endif #endif
WLED_GLOBAL uint16_t e131ProxyUniverse _INIT(0); // output this E1.31 (sACN) / ArtNet universe via MAX485 (0 = disabled) WLED_GLOBAL uint16_t e131ProxyUniverse _INIT(0); // output this E1.31 (sACN) / ArtNet universe via MAX485 (0 = disabled)
#endif #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 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 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) WLED_GLOBAL byte e131Priority _INIT(0); // E1.31 port priority (if != 0 priority handling is active)

View File

@@ -530,6 +530,14 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W
sappend('v',SET_F("EU"),e131Universe); sappend('v',SET_F("EU"),e131Universe);
#ifdef WLED_ENABLE_DMX #ifdef WLED_ENABLE_DMX
oappend(SET_F("hideNoDMX();")); // WLEDMM hide "not compiled in" message 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 #endif
sappend('v',SET_F("DA"),DMXAddress); sappend('v',SET_F("DA"),DMXAddress);
sappend('v',SET_F("XX"),DMXSegmentSpacing); sappend('v',SET_F("XX"),DMXSegmentSpacing);