Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"pioarduino.pioarduino-ide",
"platformio.platformio-ide"
],
"unwantedRecommendations": [
Expand Down
51 changes: 51 additions & 0 deletions boards/t_eth_elite.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"build": {
"arduino":{
"ldscript": "esp32s3_out.ld",
"partitions": "default.csv",
"memory_type": "qio_qspi"
},
"core": "esp32",
"extra_flags": [
"-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [
[
"0x303A",
"0x1001"
]
],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": [
"wifi"
],
"debug": {
"default_tool": "esp-builtin",
"onboard_tools": [
"esp-builtin"
],
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "LilyGo T-ETH-Elite (16MB Flash 8MB PSRAM)",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 8388608,
"maximum_size": 16777216,
"require_upload_port": true,
"speed": 460800
},
"url": "https://lilygo.cc/products/t-eth-elite-1",
"vendor": "LilyGo"
}
67 changes: 67 additions & 0 deletions docs/cli_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This document provides an overview of CLI commands that can be sent to MeshCore
- [GPS](#gps-when-gps-support-is-compiled-in)
- [Sensors](#sensors-when-sensor-support-is-compiled-in)
- [Bridge](#bridge-when-bridge-support-is-compiled-in)
- [Ethernet](#ethernet-when-use_ethernet-is-compiled-in)

---

Expand Down Expand Up @@ -1053,3 +1054,69 @@ region save
**Note:** Returns an error on boards without power management support.

---

### Ethernet (When USE_ETHERNET is compiled in)

#### View or change this node's Ethernet IP address
**Usage:**
- `get ip`
- `set ip <address>`

**Parameters:**
- `address`: IPv4 address (e.g., `192.168.254.21`)

**Set by build flag:** `ETH_STATIC_IP`

**Default:** `0.0.0.0` (uses DHCP if not configured)

**Note:** Requires reboot to apply. Set to `0.0.0.0` to revert to DHCP. If `ETH_STATIC_IP` is defined in build flags and DHCP fails, that compile-time address is used as fallback.

---

#### View or change this node's Ethernet gateway
**Usage:**
- `get gw`
- `set gw <address>`

**Parameters:**
- `address`: IPv4 gateway address (e.g., `192.168.254.254`)

**Set by build flag:** `ETH_GATEWAY`

**Default:** `0.0.0.0`

**Note:** Requires reboot to apply

---

#### View or change this node's Ethernet subnet mask
**Usage:**
- `get subnet`
- `set subnet <address>`

**Parameters:**
- `address`: Subnet mask in dotted decimal notation (e.g., `255.255.255.0`)

**Set by build flag:** `ETH_SUBNET`

**Default:** `0.0.0.0`

**Note:** Requires reboot to apply

---

#### View or change this node's Ethernet DNS server
**Usage:**
- `get dns`
- `set dns <address>`

**Parameters:**
- `address`: IPv4 DNS address (e.g., `8.8.8.8`)

**Set by build flag:** `ETH_DNS`

**Default:** `0.0.0.0`

**Note:** Requires reboot to apply. Configures DNS1 (primary DNS server).

---
44 changes: 26 additions & 18 deletions examples/companion_radio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
#include <Mesh.h>
#include "MyMesh.h"

#if defined(ESP32) && defined(TCP_CONSOLE_PORT) && defined(ADMIN_PASSWORD)
#include <helpers/esp32/TCPConsole.h>
TCPConsole tcp_console(nullptr); // prefs set in setup()
#endif

// Believe it or not, this std C function is busted on some platforms!
static uint32_t _atoi(const char* sp) {
uint32_t n = 0;
Expand Down Expand Up @@ -35,7 +40,7 @@ static uint32_t _atoi(const char* sp) {
#endif

#ifdef ESP32
#ifdef WIFI_SSID
#if defined(WIFI_SSID) || defined(USE_ETHERNET)
#include <helpers/esp32/SerialWifiInterface.h>
SerialWifiInterface serial_interface;
#ifndef TCP_PORT
Expand Down Expand Up @@ -115,6 +120,10 @@ void setup() {
Serial.begin(115200);

board.begin();

#if defined(ESP32) && defined(TCP_CONSOLE_PORT) && defined(ADMIN_PASSWORD)
tcp_console.begin();
#endif

#ifdef DISPLAY_CLASS
DisplayDriver* disp = NULL;
Expand All @@ -128,7 +137,7 @@ void setup() {
disp->endFrame();
}
#endif

if (!radio_init()) { halt(); }

fast_rng.begin(radio_driver.getRngSeed());
Expand All @@ -149,6 +158,9 @@ void setup() {
#endif
store.begin();
the_mesh.begin(

tcp_console.setPrefs(the_mesh.getNodePrefs());

#ifdef DISPLAY_CLASS
disp != NULL
#else
Expand Down Expand Up @@ -200,21 +212,12 @@ void setup() {
);

#ifdef WIFI_SSID
board.setInhibitSleep(true); // prevent sleep when WiFi is active
WiFi.setAutoReconnect(true);

WiFi.onEvent([](WiFiEvent_t event, WiFiEventInfo_t info){
if (event == ARDUINO_EVENT_WIFI_STA_DISCONNECTED) {
WIFI_DEBUG_PRINTLN("WiFi disconnected. Flagging for reconnect...");
wifi_needs_reconnect = true;
} else if (event == ARDUINO_EVENT_WIFI_STA_GOT_IP) {
WIFI_DEBUG_PRINTLN("WiFi connected successfully!");
wifi_needs_reconnect = false;
}
});

board.setInhibitSleep(true);
WiFi.begin(WIFI_SSID, WIFI_PWD);
serial_interface.begin(TCP_PORT);
#elif defined(USE_ETHERNET)
serial_interface.begin(TCP_PORT);
Serial.printf("TCP server started on port %d\n", TCP_PORT);
#elif defined(BLE_PIN_CODE)
serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
#elif defined(SERIAL_RX)
Expand Down Expand Up @@ -242,10 +245,15 @@ void setup() {

void loop() {
the_mesh.loop();
#if defined(ESP32) && defined(TCP_CONSOLE_PORT) && defined(ADMIN_PASSWORD)
tcp_console.loop(the_mesh);
#endif

sensors.loop();
#ifdef DISPLAY_CLASS
ui_task.loop();
#endif
#ifdef DISPLAY_CLASS
ui_task.loop();
#endif

rtc_clock.tick();

#if defined(ESP32) && defined(WIFI_SSID)
Expand Down
4 changes: 2 additions & 2 deletions examples/companion_radio/ui-new/UITask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ void UITask::loop() {
}
#endif
#if defined(PIN_USER_BTN_ANA)
if (abs(millis() - _analogue_pin_read_millis) > 10) {
int ev = analog_btn.check();
if (millis() - _analogue_pin_read_millis > 10) {
auto ev = analog_btn.check();
if (ev == BUTTON_EVENT_CLICK) {
c = checkDisplayOn(KEY_NEXT);
} else if (ev == BUTTON_EVENT_LONG_PRESS) {
Expand Down
24 changes: 24 additions & 0 deletions examples/simple_repeater/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

#include "MyMesh.h"

#if defined(TCP_CONSOLE_PORT)
#include <helpers/esp32/TCPConsole.h>
TCPConsole tcp_console(nullptr); // prefs set in setup()
#endif

#ifdef DISPLAY_CLASS
#include "UITask.h"
static UITask ui_task(display);
Expand Down Expand Up @@ -34,6 +39,10 @@ void setup() {

board.begin();

#if defined(TCP_CONSOLE_PORT)
tcp_console.begin();
#endif

#if defined(MESH_DEBUG) && defined(NRF52_PLATFORM)
// give some extra time for serial to settle so
// boot debug messages can be seen on terminal
Expand Down Expand Up @@ -95,6 +104,17 @@ void setup() {

the_mesh.begin(fs);

#ifdef USE_ETHERNET
NodePrefs* prefs = the_mesh.getNodePrefs();
if (prefs->eth_ip != 0) {
board.reconfigureEthernet(prefs->eth_ip, prefs->eth_gateway, prefs->eth_subnet, prefs->eth_dns1);
}
#endif

#if defined(TCP_CONSOLE_PORT)
tcp_console.setPrefs(the_mesh.getNodePrefs());
#endif

#ifdef DISPLAY_CLASS
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
#endif
Expand Down Expand Up @@ -148,6 +168,10 @@ void loop() {
#endif

the_mesh.loop();
#if defined(TCP_CONSOLE_PORT)
tcp_console.loop(the_mesh);
#endif

sensors.loop();
#ifdef DISPLAY_CLASS
ui_task.loop();
Expand Down
30 changes: 27 additions & 3 deletions examples/simple_room_server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

#include "MyMesh.h"

#if defined(TCP_CONSOLE_PORT)
#include <helpers/esp32/TCPConsole.h>
TCPConsole tcp_console(nullptr); // prefs set in setup()
#endif

#ifdef DISPLAY_CLASS
#include "UITask.h"
static UITask ui_task(display);
Expand All @@ -24,6 +29,10 @@ void setup() {

board.begin();

#if defined(ESP32) && defined(TCP_CONSOLE_PORT)
tcp_console.begin();
#endif

#ifdef DISPLAY_CLASS
if (display.begin()) {
display.startFrame();
Expand Down Expand Up @@ -72,6 +81,17 @@ void setup() {

the_mesh.begin(fs);

#ifdef USE_ETHERNET
NodePrefs* prefs = the_mesh.getNodePrefs();
if (prefs->eth_ip != 0) {
board.reconfigureEthernet(prefs->eth_ip, prefs->eth_gateway, prefs->eth_subnet, prefs->eth_dns1);
}
#endif

#if defined(TCP_CONSOLE_PORT)
tcp_console.setPrefs(the_mesh.getNodePrefs());
#endif

#ifdef DISPLAY_CLASS
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
#endif
Expand Down Expand Up @@ -108,9 +128,13 @@ void loop() {
}

the_mesh.loop();
#if defined(ESP32) && defined(TCP_CONSOLE_PORT)
tcp_console.loop(the_mesh);
#endif

sensors.loop();
#ifdef DISPLAY_CLASS
ui_task.loop();
#endif
#ifdef DISPLAY_CLASS
ui_task.loop();
#endif
rtc_clock.tick();
}
1 change: 1 addition & 0 deletions src/MeshCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class MainBoard {
virtual const char* getResetReasonString(uint32_t reason) { return "Not available"; }
virtual uint8_t getShutdownReason() const { return 0; }
virtual const char* getShutdownReasonString(uint8_t reason) { return "Not available"; }
virtual void reconfigureEthernet(uint32_t ip, uint32_t gw, uint32_t subnet, uint32_t dns1 = 0) { /* no op */ }
};

/**
Expand Down
Loading