Add native Ethernet support for RAK4631 repeater, room server, and companion

Add W5100S Ethernet adapter support for RAK4631-based firmware, enabling
TCP CLI access on port 23 as an alternative to BLE/Serial connections.

- New SerialEthernetInterface for nRF52 with DHCP, reconnection handling,
  and shared WB_IO2 power pin management with GPS module
- Ethernet build targets for repeater, room server, and companion firmware
- Prevent GPS from toggling WB_IO2 when Ethernet module is active
- CI build check for all three ETH firmware targets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ryan Gregg 2026-03-09 14:52:01 -07:00
parent a10476efd7
commit 70b51bd096
9 changed files with 842 additions and 11 deletions

View file

@ -12,19 +12,21 @@ static uint32_t _atoi(const char* sp) {
return n;
}
uint32_t tick_count = 0;
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
#include <InternalFileSystem.h>
#if defined(QSPIFLASH)
#include <CustomLFS_QSPIFlash.h>
DataStore store(InternalFS, QSPIFlash, rtc_clock);
#else
#if defined(EXTRAFS)
#include <CustomLFS.h>
CustomLFS ExtraFS(0xD4000, 0x19000, 128);
DataStore store(InternalFS, ExtraFS, rtc_clock);
#else
DataStore store(InternalFS, rtc_clock);
#endif
#if defined(EXTRAFS)
#include <CustomLFS.h>
CustomLFS ExtraFS(0xD4000, 0x19000, 128);
DataStore store(InternalFS, ExtraFS, rtc_clock);
#else
DataStore store(InternalFS, rtc_clock);
#endif
#endif
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
@ -74,13 +76,21 @@ static uint32_t _atoi(const char* sp) {
#ifdef BLE_PIN_CODE
#include <helpers/nrf52/SerialBLEInterface.h>
SerialBLEInterface serial_interface;
#elif defined(ETH_ENABLED)
#include <helpers/nrf52/SerialEthernetInterface.h>
SerialEthernetInterface serial_interface;
#else
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface serial_interface;
#endif
#elif defined(STM32_PLATFORM)
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface serial_interface;
#ifdef ETH_ENABLED
#include <helpers/nrf52/SerialEthernetInterface.h>
SerialEthernetInterface serial_interface;
#elif
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface serial_interface;
#endif
#else
#error "need to define a serial interface"
#endif
@ -107,7 +117,6 @@ void halt() {
void setup() {
Serial.begin(115200);
board.begin();
#ifdef DISPLAY_CLASS
@ -152,6 +161,23 @@ void setup() {
#ifdef BLE_PIN_CODE
serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
#elif ETH_ENABLED
Serial.print("Waiting for serial to connect...\n");
time_t timeout = millis();
// Initialize Serial for debug output.
while (!Serial)
{
if ((millis() - timeout) < 5000) { delay(100); } else { break; }
}
Serial.print("Initalizing ethernet adapter....\n");
bool result = serial_interface.begin();
if (!result) {
while (true)
{
delay(1); // Do nothing, just love you.
}
}
#else
serial_interface.begin(Serial);
#endif
@ -225,4 +251,14 @@ void loop() {
ui_task.loop();
#endif
rtc_clock.tick();
// Debugging only... making sure something is alive.
tick_count++;
if (tick_count % 5000 == 0) {
Serial.print(".");
}
#ifdef ETH_ENABLED
serial_interface.maintain();
#endif
}