Skip to content

Commit

Permalink
Add new DMX-settings to web
Browse files Browse the repository at this point in the history
  • Loading branch information
mustang-highTower committed Apr 11, 2020
1 parent cc33c3a commit 4c27baa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions wled00/html_settings.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ function GCH(num) {
}
function mMap(){
d=document;
directionPin=document.Sf.DP.value;
outputPin=document.Sf.OP.value;
numCh=document.Sf.CN.value;
numGap=document.Sf.CG.value;
if (parseInt(numCh)>parseInt(numGap)) {
Expand Down Expand Up @@ -214,6 +216,8 @@ function S(){GCH(15);GetV();mMap();}function H(){window.open("https://github.com

<i>Number of fixtures is taken from LED config page</i><br>

MAX485 direction pin: <input type="number" min="0" max="39" name="DP" maxlength="2" onchange="mMap();"><br />
MAX485 serial output pin: <input type="number" min="0" max="39" name="OP" maxlength="2" onchange="mMap();"><br />
channels per fixture (15 max): <input type="number" min="1" max="15" name="CN" maxlength="2" onchange="mMap();"><br />
start channel: <input type="number" min="1" max="512" name="CS" maxlength="2"><br />
spacing between start channels: <input type="number" min="1" max="512" name="CG" maxlength="2" onchange="mMap();"> [ <a href="javascript:alert('if set to 10, first fixture will start at 10,\nsecond will start at 20 etc.\nRegardless of the channel count.\nMakes memorizing channel numbers easier.');">info</a> ]<br>
Expand Down
2 changes: 2 additions & 0 deletions wled00/wled02_xml.ino
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ void getSettingsJS(byte subPage, char* dest)
#ifdef WLED_ENABLE_DMX // include only if DMX is enabled
if (subPage == 7)
{
sappend('v',"DP",DMXDirectionPin);
sappend('v',"OP",DMXSerialOutputPin);
sappend('v',"CN",DMXChannels);
sappend('v',"CG",DMXGap);
sappend('v',"CS",DMXStart);
Expand Down
10 changes: 9 additions & 1 deletion wled00/wled03_set.ino
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,15 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
#ifdef WLED_ENABLE_DMX // include only if DMX is enabled
if (subPage == 7)
{
int t = request->arg("CN").toInt();
int t = request->arg("DP").toInt();
if (t>=0 && t<43) {
DMXDirectionPin = t;
}
t = request->arg("OP").toInt();
if (t>=0 && t<43) {
DMXSerialOutputPin = t;
}
t = request->arg("CN").toInt();
if (t>0 && t<16) {
DMXChannels = t;
}
Expand Down
4 changes: 3 additions & 1 deletion wled00/wled18_server.ino
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ String dmxProcessor(const String& var)
String mapJS;
#ifdef WLED_ENABLE_DMX
if (var == "DMXVARS") {
mapJS += "\nCN=" + String(DMXChannels) + ";\n";
mapJS += "\nDP=" + String(DMXDirectionPin) + ";\n";
mapJS += "OP=" + String(DMXSerialOutputPin) + ";\n";
mapJS += "CN=" + String(DMXChannels) + ";\n";
mapJS += "CS=" + String(DMXStart) + ";\n";
mapJS += "CG=" + String(DMXGap) + ";\n";
mapJS += "LC=" + String(ledCount) + ";\n";
Expand Down

0 comments on commit 4c27baa

Please sign in to comment.