track E1.31 seqcuence numbers for each universe individually, wrt #742
This commit is contained in:
parent
0d355dbf35
commit
bffe2d7bd0
@ -206,11 +206,12 @@ bool receiveDirect = true; //receive UDP realtime
|
||||
bool arlsDisableGammaCorrection = true; //activate if gamma correction is handled by the source
|
||||
bool arlsForceMaxBri = false; //enable to force max brightness if source has very dark colors that would be black
|
||||
|
||||
#define E131_MAX_UNIVERSE_COUNT 9
|
||||
uint16_t e131Universe = 1; //settings for E1.31 (sACN) protocol (only DMX_MODE_MULTIPLE_* can span over consequtive universes)
|
||||
uint8_t DMXMode = DMX_MODE_MULTIPLE_RGB; //DMX mode (s.a.)
|
||||
uint16_t DMXAddress = 1; //DMX start address of fixture, a.k.a. first Channel [for E1.31 (sACN) protocol]
|
||||
uint8_t DMXOldDimmer = 0; //only update brightness on change
|
||||
uint8_t e131LastSequenceNumber = 0; //to detect packet loss
|
||||
uint8_t e131LastSequenceNumber[E131_MAX_UNIVERSE_COUNT]; //to detect packet loss
|
||||
bool e131Multicast = false; //multicast or unicast
|
||||
|
||||
bool mqttEnabled = false;
|
||||
@ -464,8 +465,6 @@ void handleE131Packet(e131_packet_t*, IPAddress);
|
||||
void arlsLock(uint32_t,byte);
|
||||
void handleOverlayDraw();
|
||||
|
||||
#define E131_MAX_UNIVERSE_COUNT 9
|
||||
|
||||
//udp interface objects
|
||||
WiFiUDP notifierUdp, rgbUdp;
|
||||
WiFiUDP ntpUdp;
|
||||
|
@ -74,8 +74,6 @@ char* XML_response(AsyncWebServerRequest *request, char* dest = nullptr)
|
||||
mesg += ".";
|
||||
mesg += realtimeIP[i];
|
||||
}
|
||||
mesg += " seq=";
|
||||
mesg += e131LastSequenceNumber;
|
||||
} else if (realtimeMode == REALTIME_MODE_UDP || realtimeMode == REALTIME_MODE_HYPERION) {
|
||||
mesg += "UDP from ";
|
||||
mesg += realtimeIP[0];
|
||||
|
@ -88,26 +88,31 @@ void arlsLock(uint32_t timeoutMs, byte md = REALTIME_MODE_GENERIC)
|
||||
|
||||
void handleE131Packet(e131_packet_t* p, IPAddress clientIP){
|
||||
//E1.31 protocol support
|
||||
|
||||
// skip out-of-sequence packets
|
||||
if (p->sequence_number < e131LastSequenceNumber && p->sequence_number > 20 && e131LastSequenceNumber < 250){
|
||||
DEBUG_PRINT("skipping E1.31 frame (last seq=");
|
||||
DEBUG_PRINT(e131LastSequenceNumber);
|
||||
DEBUG_PRINT(", current seq=");
|
||||
DEBUG_PRINT(p->sequence_number);
|
||||
DEBUG_PRINTLN(")");
|
||||
return;
|
||||
}
|
||||
e131LastSequenceNumber = p->sequence_number;
|
||||
|
||||
// update status info
|
||||
realtimeIP = clientIP;
|
||||
|
||||
uint16_t uni = htons(p->universe);
|
||||
uint8_t previousUniverses = uni - e131Universe;
|
||||
uint16_t possibleLEDsInCurrentUniverse;
|
||||
uint16_t dmxChannels = htons(p->property_value_count) -1;
|
||||
|
||||
// only listen for universes we're handling & allocated memory
|
||||
if (uni >= (e131Universe + E131_MAX_UNIVERSE_COUNT)) return;
|
||||
|
||||
// skip out-of-sequence packets
|
||||
if (p->sequence_number < e131LastSequenceNumber[uni-e131Universe] && p->sequence_number > 20 && e131LastSequenceNumber[uni-e131Universe] < 250){
|
||||
DEBUG_PRINT("skipping E1.31 frame (last seq=");
|
||||
DEBUG_PRINT(e131LastSequenceNumber[uni-e131Universe]);
|
||||
DEBUG_PRINT(", current seq=");
|
||||
DEBUG_PRINT(p->sequence_number);
|
||||
DEBUG_PRINT(", universe=");
|
||||
DEBUG_PRINT(uni);
|
||||
DEBUG_PRINTLN(")");
|
||||
return;
|
||||
}
|
||||
e131LastSequenceNumber[uni-e131Universe] = p->sequence_number;
|
||||
|
||||
// update status info
|
||||
realtimeIP = clientIP;
|
||||
|
||||
switch (DMXMode) {
|
||||
case DMX_MODE_DISABLED:
|
||||
return; // nothing to do
|
||||
|
Loading…
Reference in New Issue
Block a user