e131 quick fixes

- 170 LEDs per universe predefined
- >Second universe data fixed
-  Reduce the number of default universe
This commit is contained in:
Debashish Sahu 2018-12-13 22:02:30 -05:00
parent 26c1996e2a
commit 189254afcd
2 changed files with 4 additions and 4 deletions

View file

@ -21,7 +21,7 @@ const char HOSTNAME[] = "McLighting01"; // Friedly hostname
#ifdef ENABLE_E131 #ifdef ENABLE_E131
#define UNIVERSE 1 // First DMX Universe to listen for #define UNIVERSE 1 // First DMX Universe to listen for
#define UNIVERSE_COUNT 7 // Total number of Universes to listen for, starting at UNIVERSE #define UNIVERSE_COUNT 2 // Total number of Universes to listen for, starting at UNIVERSE
#endif #endif
//#define WIFIMGR_PORTAL_TIMEOUT 180 //#define WIFIMGR_PORTAL_TIMEOUT 180

View file

@ -11,7 +11,7 @@ void handleE131(){
uint16_t universe = htons(packet.universe); uint16_t universe = htons(packet.universe);
uint8_t *data = packet.property_values + 1; uint8_t *data = packet.property_values + 1;
if (!e131.stats.num_packets || universe < UNIVERSE || universe > UNIVERSE_COUNT) return; if (universe < UNIVERSE || universe > UNIVERSE_COUNT) return; //async will take care about filling the buffer
// Serial.printf("Universe %u / %u Channels | Packet#: %u / Errors: %u / CH1: %u\n", // Serial.printf("Universe %u / %u Channels | Packet#: %u / Errors: %u / CH1: %u\n",
// htons(packet.universe), // The Universe for this packet // htons(packet.universe), // The Universe for this packet
@ -20,13 +20,13 @@ void handleE131(){
// e131.stats.packet_errors, // Packet error counter // e131.stats.packet_errors, // Packet error counter
// packet.property_values[1]); // Dimmer data for Channel 1 // packet.property_values[1]); // Dimmer data for Channel 1
uint16_t len = e131.stats.num_packets / 3; uint16_t len = 170; // (htons(packet.property_value_count) - 1) /3;
uint16_t multipacketOffset = (universe - UNIVERSE) * 170; //if more than 170 LEDs (510 channels), client will send in next higher universe uint16_t multipacketOffset = (universe - UNIVERSE) * 170; //if more than 170 LEDs (510 channels), client will send in next higher universe
if (NUMLEDS <= multipacketOffset) return; if (NUMLEDS <= multipacketOffset) return;
if (len + multipacketOffset > NUMLEDS) len = NUMLEDS - multipacketOffset; if (len + multipacketOffset > NUMLEDS) len = NUMLEDS - multipacketOffset;
for (uint16_t i = 0; i < len; i++){ for (uint16_t i = 0; i < len; i++){
uint16_t j = i * 3; uint16_t j = i * 3;
strip.setPixelColor(i, data[j], data[j + 1], data[j + 2]); strip.setPixelColor(i + multipacketOffset, data[j], data[j + 1], data[j + 2]);
} }
strip.show(); strip.show();
} }