Highest priority package first handling
This commit is contained in:
parent
f957e1a08c
commit
f9aa487d5f
@ -74,8 +74,13 @@ 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;
|
||||
// skip packages != e131 config priority
|
||||
if (e131Priority != 0 && p->priority != e131Priority) return;
|
||||
if (e131Priority != 0) {
|
||||
// track lastest e131 package priority ..
|
||||
if (p->priority >= lastPriority.get()) lastPriority.set(p->priority);
|
||||
// skip packages < lastest priority or < e131 config priority
|
||||
if (p->priority < lastPriority.get() || p->priority < e131Priority) return;
|
||||
// Note: HTP for multiple senders with same priority is not implemented!
|
||||
}
|
||||
} else { //DDP
|
||||
realtimeIP = clientIP;
|
||||
handleDDPPacket(p);
|
||||
|
@ -228,4 +228,30 @@ class ESPAsyncE131 {
|
||||
bool begin(bool multicast, uint16_t port = E131_DEFAULT_PORT, uint16_t universe = 1, uint8_t n = 1);
|
||||
};
|
||||
|
||||
// Class to track e131 package priority
|
||||
class E131Priority {
|
||||
private:
|
||||
uint8_t priority;
|
||||
time_t setupTime;
|
||||
uint16_t seconds;
|
||||
|
||||
public:
|
||||
E131Priority(uint16_t timeout=3) {
|
||||
seconds = timeout;
|
||||
set(0);
|
||||
};
|
||||
|
||||
// Set priority (+ remember time)
|
||||
void set(uint8_t prio) {
|
||||
setupTime = time(0);
|
||||
priority = prio;
|
||||
}
|
||||
|
||||
// Get priority (+ reset to default if older timeout)
|
||||
uint8_t get(uint8_t defaultPrio=0) {
|
||||
if (time(0) > setupTime + seconds) priority = defaultPrio;
|
||||
return priority;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ESPASYNCE131_H_
|
@ -403,7 +403,8 @@ 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 e131Priority _INIT(0); // E1.31 port priority (if != 0 priority handling is active)
|
||||
WLED_GLOBAL E131Priority lastPriority _INIT(3); // E1.31 priority tracking timeout, init value = timeout in seconds
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user