Added E1.31 port priority handling #768

This commit is contained in:
mxklb 2022-12-19 22:07:37 +01:00
parent c51dbae8b6
commit 2278fc4edb
6 changed files with 13 additions and 1 deletions

View File

@ -388,6 +388,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
if (!DMXAddress || DMXAddress > 510) DMXAddress = 1;
CJSON(DMXSegmentSpacing, if_live_dmx[F("dss")]);
if (DMXSegmentSpacing > 150) DMXSegmentSpacing = 0;
CJSON(e131Priority, if_live_dmx[F("e131prio")]);
if (e131Priority > 200) e131Priority = 200;
CJSON(DMXMode, if_live_dmx["mode"]);
tdd = if_live[F("timeout")] | -1;
@ -846,6 +848,7 @@ void serializeConfig() {
JsonObject if_live_dmx = if_live.createNestedObject("dmx");
if_live_dmx[F("uni")] = e131Universe;
if_live_dmx[F("seqskip")] = e131SkipOutOfSequence;
if_live_dmx[F("e131prio")] = e131Priority;
if_live_dmx[F("addr")] = DMXAddress;
if_live_dmx[F("dss")] = DMXSegmentSpacing;
if_live_dmx["mode"] = DMXMode;

View File

@ -149,6 +149,7 @@ Start universe: <input name="EU" type="number" min="0" max="63999" required><br>
Skip out-of-sequence packets: <input type="checkbox" name="ES"><br>
DMX start address: <input name="DA" type="number" min="1" max="510" required><br>
DMX segment spacing: <input name="XX" type="number" min="0" max="150" required><br>
E1.31 port priority: <input name="PY" type="number" min="0" max="200" required><br>
DMX mode:
<select name=DM>
<option value=0>Disabled</option>

View File

@ -56,7 +56,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
uint16_t uni = 0, dmxChannels = 0;
uint8_t* e131_data = nullptr;
uint8_t seq = 0, mde = REALTIME_MODE_E131;
uint8_t seq = 0, mde = REALTIME_MODE_E131, prio = 0;
if (protocol == P_ARTNET)
{
@ -74,6 +74,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
dmxChannels = htons(p->property_value_count) -1;
e131_data = p->property_values;
seq = p->sequence_number;
prio = p->priority;
} else { //DDP
realtimeIP = clientIP;
handleDDPPacket(p);
@ -89,6 +90,9 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
}
#endif
// ignore packages with priority smaller configured port priority
if ( (prio != 0 && e131Priority != 0) && prio < e131Priority ) return;
// only listen for universes we're handling & allocated memory
if (uni < e131Universe || uni >= (e131Universe + E131_MAX_UNIVERSE_COUNT)) return;

View File

@ -273,6 +273,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
if (t >= 0 && t <= 510) DMXAddress = t;
t = request->arg(F("XX")).toInt();
if (t >= 0 && t <= 150) DMXSegmentSpacing = t;
t = request->arg(F("PY")).toInt();
if (t >= 0 && t <= 200) e131Priority = t;
t = request->arg(F("DM")).toInt();
if (t >= DMX_MODE_DISABLED && t <= DMX_MODE_PRESET) DMXMode = t;
t = request->arg(F("ET")).toInt();

View File

@ -399,6 +399,7 @@ WLED_GLOBAL uint16_t e131ProxyUniverse _INIT(0); // output this
#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 any data.priority < will be skipped)
WLED_GLOBAL byte DMXMode _INIT(DMX_MODE_MULTIPLE_RGB); // DMX mode (s.a.)
WLED_GLOBAL uint16_t DMXAddress _INIT(1); // DMX start address of fixture, a.k.a. first Channel [for E1.31 (sACN) protocol]
WLED_GLOBAL uint16_t DMXSegmentSpacing _INIT(0); // Number of void/unused channels between each segments DMX channels

View File

@ -503,6 +503,7 @@ void getSettingsJS(byte subPage, char* dest)
sappend('v',SET_F("EU"),e131Universe);
sappend('v',SET_F("DA"),DMXAddress);
sappend('v',SET_F("XX"),DMXSegmentSpacing);
sappend('v',SET_F("PY"),e131Priority);
sappend('v',SET_F("DM"),DMXMode);
sappend('v',SET_F("ET"),realtimeTimeoutMs);
sappend('c',SET_F("FB"),arlsForceMaxBri);