From 1235c288dc795cedd433bca3abd2842556a6aefe Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 10 Nov 2024 21:11:40 +0100 Subject: [PATCH] make it compile on all default platforms --- EXmDNS.cpp | 2 ++ EXmDNS.h | 3 ++- EthernetInterface.cpp | 3 ++- EthernetInterface.h | 6 +++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/EXmDNS.cpp b/EXmDNS.cpp index 62511a2..09a3391 100644 --- a/EXmDNS.cpp +++ b/EXmDNS.cpp @@ -20,6 +20,7 @@ #include #include "EthernetInterface.h" +#ifdef DO_MDNS #include "EXmDNS.h" // fixed values for mDNS @@ -193,3 +194,4 @@ void MDNS::run() { _udp->flush(); // } +#endif //DO_MDNS diff --git a/EXmDNS.h b/EXmDNS.h index d8b24d2..676dbe3 100644 --- a/EXmDNS.h +++ b/EXmDNS.h @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with CommandStation. If not, see . */ - +#ifdef DO_MDNS #define BROADCASTTIME 15 //seconds typedef enum _MDNSServiceProtocol_t @@ -41,3 +41,4 @@ private: char* _serviceProto; int _servicePort; }; +#endif //DO_MDNS diff --git a/EthernetInterface.cpp b/EthernetInterface.cpp index cd89c0e..f8a43f2 100644 --- a/EthernetInterface.cpp +++ b/EthernetInterface.cpp @@ -32,10 +32,11 @@ #include "WiThrottle.h" #include "DCCTimer.h" +#ifdef DO_MDNS #include "EXmDNS.h" -#define DO_MDNS EthernetUDP udp; MDNS mdns(udp); +#endif //extern void looptimer(unsigned long timeout, const FSH* message); #define looptimer(a,b) diff --git a/EthernetInterface.h b/EthernetInterface.h index 6cea6e8..13a8b10 100644 --- a/EthernetInterface.h +++ b/EthernetInterface.h @@ -31,13 +31,16 @@ #define EthernetInterface_h #include "defines.h" +#if ETHERNET_ON == true #include "DCCEXParser.h" #include //#include #if defined (ARDUINO_TEENSY41) #include //TEENSY Ethernet Treiber #include + #ifndef MAX_SOCK_NUM #define MAX_SOCK_NUM 4 + #endif #elif defined (ARDUINO_NUCLEO_F429ZI) || defined (ARDUINO_NUCLEO_F439ZI) || defined (ARDUINO_NUCLEO_F4X9ZI) #include // #include "STM32lwipopts.h" @@ -46,6 +49,7 @@ extern "C" struct netif gnetif; #define STM32_ETHERNET #define MAX_SOCK_NUM MAX_NUM_TCP_CLIENTS + #define DO_MDNS #else #include "Ethernet.h" #endif @@ -77,5 +81,5 @@ class EthernetInterface { static void dropClient(byte socketnum); }; - +#endif // ETHERNET_ON #endif