Skip to content

Commit cc22133

Browse files
committed
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 <RAK13800_W5100S.h> -- 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
1 parent 795989b commit cc22133

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/helpers/nrf52/SerialEthernetInterface.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifdef ETHERNET_ENABLED
2+
13
#include "SerialEthernetInterface.h"
24
#include "EthernetMac.h"
35
#include <SPI.h>
@@ -262,3 +264,5 @@ bool SerialEthernetInterface::isConnected() const {
262264
void SerialEthernetInterface::loop() {
263265
Ethernet.maintain();
264266
}
267+
268+
#endif // ETHERNET_ENABLED

src/helpers/nrf52/SerialEthernetInterface.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#ifdef ETHERNET_ENABLED
4+
35
#include "helpers/BaseSerialInterface.h"
46
#include <SPI.h>
57
#include <RAK13800_W5100S.h>
@@ -76,3 +78,5 @@ class SerialEthernetInterface : public BaseSerialInterface {
7678
#define ETHERNET_DEBUG_PRINTLN(...) {}
7779
#define ETHERNET_DEBUG_PRINT_IP(...) {}
7880
#endif
81+
82+
#endif // ETHERNET_ENABLED

0 commit comments

Comments
 (0)