From b851b15a73979917656fdc96a57742f1ce4847aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sun, 20 Jul 2025 23:13:50 +0200 Subject: [PATCH] fix UDP builds on nRF (#7394) * fix UDP builds on nRF * fix rp2040 too --- src/mesh/eth/ethClient.cpp | 2 ++ src/platform/nrf52/AsyncUDP.cpp | 4 ++++ src/platform/nrf52/AsyncUDP.h | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/src/mesh/eth/ethClient.cpp b/src/mesh/eth/ethClient.cpp index fdcc0f4f7..2b4f63512 100644 --- a/src/mesh/eth/ethClient.cpp +++ b/src/mesh/eth/ethClient.cpp @@ -68,9 +68,11 @@ static int32_t reconnectETH() initApiServer(); } #endif +#if HAS_UDP_MULTICAST if (udpHandler && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) { udpHandler->start(); } +#endif ethStartupComplete = true; } diff --git a/src/platform/nrf52/AsyncUDP.cpp b/src/platform/nrf52/AsyncUDP.cpp index 956105cdf..836fb1307 100644 --- a/src/platform/nrf52/AsyncUDP.cpp +++ b/src/platform/nrf52/AsyncUDP.cpp @@ -1,5 +1,7 @@ #include "AsyncUDP.h" +#if HAS_ETHERNET + AsyncUDP::AsyncUDP() : OSThread("AsyncUDP"), localPort(0) {} bool AsyncUDP::listenMulticast(IPAddress multicastIP, uint16_t port, uint8_t ttl) @@ -67,3 +69,5 @@ int32_t AsyncUDP::runOnce() } return 5; // check every 5ms } + +#endif // HAS_ETHERNET \ No newline at end of file diff --git a/src/platform/nrf52/AsyncUDP.h b/src/platform/nrf52/AsyncUDP.h index c7df6d9dd..e2b406ba9 100644 --- a/src/platform/nrf52/AsyncUDP.h +++ b/src/platform/nrf52/AsyncUDP.h @@ -1,6 +1,10 @@ #ifndef ASYNC_UDP_H #define ASYNC_UDP_H +#include "configuration.h" + +#if HAS_ETHERNET + #include "concurrency/OSThread.h" #include #include @@ -54,4 +58,6 @@ inline bool isMulticast(const IPAddress &ip) return (ip[0] & 0xF0) == 0xE0; } +#endif // HAS_ETHERNET + #endif // ASYNC_UDP_H