Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions ESPAsyncE131.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,21 @@ bool ESPAsyncE131::initMulticast(uint16_t universe, uint8_t n) {
if (udp.listenMulticast(address, E131_ListenPort)) {
ip4_addr_t ifaddr;
ip4_addr_t multicast_addr;

ifaddr.addr = static_cast<uint32_t>(WiFi.localIP());
for (uint8_t i = 1; i < n; i++) {

if(ETH.linkUp())
ifaddr.addr = static_cast<uint32_t>(ETH.localIP());
else if(WiFi.isConnected())
ifaddr.addr = static_cast<uint32_t>(WiFi.localIP());
else
ifaddr.addr = static_cast<uint32_t>(IPAddress(0,0,0,0));
for (uint8_t i = 1; i < n; i++) {
multicast_addr.addr = static_cast<uint32_t>(IPAddress(239, 255,
(((universe + i) >> 8) & 0xff), (((universe + i) >> 0)
& 0xff)));
igmp_joingroup(&ifaddr, &multicast_addr);
}

udp.onPacket(std::bind(&ESPAsyncE131::parsePacket, this,
udp.onPacket(std::bind(&ESPAsyncE131::parsePacket, this,
std::placeholders::_1));

success = true;
Expand Down Expand Up @@ -160,7 +165,7 @@ void ESPAsyncE131::parsePacket(AsyncUDPPacket _packet)
break;
}

// Are we looknig for a new source?
// Are we looking for a new source?
if((0 != LastAcceptedSource.PdusToIgnore) &&
(sbuff->priority < LastAcceptedSource.priority))
{
Expand Down
15 changes: 8 additions & 7 deletions ESPAsyncE131.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
#define ESPASYNCE131_H_

#ifdef ESP32
#include <WiFi.h>
#include <AsyncUDP.h>
#elif defined (ESP8266)
#include <ESPAsyncUDP.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <AsyncUDP.h>
#include <ETH.h>
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESPAsyncUDP.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#else
#error Platform not supported
#error Platform not supported
#endif

#include <lwip/ip_addr.h>
Expand Down