From f38249e0735dc3c819192bee98421383472086c0 Mon Sep 17 00:00:00 2001 From: Hideaki Tai Date: Fri, 17 Oct 2025 22:49:12 +0900 Subject: [PATCH 1/3] fix: avoid type confliction if using WiFi and ETH --- ArtnetETH.h | 19 ++-- .../send_receive_eth/send_receive_eth.ino | 102 ++++++++++++++++++ 2 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 examples/Multiple/send_receive_eth/send_receive_eth.ino diff --git a/ArtnetETH.h b/ArtnetETH.h index 49f9fcf..9330ba6 100644 --- a/ArtnetETH.h +++ b/ArtnetETH.h @@ -9,6 +9,10 @@ #include #include "Artnet/ReceiverTraits.h" +// ETH.h is a library for Ethernet PHY, but we should use WiFi library's apis for sever/client +// So we define new type to avoid type confliction with WiFiUDP +struct ETHUdp : public WiFiUDP {}; + namespace art_net { template <> @@ -37,25 +41,25 @@ struct MacAddress }; template <> -IPAddress getLocalIP() +IPAddress getLocalIP() { return LocalIP::get(ETH); } template <> -IPAddress getSubnetMask() +IPAddress getSubnetMask() { return SubnetMask::get(ETH); } template <> -void getMacAddress(uint8_t mac[6]) +void getMacAddress(uint8_t mac[6]) { MacAddress::get(ETH, mac); } template <> -bool isNetworkReady() +bool isNetworkReady() { return true; } @@ -64,9 +68,8 @@ bool isNetworkReady() #include "Artnet/Manager.h" -// ETH.h is a library for Ethernet PHY, but we should use WiFi library's apis for sever/client -using ArtnetETH = art_net::Manager; -using ArtnetETHSender = art_net::Sender; -using ArtnetETHReceiver = art_net::Receiver; +using ArtnetETH = art_net::Manager; +using ArtnetETHSender = art_net::Sender; +using ArtnetETHReceiver = art_net::Receiver; #endif // ARTNET_ETH_H diff --git a/examples/Multiple/send_receive_eth/send_receive_eth.ino b/examples/Multiple/send_receive_eth/send_receive_eth.ino new file mode 100644 index 0000000..e99316c --- /dev/null +++ b/examples/Multiple/send_receive_eth/send_receive_eth.ino @@ -0,0 +1,102 @@ +#include +#include + +// WiFi stuff +const char* ssid = "your-ssid"; +const char* pwd = "your-password"; +const IPAddress ip_wifi(192, 168, 1, 201); +const IPAddress gateway(192, 168, 1, 1); +const IPAddress subnet(255, 255, 255, 0); +// Ethernet stuff +const IPAddress ip_ether(192, 168, 0, 201); +uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; + +ArtnetETH artnet_ether; +ArtnetWiFi artnet_wifi; +const String target_ip = "192.168.1.200"; +uint8_t universe = 1; // 0 - 15 + +const uint16_t size = 512; +uint8_t data[size]; +uint8_t value = 0; + +// if Artnet packet comes to this universe, this function is called +void onArtDmxUniverse(const uint8_t *data, uint16_t size, const ArtDmxMetadata& metadata, const ArtNetRemoteInfo& remote) +{ + Serial.print("lambda : artnet data from "); + Serial.print(remote.ip); + Serial.print(":"); + Serial.print(remote.port); + Serial.print(", universe = "); + Serial.print(universe); + Serial.print(", size = "); + Serial.print(size); + Serial.print(") :"); + for (size_t i = 0; i < size; ++i) { + Serial.print(data[i]); + Serial.print(","); + } + Serial.println(); +}; + +// if Artnet packet comes, this function is called to every universe +void onArtDmx(const uint8_t *data, uint16_t size, const ArtDmxMetadata& metadata, const ArtNetRemoteInfo& remote) +{ + Serial.print("received ArtNet data from "); + Serial.print(remote.ip); + Serial.print(":"); + Serial.print(remote.port); + Serial.print(", net = "); + Serial.print(metadata.net); + Serial.print(", subnet = "); + Serial.print(metadata.subnet); + Serial.print(", universe = "); + Serial.print(metadata.universe); + Serial.print(", sequence = "); + Serial.print(metadata.sequence); + Serial.print(", size = "); + Serial.print(size); + Serial.println(")"); +}; + +void setup() { + Serial.begin(115200); + + // WiFi stuff + WiFi.begin(ssid, pwd); + WiFi.config(ip_wifi, gateway, subnet); + while (WiFi.status() != WL_CONNECTED) { + Serial.print("."); + delay(500); + } + Serial.print("WiFi connected, IP = "); + Serial.println(WiFi.localIP()); + // ArtnetWiFi + artnet_wifi.begin(); + artnet_wifi.subscribeArtDmxUniverse(universe, onArtDmxUniverse); + artnet_wifi.subscribeArtDmx(onArtDmx); + + // Ethernet stuff + ETH.begin(); + ETH.config(ip_ether, gateway, subnet); + // ArtnetETH + artnet_ether.begin(); + artnet_ether.subscribeArtDmxUniverse(universe, onArtDmxUniverse); + artnet_ether.subscribeArtDmx(onArtDmx); +} + +void loop() { + // check if artnet packet has come and execute callback + artnet_wifi.parse(); + artnet_ether.parse(); + + value = (millis() / 4) % 256; + memset(data, value, size); + + artnet_wifi.setArtDmxData(data, size); + artnet_ether.setArtDmxData(data, size); + + // automatically send set data in 40fps + artnet_wifi.streamArtDmxTo(target_ip, universe); + artnet_ether.streamArtDmxTo(target_ip, universe); +} From 827873fc68fa375298c854e2269af63fa1d59df5 Mon Sep 17 00:00:00 2001 From: Hideaki Tai Date: Fri, 17 Oct 2025 23:35:52 +0900 Subject: [PATCH 2/3] ci: do not limit branches on pull request --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca4c1d7..57dae4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,9 +9,7 @@ on: - "library.properties" - "library.json" pull_request: - branches: - - main - - develop + branches: ["**"] paths-ignore: - .git* - "**.md" From dea1de587b2942055bc82ac56d3bc80be8602d92 Mon Sep 17 00:00:00 2001 From: Hideaki Tai Date: Fri, 17 Oct 2025 23:44:06 +0900 Subject: [PATCH 3/3] ci: remove esp8266 from build test for --- .github/workflows/build.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57dae4f..2c2491f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -397,9 +397,6 @@ jobs: fail-fast: false matrix: board: - - vendor: esp8266 - arch: esp8266 - name: generic - vendor: esp32 arch: esp32 name: esp32 @@ -410,9 +407,6 @@ jobs: arch: esp32 name: esp32c3 include: - - index: https://arduino.esp8266.com/stable/package_esp8266com_index.json - board: - vendor: esp8266 - index: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json board: vendor: esp32