increase E131 max universes from 12 to 112 (esp32 boards only)

* use a more meaningful max universes limit of 112 (safe up to 128x128 pixels)
* accept more universes, but only track sequences for the configures max universes
* made e131LastSequenceNumber[] local (its only used in e131.cpp)
This commit is contained in:
Frank
2025-01-16 14:48:54 +01:00
parent 63db2c9fc1
commit bd31dd2508
3 changed files with 12 additions and 6 deletions

View File

@@ -446,7 +446,11 @@
#ifdef ESP8266
#define E131_MAX_UNIVERSE_COUNT 9
#else
#define E131_MAX_UNIVERSE_COUNT 12
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6)
#define E131_MAX_UNIVERSE_COUNT 112 // WLEDMM enough universes for 128 x 128 pixels, for boards that can handle it
#else
#define E131_MAX_UNIVERSE_COUNT 12 // WLEDMM use upstream default for S2 and C3
#endif
#endif
#endif
#endif

View File

@@ -7,6 +7,7 @@
/*
* E1.31 handler
*/
static byte e131LastSequenceNumber[E131_MAX_UNIVERSE_COUNT] = {0}; // to detect packet loss // WLEDMM moved from wled.h into e131.cpp
//DDP protocol support, called by handleE131Packet
//handles RGB data only
@@ -94,11 +95,12 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
}
// only listen for universes we're handling & allocated memory
if (uni < e131Universe || uni >= (e131Universe + E131_MAX_UNIVERSE_COUNT)) return;
//if (uni < e131Universe || uni >= (e131Universe + E131_MAX_UNIVERSE_COUNT)) return;
if (uni < e131Universe || uni >= e131Universe + 256) return; // WLEDMM just prevent overflow
uint8_t previousUniverses = uni - e131Universe;
if (e131SkipOutOfSequence)
if (e131SkipOutOfSequence && (previousUniverses < E131_MAX_UNIVERSE_COUNT)) // WLEDMM
if (seq < e131LastSequenceNumber[previousUniverses] && seq > 20 && e131LastSequenceNumber[previousUniverses] < 250){
DEBUG_PRINT(F("skipping E1.31 frame (last seq="));
DEBUG_PRINT(e131LastSequenceNumber[previousUniverses]);
@@ -109,7 +111,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
DEBUG_PRINTLN(")");
return;
}
e131LastSequenceNumber[previousUniverses] = seq;
if (previousUniverses < E131_MAX_UNIVERSE_COUNT) e131LastSequenceNumber[previousUniverses] = seq; // WLEDMM prevent array bounds violation
// update status info
realtimeIP = clientIP;

View File

@@ -7,7 +7,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2501160
#define VERSION 2501161
// WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED.
#define _MoonModules_WLED_
@@ -471,7 +471,7 @@ WLED_GLOBAL E131Priority highPriority _INIT(3); // E1.31 highe
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
WLED_GLOBAL byte e131LastSequenceNumber[E131_MAX_UNIVERSE_COUNT]; // to detect packet loss
//WLED_GLOBAL byte e131LastSequenceNumber[E131_MAX_UNIVERSE_COUNT]; // to detect packet loss // WLEDMM move into e131.cpp - array is not used anywhere else
WLED_GLOBAL bool e131Multicast _INIT(false); // multicast or unicast
WLED_GLOBAL bool e131SkipOutOfSequence _INIT(false); // freeze instead of flickering
WLED_GLOBAL uint16_t pollReplyCount _INIT(0); // count number of replies for ArtPoll node report