mirror of
https://github.com/wled/WLED.git
synced 2025-07-27 12:46:38 +00:00
Add ability to set DMX fixtures to a segment and from what LED they should start.
This commit is contained in:
parent
ef125ff109
commit
0ce77bbc59
@ -218,7 +218,13 @@ channels per fixture (15 max): <input type="number" min="1" max="15" name="CN" m
|
||||
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>
|
||||
<div id="gapwarning" style="color: orange; display: none;">WARNING: Channel gap is lower than channels per fixture.<br />This will cause overlap.</div>
|
||||
<button type="button" onclick="location.href='/dmxmap';">DMX Map</button>
|
||||
<button type="button" onclick="location.href='/dmxmap';">DMX Map</button><br>
|
||||
|
||||
<i>If wanting to use DMX together with LEDs. Number of fixtures will also depend on the segment and start LED settings below</i><br>
|
||||
<i>Using these settings, you can position your fixtures anywhere you want on the LED strip</i><br>
|
||||
which segment should DMX use: <input type="number" min="0" max="9" name="SEG" maxlength="2"><br />
|
||||
start LED from the above channel from which DMX fixtures should start: <input type="number" min="0" max="1500" name="SL" maxlength="2"><br />
|
||||
|
||||
<h3>channel functions</h3>
|
||||
<div id="dmxchannels"></div>
|
||||
<hr><button type="button" onclick="B()">Back</button><button type="submit">Save</button>
|
||||
|
@ -23,7 +23,7 @@
|
||||
//#define WLED_DISABLE_INFRARED //there is no pin left for this on ESP8266-01, saves 12kb
|
||||
#define WLED_ENABLE_MQTT //saves 12kb
|
||||
#define WLED_ENABLE_ADALIGHT //saves 500b only
|
||||
//#define WLED_ENABLE_DMX //uses 3.5kb
|
||||
//#define WLED_ENABLE_DMX //uses 3.5kb, if wanting to use DMX together with LEDs, you should change the LEDPIN to something other than 2 in NpbWrapper.h
|
||||
|
||||
#define WLED_DISABLE_FILESYSTEM //SPIFFS is not used by any WLED feature yet
|
||||
//#define WLED_ENABLE_FS_SERVING //Enable sending html file from SPIFFS before serving progmem version
|
||||
@ -277,6 +277,8 @@ uint16_t userVar0 = 0, userVar1 = 0;
|
||||
// assigns the different channels to different functions. See wled21_dmx.ino for more information.
|
||||
uint16_t DMXGap = 10; // gap between the fixtures. makes addressing easier because you don't have to memorize odd numbers when climbing up onto a rig.
|
||||
uint16_t DMXStart = 10; // start address of the first fixture
|
||||
uint16_t DMXSegment = 0; // segment which DMX fixtures use
|
||||
uint16_t DMXStartLED = 0; // start LED from which DMX fixtures should start
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -270,6 +270,9 @@ void saveSettingsToEEPROM()
|
||||
for (int i=0; i<15; i++) {
|
||||
EEPROM.write(2535+i, DMXFixtureMap[i]);
|
||||
} // last used: 2549. maybe leave a few bytes for future expansion and go on with 2600 kthxbye.
|
||||
|
||||
EEPROM.write(2550, DMXSegment);
|
||||
EEPROM.write(2551, DMXStartLED);
|
||||
#endif
|
||||
|
||||
commit();
|
||||
@ -551,6 +554,8 @@ void loadSettingsFromEEPROM(bool first)
|
||||
DMXChannels = EEPROM.read(2530);
|
||||
DMXGap = EEPROM.read(2531) + ((EEPROM.read(2532) << 8) & 0xFF00);
|
||||
DMXStart = EEPROM.read(2533) + ((EEPROM.read(2534) << 8) & 0xFF00);
|
||||
DMXSegment = EEPROM.read(2550);
|
||||
DMXStartLED = EEPROM.read(2551);
|
||||
|
||||
for (int i=0;i<15;i++) {
|
||||
DMXFixtureMap[i] = EEPROM.read(2535+i);
|
||||
|
@ -455,6 +455,8 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('v',"CN",DMXChannels);
|
||||
sappend('v',"CG",DMXGap);
|
||||
sappend('v',"CS",DMXStart);
|
||||
sappend('v',"SEG",DMXSegment);
|
||||
sappend('v',"SL",DMXStartLED);
|
||||
|
||||
sappend('i',"CH1",DMXFixtureMap[0]);
|
||||
sappend('i',"CH2",DMXFixtureMap[1]);
|
||||
|
@ -310,6 +310,14 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
t = request->arg(argname).toInt();
|
||||
DMXFixtureMap[i] = t;
|
||||
}
|
||||
t = request->arg("SEG").toInt();
|
||||
if (t>=0 && t<10) {
|
||||
DMXSegment = t;
|
||||
}
|
||||
t = request->arg("SL").toInt();
|
||||
if (t>=0 && t<1500) {
|
||||
DMXStartLED = t;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -6,19 +6,26 @@
|
||||
#ifdef WLED_ENABLE_DMX
|
||||
|
||||
void handleDMX() {
|
||||
// TODO: calculate brightness manually if no shutter channel is set
|
||||
WS2812FX::Segment& seg = strip.getSegment(DMXSegment);
|
||||
|
||||
if (!seg.isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: calculate brightness manually if no shutter channel is set
|
||||
uint8_t brightness = strip.getBrightness();
|
||||
|
||||
for (int i = 0; i < ledCount; i++) { // uses the amount of LEDs as fixture count
|
||||
// Calculate the start LED depending on segment and DMXStartLED config
|
||||
uint8_t startLed = seg.start + DMXStartLED;
|
||||
|
||||
for (int i = startLed; i < seg.stop; i++) {
|
||||
uint32_t in = strip.getPixelColor(i); // time to get the colors for the individual fixtures as suggested by AirCookie at issue #462
|
||||
byte w = in >> 24 & 0xFF;
|
||||
byte r = in >> 16 & 0xFF;
|
||||
byte g = in >> 8 & 0xFF;
|
||||
byte b = in & 0xFF;
|
||||
|
||||
int DMXFixtureStart = DMXStart + (DMXGap * i);
|
||||
int DMXFixtureStart = DMXStart + (DMXGap * (i - startLed));
|
||||
for (int j = 0; j < DMXChannels; j++) {
|
||||
int DMXAddr = DMXFixtureStart + j;
|
||||
switch (DMXFixtureMap[j]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user