forkineye / ESPAsyncE131

Asynchronous E1.31 (sACN) library for Arduino ESP8266 and ESP32

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding non-sequential universes in multicast

TyIsI opened this issue · comments

commented

Hi,

I'm currently working on functionality to add additional universes at runtime. Would you be interested in receiving a PR for this and if so, do you have preference for a particular naming convention?

Cheers

hi @TyIsI I am currently working on trying to add multi-universe multicast support for my WLED setup. Wondering if your code is somewhere I could look at? Or have any tips?

commented

This is what I've added:

/////////////////////////////////////////////////////////
//
// Add and remove additional universes - Public
//
/////////////////////////////////////////////////////////

void ESPAsyncE131::addUniverse(uint16_t universe)
{
    delay(100);

    ip4_addr_t ifaddr;
    ip4_addr_t multicast_addr;

    ifaddr.addr = static_cast<uint32_t>(WiFi.localIP());
    multicast_addr.addr = static_cast<uint32_t>(IPAddress(239, 255,
                                                          ((universe >> 8) & 0xff), ((universe >> 0) & 0xff)));
    igmp_joingroup(&ifaddr, &multicast_addr);
}

void ESPAsyncE131::removeUniverse(uint16_t universe)
{
    delay(100);

    ip4_addr_t ifaddr;
    ip4_addr_t multicast_addr;

    ifaddr.addr = static_cast<uint32_t>(WiFi.localIP());
    multicast_addr.addr = static_cast<uint32_t>(IPAddress(239, 255,
                                                          ((universe >> 8) & 0xff), ((universe >> 0) & 0xff)));
    igmp_leavegroup(&ifaddr, &multicast_addr);
}