diff --git a/src/DebugConfiguration.cpp b/src/DebugConfiguration.cpp index 207feb8c0..a236d85a6 100644 --- a/src/DebugConfiguration.cpp +++ b/src/DebugConfiguration.cpp @@ -154,7 +154,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/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 5b12e3148..8e972edc1 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 @@ -79,6 +85,32 @@ bool initEthernet() } #endif +#ifdef USE_CH390D +// Startup Ethernet +bool initEthernet() +{ + // Configure CH390 + ch390_config_t ch390_conf = CH390_DEFAULT_CONFIG(); + ch390_conf.spi_host = SPI3_HOST; // SPI2_HOST or 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; + ch390_conf.reset_gpio = ETH_RST_PIN; + 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 + return true; + } + + return false; +} +#endif + static void onNetworkConnected() { if (!APStartupComplete) { 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/variants/esp32s3/ELECROW-ThinkNode-G3/pins_arduino.h b/variants/esp32s3/ELECROW-ThinkNode-M7/pins_arduino.h similarity index 100% rename from variants/esp32s3/ELECROW-ThinkNode-G3/pins_arduino.h rename to variants/esp32s3/ELECROW-ThinkNode-M7/pins_arduino.h diff --git a/variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini b/variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini similarity index 55% rename from variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini rename to variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini index 6271b99ac..cf1918971 100644 --- a/variants/esp32s3/ELECROW-ThinkNode-G3/platformio.ini +++ b/variants/esp32s3/ELECROW-ThinkNode-M7/platformio.ini @@ -1,17 +1,15 @@ -[env:thinknode_g3] +[env:thinknode_m7] extends = esp32s3_base board = ESP32-S3-WROOM-1-N4 board_build.psram_type = opi build_flags = ${esp32s3_base.build_flags} - -D ELECROW_ThinkNode_G3 + -D ELECROW_ThinkNode_M7 -D HAS_UDP_MULTICAST=1 -D BOARD_HAS_PSRAM -D PRIVATE_HW -# -D CONFIG_ETH_ENABLED=1 -# -D CONFIG_ETH_USE_ESP32_EMAC=1 - -I variants/esp32s3/ELECROW-ThinkNode-G3 + -I variants/esp32s3/ELECROW-ThinkNode-M7 -mfix-esp32-psram-cache-issue lib_ignore = @@ -19,4 +17,5 @@ lib_ignore = lib_deps = ${esp32s3_base.lib_deps} -# file://../ESP32-CH390/ESP32-CH390-1.0.1.tar.gz + symlink://E:/dev/embedded/mt/ESP32-CH390-master + # https://github.com/caveman99/ESP32-CH390.git#c72bcd25f566b3ecd24f26893e70cc9d3211cd68 \ No newline at end of file diff --git a/variants/esp32s3/ELECROW-ThinkNode-G3/variant.h b/variants/esp32s3/ELECROW-ThinkNode-M7/variant.h similarity index 61% rename from variants/esp32s3/ELECROW-ThinkNode-G3/variant.h rename to variants/esp32s3/ELECROW-ThinkNode-M7/variant.h index 4ec352d23..2a4e4d401 100644 --- a/variants/esp32s3/ELECROW-ThinkNode-G3/variant.h +++ b/variants/esp32s3/ELECROW-ThinkNode-M7/variant.h @@ -7,7 +7,7 @@ #define LED_PIN 6 // The blue LORA LED #define LED_STATE_ON 0 -#define BUTTON_PIN 4 // the external user button of the device, BOOT and RESET are not accessible without opening it up. +#define BUTTON_PIN 4 // the external user button of the device, BOOT and RESET are not accessible without opening it. #define USE_SX1262 #define LORA_SCK 42 @@ -24,13 +24,13 @@ #define SX126X_DIO3_TCXO_VOLTAGE 1.8 #define PIN_POWER_EN 45 -// #define HAS_ETHERNET 1 -// #define USE_CH390D 1 // this driver uses the same stack as the ESP32 Wifi driver +#define HAS_ETHERNET 1 +#define USE_CH390D 1 // this driver uses the same stack as the ESP32 Wifi driver -// #define ETH_MISO_PIN 47 -// #define ETH_MOSI_PIN 21 -// #define ETH_SCLK_PIN 48 -// #define ETH_CS_PIN 45 -// #define ETH_INT_PIN 14 -// #define ETH_RST_PIN -1 -// #define ETH_ADDR 1 \ No newline at end of file +#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 \ No newline at end of file