mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Address PR review feedback for Ethernet support
- Add #pragma once to SerialEthernetInterface.h
- Rename TCP_PORT to ETH_TCP_PORT with #ifndef guard
- Fix typos: "initalizing" → "initializing"
- Fix #elif without condition → #else for STM32 block
- Replace infinite loop on ETH init failure with halt()
- Remove heartbeat Serial.print(".") output
- Remove dead beginETH() call (ETH_ENABLED, not RAK_ETH_ENABLE)
- Comment out MESH_DEBUG and ETH_DEBUG_LOGGING build flags
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
70b51bd096
commit
aea64e1f19
5 changed files with 16 additions and 26 deletions
|
|
@ -12,7 +12,6 @@ static uint32_t _atoi(const char* sp) {
|
|||
return n;
|
||||
}
|
||||
|
||||
uint32_t tick_count = 0;
|
||||
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
#include <InternalFileSystem.h>
|
||||
|
|
@ -87,7 +86,7 @@ uint32_t tick_count = 0;
|
|||
#ifdef ETH_ENABLED
|
||||
#include <helpers/nrf52/SerialEthernetInterface.h>
|
||||
SerialEthernetInterface serial_interface;
|
||||
#elif
|
||||
#else
|
||||
#include <helpers/ArduinoSerialInterface.h>
|
||||
ArduinoSerialInterface serial_interface;
|
||||
#endif
|
||||
|
|
@ -161,7 +160,7 @@ void setup() {
|
|||
|
||||
#ifdef BLE_PIN_CODE
|
||||
serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
|
||||
#elif ETH_ENABLED
|
||||
#elif defined(ETH_ENABLED)
|
||||
|
||||
Serial.print("Waiting for serial to connect...\n");
|
||||
time_t timeout = millis();
|
||||
|
|
@ -170,13 +169,11 @@ void setup() {
|
|||
{
|
||||
if ((millis() - timeout) < 5000) { delay(100); } else { break; }
|
||||
}
|
||||
Serial.print("Initalizing ethernet adapter....\n");
|
||||
Serial.print("Initializing ethernet adapter....\n");
|
||||
bool result = serial_interface.begin();
|
||||
if (!result) {
|
||||
while (true)
|
||||
{
|
||||
delay(1); // Do nothing, just love you.
|
||||
}
|
||||
Serial.println("ETH: Init failed, halting");
|
||||
halt();
|
||||
}
|
||||
#else
|
||||
serial_interface.begin(Serial);
|
||||
|
|
@ -252,12 +249,6 @@ void 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
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ SPIClass ETH_SPI_PORT(NRF_SPIM1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI);
|
|||
|
||||
bool SerialEthernetInterface::begin() {
|
||||
|
||||
ETH_DEBUG_PRINTLN("Ethernet initalizing");
|
||||
ETH_DEBUG_PRINTLN("Ethernet initializing");
|
||||
|
||||
#ifdef PIN_ETH_POWER_EN
|
||||
ETH_DEBUG_PRINTLN("Ethernet power enable");
|
||||
|
|
@ -90,7 +90,7 @@ bool SerialEthernetInterface::begin() {
|
|||
ETH_DEBUG_PRINT_IP("Gateway", gateway);
|
||||
|
||||
server.begin(); // start listening for clients
|
||||
ETH_DEBUG_PRINTLN("Ethernet: listening on TCP port: %d", TCP_PORT);
|
||||
ETH_DEBUG_PRINTLN("Ethernet: listening on TCP port: %d", ETH_TCP_PORT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "helpers/BaseSerialInterface.h"
|
||||
#include <SPI.h>
|
||||
#include <RAK13800_W5100S.h>
|
||||
|
||||
// expects ETH_ENABLED = 1
|
||||
#define TCP_PORT 5000
|
||||
#ifndef ETH_TCP_PORT
|
||||
#define ETH_TCP_PORT 5000
|
||||
#endif
|
||||
// define ETH_RAW_LINE=1 to use raw line-based CLI instead of framed packets
|
||||
|
||||
class SerialEthernetInterface : public BaseSerialInterface {
|
||||
|
|
@ -42,7 +44,7 @@ class SerialEthernetInterface : public BaseSerialInterface {
|
|||
protected:
|
||||
|
||||
public:
|
||||
SerialEthernetInterface() : server(EthernetServer(TCP_PORT)) {
|
||||
SerialEthernetInterface() : server(EthernetServer(ETH_TCP_PORT)) {
|
||||
deviceConnected = false;
|
||||
_isEnabled = false;
|
||||
_last_write = 0;
|
||||
|
|
|
|||
|
|
@ -36,9 +36,6 @@ void RAK4631Board::begin() {
|
|||
pinMode(PIN_USER_BTN_ANA, INPUT_PULLUP);
|
||||
#endif
|
||||
|
||||
#ifdef RAK_ETH_ENABLE
|
||||
beginETH();
|
||||
#endif
|
||||
|
||||
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ build_flags =
|
|||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
-D ETH_ENABLED=1
|
||||
-D MESH_DEBUG=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
|
|
@ -139,7 +139,7 @@ build_flags =
|
|||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ROOM_PASSWORD='"hello"'
|
||||
-D ETH_ENABLED=1
|
||||
-D MESH_DEBUG=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_room_server>
|
||||
|
|
@ -187,8 +187,8 @@ build_flags =
|
|||
-D ETH_ENABLED=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
-D MESH_DEBUG=1
|
||||
-D ETH_DEBUG_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
; -D ETH_DEBUG_LOGGING=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue