From cc221330ba1dbac71d2214dbcdb3699d74b02e83 Mon Sep 17 00:00:00 2001 From: Ryan Gregg Date: Sun, 19 Jul 2026 10:17:08 -0700 Subject: [PATCH] Fix nRF52 builds: guard SerialEthernetInterface with ETHERNET_ENABLED SerialEthernetInterface.cpp is compiled for every nRF52 target because PlatformIO builds all .cpp files under src/. It includes SerialEthernetInterface.h, which unconditionally pulls in -- a library only present in the RAK4631 Ethernet env's lib_deps. As a result any other nRF52 board (e.g. Heltec T114) fails to build with 'RAK13800_W5100S.h: No such file or directory'. Wrap the contents of both files in '#ifdef ETHERNET_ENABLED' so they compile to empty translation units on non-Ethernet builds. RAK4631 Ethernet envs define ETHERNET_ENABLED and are unaffected. Fixes #2985 --- src/helpers/nrf52/SerialEthernetInterface.cpp | 4 ++++ src/helpers/nrf52/SerialEthernetInterface.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/helpers/nrf52/SerialEthernetInterface.cpp b/src/helpers/nrf52/SerialEthernetInterface.cpp index 70891023..36a998a4 100644 --- a/src/helpers/nrf52/SerialEthernetInterface.cpp +++ b/src/helpers/nrf52/SerialEthernetInterface.cpp @@ -1,3 +1,5 @@ +#ifdef ETHERNET_ENABLED + #include "SerialEthernetInterface.h" #include "EthernetMac.h" #include @@ -262,3 +264,5 @@ bool SerialEthernetInterface::isConnected() const { void SerialEthernetInterface::loop() { Ethernet.maintain(); } + +#endif // ETHERNET_ENABLED diff --git a/src/helpers/nrf52/SerialEthernetInterface.h b/src/helpers/nrf52/SerialEthernetInterface.h index 95ce8a52..b8b4e94b 100644 --- a/src/helpers/nrf52/SerialEthernetInterface.h +++ b/src/helpers/nrf52/SerialEthernetInterface.h @@ -1,5 +1,7 @@ #pragma once +#ifdef ETHERNET_ENABLED + #include "helpers/BaseSerialInterface.h" #include #include @@ -76,3 +78,5 @@ class SerialEthernetInterface : public BaseSerialInterface { #define ETHERNET_DEBUG_PRINTLN(...) {} #define ETHERNET_DEBUG_PRINT_IP(...) {} #endif + +#endif // ETHERNET_ENABLED