From 88776088583aa213494ced1de23e7d279b955a2e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 11 May 2026 09:32:55 -0500 Subject: [PATCH 1/3] Protos --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 03eb5347d..b302d9233 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 03eb5347de9fbabc3bb57423236def3cc8b9481d +Subproject commit b302d923327402fbe49efcf15ff1b6ef2361b22b diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index facf00a7f..41ef2798c 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -319,6 +319,8 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_HELTEC_V4_R8 = 132, /* The HELTEC_MESH_NODE_T1 uses an NRF52840 chip, plus an SX1262. */ meshtastic_HardwareModel_HELTEC_MESH_NODE_T1 = 133, + /* B&Q Consulting Station G3: TBD */ + meshtastic_HardwareModel_STATION_G3 = 134, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ From 64fd61706ddb55583dc948e874d435d2f3219555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 11 May 2026 18:33:13 +0200 Subject: [PATCH 2/3] ThinkNode M7 (#8077) * ThinkNode G3, ETH support WIP * ThinkNode G3, ETH support WIP * ThinkNode G3, ETH support WIP * ThinkNode G3, ETH support WIP * ThinkNode G3, ETH support WIP * ThinkNode G3, ETH support WIP * ThinkNode G3, ETH support WIP * rename variant and add guard macros * older G3 operational. M7 next. * Split out G3 and M7 to different variants. Completely new PCB design. The G3 stays on 'PRIVATE_HW' * Define button behaviour and use all of the device flash --------- Co-authored-by: Ben Meadors Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com> Co-authored-by: Jonathan Bennett --- boards/ThinkNode-M7.json | 42 +++++++++ src/DebugConfiguration.cpp | 2 +- src/DebugConfiguration.h | 9 +- src/input/InputBroker.cpp | 6 ++ src/input/InputBroker.h | 1 + src/main.cpp | 6 +- src/mesh/InterfacesTemplates.cpp | 2 +- src/mesh/api/ethServerAPI.cpp | 2 +- src/mesh/api/ethServerAPI.h | 2 +- src/mesh/eth/ethClient.cpp | 2 +- src/mesh/wifi/WiFiAPClient.cpp | 87 +++++++++++++++++-- src/mesh/wifi/WiFiAPClient.h | 2 +- src/modules/AdminModule.cpp | 2 +- src/modules/SystemCommandsModule.cpp | 11 +++ src/mqtt/MQTT.cpp | 6 ++ src/mqtt/MQTT.h | 2 +- src/platform/esp32/architecture.h | 2 + src/platform/esp32/main-esp32.cpp | 2 +- .../ELECROW-ThinkNode-G3/pins_arduino.h | 26 ++++++ .../ELECROW-ThinkNode-G3/platformio.ini | 20 +++++ .../esp32s3/ELECROW-ThinkNode-G3/variant.h | 36 ++++++++ .../ELECROW-ThinkNode-M7/pins_arduino.h | 19 ++++ .../ELECROW-ThinkNode-M7/platformio.ini | 19 ++++ .../esp32s3/ELECROW-ThinkNode-M7/rfswitch.h | 11 +++ .../esp32s3/ELECROW-ThinkNode-M7/variant.h | 43 +++++++++ 25 files changed, 340 insertions(+), 22 deletions(-) create mode 100644 boards/ThinkNode-M7.json create mode 100644 variants/esp32s3/ELECROW-ThinkNode-G3/pins_arduino.h create mode 100644 variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini create mode 100644 variants/esp32s3/ELECROW-ThinkNode-G3/variant.h create mode 100644 variants/esp32s3/ELECROW-ThinkNode-M7/pins_arduino.h create mode 100644 variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini create mode 100644 variants/esp32s3/ELECROW-ThinkNode-M7/rfswitch.h create mode 100644 variants/esp32s3/ELECROW-ThinkNode-M7/variant.h diff --git a/boards/ThinkNode-M7.json b/boards/ThinkNode-M7.json new file mode 100644 index 000000000..2a0c5e583 --- /dev/null +++ b/boards/ThinkNode-M7.json @@ -0,0 +1,42 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "memory_type": "qio_opi" + }, + "core": "esp32", + "extra_flags": [ + "-D BOARD_HAS_PSRAM", + "-D ARDUINO_USB_CDC_ON_BOOT=0", + "-D ARDUINO_USB_MODE=0", + "-D ARDUINO_RUNNING_CORE=1", + "-D ARDUINO_EVENT_RUNNING_CORE=0" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "psram_type": "qio_opi", + "hwids": [["0x303A", "0x1001"]], + "mcu": "esp32s3", + "variant": "ELECROW-ThinkNode-M7" + }, + "connectivity": ["wifi", "bluetooth", "lora"], + "debug": { + "default_tool": "esp-builtin", + "onboard_tools": ["esp-builtin"], + "openocd_target": "esp32s3.cfg" + }, + "frameworks": ["arduino", "espidf"], + "name": "ELECROW ThinkNode M7", + "upload": { + "flash_size": "8MB", + "maximum_ram_size": 524288, + "maximum_size": 8388608, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "require_upload_port": true, + "speed": 921600 + }, + "url": "https://www.elecrow.com", + "vendor": "ELECROW" +} diff --git a/src/DebugConfiguration.cpp b/src/DebugConfiguration.cpp index f83624bbf..b96d0a9f1 100644 --- a/src/DebugConfiguration.cpp +++ b/src/DebugConfiguration.cpp @@ -151,7 +151,7 @@ inline bool Syslog::_sendLog(uint16_t pri, const char *appName, const char *mess if (!this->_enabled) return false; - if ((this->_server == NULL && this->_ip == INADDR_NONE) || this->_port == 0) + if ((this->_server == NULL && this->_ip == IPAddress(0, 0, 0, 0)) || this->_port == 0) return false; // Check priority against priMask values. diff --git a/src/DebugConfiguration.h b/src/DebugConfiguration.h index eac6260fc..a78dde78e 100644 --- a/src/DebugConfiguration.h +++ b/src/DebugConfiguration.h @@ -13,6 +13,11 @@ extern MemGet memGet; #define LED_STATE_ON 1 #endif +// WIFI LED +#ifndef WIFI_STATE_ON +#define WIFI_STATE_ON 1 +#endif + // ----------------------------------------------------------------------------- // DEBUG // ----------------------------------------------------------------------------- @@ -147,7 +152,9 @@ extern "C" void logLegacy(const char *level, const char *fmt, ...); // Default Bluetooth PIN #define defaultBLEPin 123456 -#if HAS_ETHERNET && !defined(USE_WS5500) +#if HAS_ETHERNET && defined(USE_CH390D) +#include +#elif HAS_ETHERNET && !defined(USE_WS5500) #include #endif // HAS_ETHERNET diff --git a/src/input/InputBroker.cpp b/src/input/InputBroker.cpp index 393cbc0ec..42ab7f70d 100644 --- a/src/input/InputBroker.cpp +++ b/src/input/InputBroker.cpp @@ -333,6 +333,12 @@ void InputBroker::Init() BaseType_t higherWake = 0; concurrency::mainDelay.interruptFromISR(&higherWake); }; +#if defined(ELECROW_ThinkNode_M7) + userConfigNoScreen.longLongPressTime = 15 * 1000; + userConfigNoScreen.longLongPress = INPUT_BROKER_FACTORY_RST; +#else + userConfigNoScreen.longLongPress = INPUT_BROKER_SHUTDOWN; +#endif userConfigNoScreen.singlePress = INPUT_BROKER_USER_PRESS; userConfigNoScreen.longPress = INPUT_BROKER_NONE; userConfigNoScreen.longPressTime = 500; diff --git a/src/input/InputBroker.h b/src/input/InputBroker.h index 847604011..975c9d9f4 100644 --- a/src/input/InputBroker.h +++ b/src/input/InputBroker.h @@ -25,6 +25,7 @@ enum input_broker_event { INPUT_BROKER_USER_PRESS, INPUT_BROKER_ALT_PRESS, INPUT_BROKER_ALT_LONG, + INPUT_BROKER_FACTORY_RST = 0x9a, INPUT_BROKER_SHUTDOWN = 0x9b, INPUT_BROKER_GPS_TOGGLE = 0x9e, INPUT_BROKER_SEND_PING = 0xaf, diff --git a/src/main.cpp b/src/main.cpp index 2fb2006d8..2f4b12437 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,12 +59,12 @@ NimbleBluetooth *nimbleBluetooth = nullptr; NRF52Bluetooth *nrf52Bluetooth = nullptr; #endif -#if HAS_WIFI || defined(USE_WS5500) +#if HAS_WIFI || defined(USE_WS5500) || defined(USE_CH390D) #include "mesh/api/WiFiServerAPI.h" #include "mesh/wifi/WiFiAPClient.h" #endif -#if HAS_ETHERNET && !defined(USE_WS5500) +#if HAS_ETHERNET && !defined(USE_WS5500) && !defined(USE_CH390D) #include "mesh/api/ethServerAPI.h" #include "mesh/eth/ethClient.h" #endif @@ -335,7 +335,7 @@ void setup() #ifdef WIFI_LED pinMode(WIFI_LED, OUTPUT); - digitalWrite(WIFI_LED, LOW); + digitalWrite(WIFI_LED, HIGH ^ WIFI_STATE_ON); #endif #ifdef BLE_LED diff --git a/src/mesh/InterfacesTemplates.cpp b/src/mesh/InterfacesTemplates.cpp index 57abbf0ee..c246141dc 100644 --- a/src/mesh/InterfacesTemplates.cpp +++ b/src/mesh/InterfacesTemplates.cpp @@ -25,7 +25,7 @@ template class LR11x0Interface; template class SX126xInterface; #endif -#if HAS_ETHERNET && !defined(USE_WS5500) +#if HAS_ETHERNET && !defined(USE_WS5500) && !defined(USE_CH390D) #include "api/ethServerAPI.h" template class ServerAPI; template class APIServerPort; diff --git a/src/mesh/api/ethServerAPI.cpp b/src/mesh/api/ethServerAPI.cpp index 43ed74cf8..c75d53ff7 100644 --- a/src/mesh/api/ethServerAPI.cpp +++ b/src/mesh/api/ethServerAPI.cpp @@ -1,7 +1,7 @@ #include "configuration.h" #include -#if HAS_ETHERNET && !defined(USE_WS5500) +#if HAS_ETHERNET && !defined(USE_WS5500) && !defined(USE_CH390D) #include "ethServerAPI.h" diff --git a/src/mesh/api/ethServerAPI.h b/src/mesh/api/ethServerAPI.h index 8f81ee6ff..07de392cf 100644 --- a/src/mesh/api/ethServerAPI.h +++ b/src/mesh/api/ethServerAPI.h @@ -1,7 +1,7 @@ #pragma once #include "ServerAPI.h" -#ifndef USE_WS5500 +#if !defined(USE_WS5500) && !defined(USE_CH390D) #include /** diff --git a/src/mesh/eth/ethClient.cpp b/src/mesh/eth/ethClient.cpp index 440f7b76a..bb6232727 100644 --- a/src/mesh/eth/ethClient.cpp +++ b/src/mesh/eth/ethClient.cpp @@ -9,7 +9,7 @@ #include #include -#if HAS_NETWORKING +#if HAS_NETWORKING && !defined(USE_WS5500) && !defined(USE_CH390D) #ifndef DISABLE_NTP #include diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 5d05c7fc6..be25e6865 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -15,6 +15,12 @@ #define ETH ETH2 #endif // HAS_ETHERNET +#if HAS_ETHERNET && defined(USE_CH390D) +#include "ESP32_CH390.h" +#include "hal/spi_types.h" +#define ETH CH390 +#endif // HAS_ETHERNET + #include #ifdef ARCH_ESP32 #if !MESHTASTIC_EXCLUDE_WEBSERVER @@ -56,12 +62,43 @@ unsigned long lastrun_ntp = 0; bool needReconnect = true; // If we create our reconnector, run it once at the beginning bool isReconnecting = false; // If we are currently reconnecting +#if defined(USE_WS5500) || defined(USE_CH390D) +static volatile bool ethNetworkConnectedPending = false; +#endif WiFiUDP syslogClient; meshtastic::Syslog syslog(syslogClient); Periodic *wifiReconnect; +#if defined(USE_WS5500) || defined(USE_CH390D) +static void onNetworkConnected(); +static uint32_t lastEthIP = 0; +static int32_t ethNetworkConnectedPoll() +{ + if (ethNetworkConnectedPending) { + ethNetworkConnectedPending = false; + uint32_t ip = (uint32_t)ETH.localIP(); + bool ipChanged = APStartupComplete && ip != 0 && ip != lastEthIP; + onNetworkConnected(); + if (ipChanged) { + LOG_INFO("Ethernet IP changed (%u.%u.%u.%u), restarting mDNS", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff, + (ip >> 24) & 0xff); + MDNS.end(); + if (MDNS.begin("Meshtastic")) { + MDNS.addService("meshtastic", "tcp", SERVER_API_DEFAULT_PORT); + MDNS.addServiceTxt("meshtastic", "tcp", "shortname", String(owner.short_name)); + MDNS.addServiceTxt("meshtastic", "tcp", "id", String(nodeDB->getNodeId().c_str())); + MDNS.addServiceTxt("meshtastic", "tcp", "pio_env", optstr(APP_ENV)); + } + } + if (ip != 0) + lastEthIP = ip; + } + return 500; +} +#endif + #ifdef USE_WS5500 // Startup Ethernet bool initEthernet() @@ -72,6 +109,38 @@ bool initEthernet() #if !MESHTASTIC_EXCLUDE_WEBSERVER createSSLCert(); // For WebServer #endif + new concurrency::Periodic("EthConnect", ethNetworkConnectedPoll); + return true; + } + + return false; +} +#endif + +#ifdef USE_CH390D +// Startup Ethernet +bool initEthernet() +{ + // Configure CH390 + ch390_config_t ch390_conf = CH390_DEFAULT_CONFIG(); + ch390_conf.spi_host = SPI3_HOST; + ch390_conf.spi_cs_gpio = ETH_CS_PIN; + ch390_conf.spi_sck_gpio = ETH_SCLK_PIN; + ch390_conf.spi_mosi_gpio = ETH_MOSI_PIN; + ch390_conf.spi_miso_gpio = ETH_MISO_PIN; + ch390_conf.int_gpio = ETH_INT_PIN; +#ifdef ETH_RST_PIN + ch390_conf.reset_gpio = ETH_RST_PIN; +#else + ch390_conf.reset_gpio = -1; +#endif + ch390_conf.spi_clock_mhz = 20; + if ((config.network.eth_enabled) && (ETH.begin(ch390_conf))) { + WiFi.onEvent(WiFiEvent); +#if !MESHTASTIC_EXCLUDE_WEBSERVER + createSSLCert(); // For WebServer +#endif + new concurrency::Periodic("EthConnect", ethNetworkConnectedPoll); return true; } @@ -234,7 +303,7 @@ bool isWifiAvailable() if (config.network.wifi_enabled && (config.network.wifi_ssid[0])) { return true; -#ifdef USE_WS5500 +#if defined(USE_WS5500) || defined(USE_CH390D) } else if (config.network.eth_enabled) { return true; #endif @@ -384,13 +453,13 @@ static void WiFiEvent(WiFiEvent_t event) #endif } #ifdef WIFI_LED - digitalWrite(WIFI_LED, HIGH); + digitalWrite(WIFI_LED, LOW ^ WIFI_STATE_ON); #endif break; case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: LOG_INFO("Disconnected from WiFi access point"); #ifdef WIFI_LED - digitalWrite(WIFI_LED, LOW); + digitalWrite(WIFI_LED, HIGH ^ WIFI_STATE_ON); #endif #if HAS_UDP_MULTICAST if (udpHandler) { @@ -452,13 +521,13 @@ static void WiFiEvent(WiFiEvent_t event) case ARDUINO_EVENT_WIFI_AP_START: LOG_INFO("WiFi access point started"); #ifdef WIFI_LED - digitalWrite(WIFI_LED, HIGH); + digitalWrite(WIFI_LED, LOW ^ WIFI_STATE_ON); #endif break; case ARDUINO_EVENT_WIFI_AP_STOP: LOG_INFO("WiFi access point stopped"); #ifdef WIFI_LED - digitalWrite(WIFI_LED, LOW); + digitalWrite(WIFI_LED, HIGH ^ WIFI_STATE_ON); #endif break; case ARDUINO_EVENT_WIFI_AP_STACONNECTED: @@ -494,18 +563,18 @@ static void WiFiEvent(WiFiEvent_t event) LOG_INFO("Ethernet disconnected"); break; case ARDUINO_EVENT_ETH_GOT_IP: -#ifdef USE_WS5500 +#if defined(USE_WS5500) || defined(USE_CH390D) LOG_INFO("Obtained IP address: %s, %u Mbps, %s", ETH.localIP().toString().c_str(), ETH.linkSpeed(), ETH.fullDuplex() ? "FULL_DUPLEX" : "HALF_DUPLEX"); - onNetworkConnected(); + ethNetworkConnectedPending = true; #endif break; case ARDUINO_EVENT_ETH_GOT_IP6: -#ifdef USE_WS5500 +#if defined(USE_WS5500) || defined(USE_CH390D) #if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) LOG_INFO("Obtained Local IP6 address: %s", ETH.linkLocalIPv6().toString().c_str()); LOG_INFO("Obtained GlobalIP6 address: %s", ETH.globalIPv6().toString().c_str()); -#else +#elif defined(USE_WS5500) LOG_INFO("Obtained IP6 address: %s", ETH.localIPv6().toString().c_str()); #endif #endif diff --git a/src/mesh/wifi/WiFiAPClient.h b/src/mesh/wifi/WiFiAPClient.h index 078c40193..1de897d7a 100644 --- a/src/mesh/wifi/WiFiAPClient.h +++ b/src/mesh/wifi/WiFiAPClient.h @@ -26,7 +26,7 @@ bool isWifiAvailable(); uint8_t getWifiDisconnectReason(); -#ifdef USE_WS5500 +#if defined(USE_WS5500) || defined(USE_CH390D) // Startup Ethernet bool initEthernet(); #endif \ No newline at end of file diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 468e8d91e..c6b17d5b0 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -1281,7 +1281,7 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r } #endif -#if HAS_ETHERNET && !defined(USE_WS5500) +#if HAS_ETHERNET && !defined(USE_WS5500) && !defined(USE_CH390D) conn.has_ethernet = true; conn.ethernet.has_status = true; if (Ethernet.linkStatus() == LinkON) { diff --git a/src/modules/SystemCommandsModule.cpp b/src/modules/SystemCommandsModule.cpp index 1da756366..7e07414cd 100644 --- a/src/modules/SystemCommandsModule.cpp +++ b/src/modules/SystemCommandsModule.cpp @@ -115,6 +115,17 @@ int SystemCommandsModule::handleInputEvent(const InputEvent *event) case INPUT_BROKER_SHUTDOWN: shutdownAtMsec = millis(); return true; + // factory reset + case INPUT_BROKER_FACTORY_RST: + disableBluetooth(); + LOG_INFO("Initiate full factory reset"); + nodeDB->factoryReset(true); + // reboot(DEFAULT_REBOOT_SECONDS); + LOG_INFO("Reboot in %d seconds", DEFAULT_REBOOT_SECONDS); + if (screen) + screen->showSimpleBanner("Rebooting...", 0); // stays on screen + rebootAtMsec = (DEFAULT_REBOOT_SECONDS < 0) ? 0 : (millis() + DEFAULT_REBOOT_SECONDS * 1000); + return true; default: // No other input events handled here diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 902fd1c2b..ad1368c5d 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -22,6 +22,9 @@ #if HAS_ETHERNET && defined(USE_WS5500) #include #define ETH ETH2 +#elif HAS_ETHERNET && defined(USE_CH390D) +#include "ESP32_CH390.h" +#define ETH CH390 #endif // HAS_ETHERNET #include "Default.h" #if !defined(ARCH_NRF52) || NRF52_USE_JSON @@ -344,6 +347,9 @@ inline bool isConnectedToNetwork() #ifdef USE_WS5500 if (ETH.connected()) return true; +#elif defined(USE_CH390D) + if (ETH.isConnected()) + return true; #endif #if HAS_WIFI diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index 7d5715602..b1b143f04 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -15,7 +15,7 @@ #include #endif #endif -#if HAS_ETHERNET && !defined(USE_WS5500) +#if HAS_ETHERNET && !defined(USE_WS5500) && !defined(USE_CH390D) #include #endif diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index 30398a675..cd3ac1f9d 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -146,6 +146,8 @@ #define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M2 #elif defined(ELECROW_ThinkNode_M5) #define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M5 +#elif defined(ELECROW_ThinkNode_M7) +#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M7 #elif defined(ESP32_S3_PICO) #define HW_VENDOR meshtastic_HardwareModel_ESP32_S3_PICO #elif defined(SENSELORA_S3) diff --git a/src/platform/esp32/main-esp32.cpp b/src/platform/esp32/main-esp32.cpp index 25cb30e96..dbc573c95 100644 --- a/src/platform/esp32/main-esp32.cpp +++ b/src/platform/esp32/main-esp32.cpp @@ -32,7 +32,7 @@ void variant_shutdown() {} #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !MESHTASTIC_EXCLUDE_BLUETOOTH void setBluetoothEnable(bool enable) { -#ifdef USE_WS5500 +#if defined(USE_WS5500) || defined(USE_CH390D) if ((config.bluetooth.enabled == true) && (config.network.wifi_enabled == false)) #elif HAS_WIFI if (!isWifiAvailable() && config.bluetooth.enabled == true) diff --git a/variants/esp32s3/ELECROW-ThinkNode-G3/pins_arduino.h b/variants/esp32s3/ELECROW-ThinkNode-G3/pins_arduino.h new file mode 100644 index 000000000..359355772 --- /dev/null +++ b/variants/esp32s3/ELECROW-ThinkNode-G3/pins_arduino.h @@ -0,0 +1,26 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +// The default Wire will be mapped to PMU and RTC +static const uint8_t SDA = 17; +static const uint8_t SCL = 18; + +// Default SPI will be mapped to Radio +static const uint8_t SS = 39; +static const uint8_t MOSI = 40; +static const uint8_t MISO = 41; +static const uint8_t SCK = 42; + +// #define SPI_MOSI (11) +// #define SPI_SCK (10) +// #define SPI_MISO (9) +// #define SPI_CS (12) + +// #define SDCARD_CS SPI_CS + +#endif /* Pins_Arduino_h */ \ No newline at end of file diff --git a/variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini b/variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini new file mode 100644 index 000000000..e2c83efe5 --- /dev/null +++ b/variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini @@ -0,0 +1,20 @@ +[env:thinknode_g3] +extends = esp32s3_base +board = ESP32-S3-WROOM-1-N4 +board_build.psram_type = opi + +build_flags = + ${esp32s3_base.build_flags} + -D HAS_UDP_MULTICAST=1 + -D BOARD_HAS_PSRAM + -D PRIVATE_HW + -I variants/esp32s3/ELECROW-ThinkNode-G3 + -mfix-esp32-psram-cache-issue + +lib_ignore = + Ethernet + +lib_deps = + ${esp32s3_base.lib_deps} + # renovate: datasource=github-tags depName=ESP32-CH390 packageName=meshtastic/ESP32-CH390 + https://github.com/meshtastic/ESP32-CH390/archive/refs/tags/v1.0.1.zip diff --git a/variants/esp32s3/ELECROW-ThinkNode-G3/variant.h b/variants/esp32s3/ELECROW-ThinkNode-G3/variant.h new file mode 100644 index 000000000..c5afd574a --- /dev/null +++ b/variants/esp32s3/ELECROW-ThinkNode-G3/variant.h @@ -0,0 +1,36 @@ +#define HAS_GPS 0 +#define HAS_WIRE 0 +#define I2C_NO_RESCAN + +#define WIFI_LED 5 +#define WIFI_STATE_ON 0 + +#define LED_PIN 6 +#define LED_STATE_ON 0 +#define BUTTON_PIN 4 + +#define LORA_SCK 42 +#define LORA_MISO 41 +#define LORA_MOSI 40 +#define LORA_CS 39 +#define LORA_RESET 21 + +#define USE_SX1262 +#define SX126X_CS LORA_CS +#define SX126X_DIO1 15 +#define SX126X_BUSY 47 +#define SX126X_RESET LORA_RESET +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#define PIN_POWER_EN 45 + +#define HAS_ETHERNET 1 +#define USE_CH390D 1 + +#define ETH_MISO_PIN 12 +#define ETH_MOSI_PIN 11 +#define ETH_SCLK_PIN 13 +#define ETH_CS_PIN 14 +#define ETH_INT_PIN 10 +#define ETH_RST_PIN 9 +// #define ETH_ADDR 1 diff --git a/variants/esp32s3/ELECROW-ThinkNode-M7/pins_arduino.h b/variants/esp32s3/ELECROW-ThinkNode-M7/pins_arduino.h new file mode 100644 index 000000000..bcc9cd1d5 --- /dev/null +++ b/variants/esp32s3/ELECROW-ThinkNode-M7/pins_arduino.h @@ -0,0 +1,19 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +// The default Wire will be mapped to PMU and RTC +static const uint8_t SDA = 17; +static const uint8_t SCL = 18; + +// Default SPI is the LR1110 radio bus +static const uint8_t SS = 12; +static const uint8_t MOSI = 10; +static const uint8_t MISO = 9; +static const uint8_t SCK = 11; + +#endif /* Pins_Arduino_h */ diff --git a/variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini b/variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini new file mode 100644 index 000000000..f2ddbf8d2 --- /dev/null +++ b/variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini @@ -0,0 +1,19 @@ +[env:thinknode_m7] +extends = esp32s3_base +board = ThinkNode-M7 + +build_flags = + ${esp32s3_base.build_flags} + -D ELECROW_ThinkNode_M7 + -D HAS_UDP_MULTICAST=1 + -D BOARD_HAS_PSRAM + -I variants/esp32s3/ELECROW-ThinkNode-M7 + -mfix-esp32-psram-cache-issue + +lib_ignore = + Ethernet + +lib_deps = + ${esp32s3_base.lib_deps} + # renovate: datasource=github-tags depName=ESP32-CH390 packageName=meshtastic/ESP32-CH390 + https://github.com/meshtastic/ESP32-CH390/archive/refs/tags/v1.0.1.zip \ No newline at end of file diff --git a/variants/esp32s3/ELECROW-ThinkNode-M7/rfswitch.h b/variants/esp32s3/ELECROW-ThinkNode-M7/rfswitch.h new file mode 100644 index 000000000..e5fe182c4 --- /dev/null +++ b/variants/esp32s3/ELECROW-ThinkNode-M7/rfswitch.h @@ -0,0 +1,11 @@ +#include "RadioLib.h" + +static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // mode DIO5 DIO6 + {LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}}, + {LR11x0::MODE_TX, {HIGH, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}}, + {LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}}, + {LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE, +}; diff --git a/variants/esp32s3/ELECROW-ThinkNode-M7/variant.h b/variants/esp32s3/ELECROW-ThinkNode-M7/variant.h new file mode 100644 index 000000000..9724b20fa --- /dev/null +++ b/variants/esp32s3/ELECROW-ThinkNode-M7/variant.h @@ -0,0 +1,43 @@ +#define HAS_GPS 0 +#define HAS_WIRE 0 +#define HAS_SCREEN 0 +#define I2C_NO_RESCAN + +#define UART_TX 43 +#define UART_RX 44 + +#define WIFI_LED 3 +#define WIFI_STATE_ON 0 + +#define LED_PIN 46 +#define LED_STATE_ON 0 +#define BUTTON_PIN 4 +#define BUTTON_ACTIVE_LOW true +#define BUTTON_ACTIVE_PULLUP true + +#define LORA_SCK 11 +#define LORA_MISO 9 +#define LORA_MOSI 10 +#define LORA_CS 12 +#define LORA_RESET 39 + +#define USE_LR1110 +#define LR1110_SPI_SCK_PIN LORA_SCK +#define LR1110_SPI_MISO_PIN LORA_MISO +#define LR1110_SPI_MOSI_PIN LORA_MOSI +#define LR1110_SPI_NSS_PIN LORA_CS +#define LR1110_IRQ_PIN 38 +#define LR1110_BUSY_PIN 13 +#define LR1110_NRESET_PIN LORA_RESET +#define LR11X0_DIO3_TCXO_VOLTAGE 1.8 +#define LR11X0_DIO_AS_RF_SWITCH + +#define HAS_ETHERNET 1 +#define USE_CH390D 1 + +#define ETH_MISO_PIN 14 +#define ETH_MOSI_PIN 48 +#define ETH_SCLK_PIN 47 +#define ETH_CS_PIN 21 +#define ETH_INT_PIN 45 +// #define ETH_ADDR 1 From 4446b0f1a271d2958ed5f93f932395f7e3392930 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 11 May 2026 14:51:21 -0500 Subject: [PATCH 3/3] Add variantDefaultConfig and set eth_enabled to default true (#10454) --- src/mesh/NodeDB.cpp | 10 ++++++++++ variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini | 6 +++++- variants/esp32s3/ELECROW-ThinkNode-G3/variant.cpp | 6 ++++++ variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini | 6 +++++- variants/esp32s3/ELECROW-ThinkNode-M7/variant.cpp | 6 ++++++ 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 variants/esp32s3/ELECROW-ThinkNode-G3/variant.cpp create mode 100644 variants/esp32s3/ELECROW-ThinkNode-M7/variant.cpp diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6d13952e5..d35e0a38a 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -80,6 +80,14 @@ static unsigned char userprefs_admin_key_1[] = USERPREFS_USE_ADMIN_KEY_1; static unsigned char userprefs_admin_key_2[] = USERPREFS_USE_ADMIN_KEY_2; #endif +// Weak empty variant initialization function. +// May be redefined by variant files. +void variantDefaultConfig() __attribute__((weak)); +void variantDefaultConfig() {} + +void variantDefaultModuleConfig() __attribute__((weak)); +void variantDefaultModuleConfig() {} + #ifdef HELTEC_MESH_NODE_T114 uint32_t read8(uint8_t bits, uint8_t dummy, uint8_t cs, uint8_t sck, uint8_t mosi, uint8_t dc, uint8_t rst) @@ -785,6 +793,8 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) #endif initConfigIntervals(); + variantDefaultConfig(); + variantDefaultModuleConfig(); } void NodeDB::initConfigIntervals() diff --git a/variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini b/variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini index e2c83efe5..4f94f5d39 100644 --- a/variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini +++ b/variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini @@ -12,7 +12,11 @@ build_flags = -mfix-esp32-psram-cache-issue lib_ignore = - Ethernet + Ethernet + +build_src_filter = + ${esp32s3_base.build_src_filter} + +<../variants/esp32s3/ELECROW-ThinkNode-G3/*> lib_deps = ${esp32s3_base.lib_deps} diff --git a/variants/esp32s3/ELECROW-ThinkNode-G3/variant.cpp b/variants/esp32s3/ELECROW-ThinkNode-G3/variant.cpp new file mode 100644 index 000000000..c6ff6b8d8 --- /dev/null +++ b/variants/esp32s3/ELECROW-ThinkNode-G3/variant.cpp @@ -0,0 +1,6 @@ +#include "mesh/NodeDB.h" + +void variantDefaultConfig() +{ + config.network.eth_enabled = true; +} diff --git a/variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini b/variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini index f2ddbf8d2..68fe68182 100644 --- a/variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini +++ b/variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini @@ -11,7 +11,11 @@ build_flags = -mfix-esp32-psram-cache-issue lib_ignore = - Ethernet + Ethernet + +build_src_filter = + ${esp32s3_base.build_src_filter} + +<../variants/esp32s3/ELECROW-ThinkNode-M7/*> lib_deps = ${esp32s3_base.lib_deps} diff --git a/variants/esp32s3/ELECROW-ThinkNode-M7/variant.cpp b/variants/esp32s3/ELECROW-ThinkNode-M7/variant.cpp new file mode 100644 index 000000000..c6ff6b8d8 --- /dev/null +++ b/variants/esp32s3/ELECROW-ThinkNode-M7/variant.cpp @@ -0,0 +1,6 @@ +#include "mesh/NodeDB.h" + +void variantDefaultConfig() +{ + config.network.eth_enabled = true; +}