mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-03 10:13:44 +00:00
Merge cc6988bc8f
into 8685436cbb
This commit is contained in:
commit
258880335f
@ -121,13 +121,18 @@ 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_WS5500) || defined(USE_ESP32_RMIIPHY))
|
||||
#include <RAK13800_W5100S.h>
|
||||
#endif // HAS_ETHERNET
|
||||
|
||||
#if HAS_ETHERNET && defined(USE_WS5500)
|
||||
#if HAS_ETHERNET
|
||||
#if defined(USE_WS5500)
|
||||
#include <ETHClass2.h>
|
||||
#define ETH ETH2
|
||||
#endif
|
||||
#if defined(USE_ESP32_RMIIPHY)
|
||||
#include <ETH.h>
|
||||
#endif
|
||||
#endif // HAS_ETHERNET
|
||||
|
||||
#if HAS_WIFI
|
||||
|
@ -37,9 +37,14 @@
|
||||
#include <WiFi.h>
|
||||
#endif
|
||||
|
||||
#if HAS_ETHERNET && defined(USE_WS5500)
|
||||
#if HAS_ETHERNET
|
||||
#if defined(USE_WS5500)
|
||||
#include <ETHClass2.h>
|
||||
#define ETH ETH2
|
||||
#endif
|
||||
#if defined(USE_ESP32_RMIIPHY)
|
||||
#include <ETH.h>
|
||||
#endif
|
||||
#endif // HAS_ETHERNET
|
||||
|
||||
#endif
|
||||
|
@ -58,12 +58,12 @@ NimbleBluetooth *nimbleBluetooth = nullptr;
|
||||
NRF52Bluetooth *nrf52Bluetooth = nullptr;
|
||||
#endif
|
||||
|
||||
#if HAS_WIFI || defined(USE_WS5500)
|
||||
#if HAS_WIFI || (defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
|
||||
#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_ESP32_RMIIPHY))
|
||||
#include "mesh/api/ethServerAPI.h"
|
||||
#include "mesh/eth/ethClient.h"
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@ template class LR11x0Interface<LR1121>;
|
||||
template class SX126xInterface<STM32WLx>;
|
||||
#endif
|
||||
|
||||
#if HAS_ETHERNET && !defined(USE_WS5500)
|
||||
#if HAS_ETHERNET && !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
|
||||
#include "api/ethServerAPI.h"
|
||||
template class ServerAPI<EthernetClient>;
|
||||
template class APIServerPort<ethServerAPI, EthernetServer>;
|
||||
|
@ -3,9 +3,14 @@
|
||||
#include "ServerAPI.h"
|
||||
#include <WiFi.h>
|
||||
|
||||
#if HAS_ETHERNET && defined(USE_WS5500)
|
||||
#if HAS_ETHERNET
|
||||
#if defined(USE_WS5500)
|
||||
#include <ETHClass2.h>
|
||||
#define ETH ETH2
|
||||
#endif
|
||||
#if defined(USE_ESP32_RMIIPHY)
|
||||
#include <ETH.h>
|
||||
#endif
|
||||
#endif // HAS_ETHERNET
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "configuration.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#if HAS_ETHERNET && !defined(USE_WS5500)
|
||||
#if HAS_ETHERNET && !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
|
||||
|
||||
#include "ethServerAPI.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ServerAPI.h"
|
||||
#ifndef USE_WS5500
|
||||
#if !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
|
||||
#include <RAK13800_W5100S.h>
|
||||
|
||||
/**
|
||||
|
@ -12,9 +12,14 @@
|
||||
#include <WebServer.h>
|
||||
#include <WiFi.h>
|
||||
|
||||
#if HAS_ETHERNET && defined(USE_WS5500)
|
||||
#if HAS_ETHERNET
|
||||
#if defined(USE_WS5500)
|
||||
#include <ETHClass2.h>
|
||||
#define ETH ETH2
|
||||
#endif
|
||||
#if defined(USE_ESP32_RMIIPHY)
|
||||
#include <ETH.h>
|
||||
#endif
|
||||
#endif // HAS_ETHERNET
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
|
@ -12,9 +12,14 @@
|
||||
|
||||
#include <AsyncUDP.h>
|
||||
|
||||
#if HAS_ETHERNET && defined(USE_WS5500)
|
||||
#if HAS_ETHERNET
|
||||
#if defined(USE_WS5500)
|
||||
#include <ETHClass2.h>
|
||||
#define ETH ETH2
|
||||
#endif
|
||||
#if defined(USE_ESP32_RMIIPHY)
|
||||
#include <ETH.h>
|
||||
#endif
|
||||
#endif // HAS_ETHERNET
|
||||
|
||||
#define UDP_MULTICAST_DEFAUL_PORT 4403 // Default port for UDP multicast is same as TCP api server
|
||||
|
@ -10,9 +10,14 @@
|
||||
#include "target_specific.h"
|
||||
#include <WiFi.h>
|
||||
|
||||
#if HAS_ETHERNET && defined(USE_WS5500)
|
||||
#if HAS_ETHERNET
|
||||
#if defined(USE_WS5500)
|
||||
#include <ETHClass2.h>
|
||||
#define ETH ETH2
|
||||
#endif
|
||||
#if defined(USE_ESP32_RMIIPHY)
|
||||
#include <ETH.h>
|
||||
#endif
|
||||
#endif // HAS_ETHERNET
|
||||
|
||||
#include <WiFiUdp.h>
|
||||
@ -62,13 +67,27 @@ Syslog syslog(syslogClient);
|
||||
|
||||
Periodic *wifiReconnect;
|
||||
|
||||
#ifdef USE_WS5500
|
||||
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
|
||||
// Startup Ethernet
|
||||
bool initEthernet()
|
||||
{
|
||||
if ((config.network.eth_enabled) && (ETH.begin(ETH_PHY_W5500, 1, ETH_CS_PIN, ETH_INT_PIN, ETH_RST_PIN, SPI3_HOST,
|
||||
ETH_SCLK_PIN, ETH_MISO_PIN, ETH_MOSI_PIN))) {
|
||||
if (config.network.eth_enabled) {
|
||||
WiFi.onEvent(WiFiEvent);
|
||||
#if defined(USE_WS5500)
|
||||
if (!ETH.begin(ETH_PHY_W5500, 1, ETH_CS_PIN, ETH_INT_PIN, ETH_RST_PIN, SPI3_HOST, ETH_SCLK_PIN, ETH_MISO_PIN,
|
||||
ETH_MOSI_PIN)) {
|
||||
LOG_ERROR("ETH.begin() failed for WS5500");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#if defined(USE_ESP32_RMIIPHY)
|
||||
if (!ETH.begin(ESP32_RMIIPHY_ADDR, ESP32_RMIIPHY_PWR, ESP32_RMIIPHY_MDC, ESP32_RMIIPHY_MDIO, ESP32_RMIIPHY_TYPE,
|
||||
ESP32_RMIIPHY_CLKTYPE)) {
|
||||
LOG_ERROR("ETH.begin() failed for ESP32 RMII PHY");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !MESHTASTIC_EXCLUDE_WEBSERVER
|
||||
createSSLCert(); // For WebServer
|
||||
#endif
|
||||
@ -232,7 +251,7 @@ bool isWifiAvailable()
|
||||
|
||||
if (config.network.wifi_enabled && (config.network.wifi_ssid[0])) {
|
||||
return true;
|
||||
#ifdef USE_WS5500
|
||||
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
|
||||
} else if (config.network.eth_enabled) {
|
||||
return true;
|
||||
#endif
|
||||
@ -453,14 +472,14 @@ 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_ESP32_RMIIPHY)
|
||||
LOG_INFO("Obtained IP address: %s, %u Mbps, %s", ETH.localIP().toString().c_str(), ETH.linkSpeed(),
|
||||
ETH.fullDuplex() ? "FULL_DUPLEX" : "HALF_DUPLEX");
|
||||
onNetworkConnected();
|
||||
#endif
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_GOT_IP6:
|
||||
#ifdef USE_WS5500
|
||||
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
|
||||
#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());
|
||||
|
@ -9,9 +9,14 @@
|
||||
#include <WiFi.h>
|
||||
#endif
|
||||
|
||||
#if HAS_ETHERNET && defined(USE_WS5500)
|
||||
#if HAS_ETHERNET
|
||||
#if defined(USE_WS5500)
|
||||
#include <ETHClass2.h>
|
||||
#define ETH ETH2
|
||||
#endif
|
||||
#if defined(USE_ESP32_RMIIPHY)
|
||||
#include <ETH.h>
|
||||
#endif
|
||||
#endif // HAS_ETHERNET
|
||||
|
||||
extern bool needReconnect;
|
||||
@ -26,7 +31,7 @@ bool isWifiAvailable();
|
||||
|
||||
uint8_t getWifiDisconnectReason();
|
||||
|
||||
#ifdef USE_WS5500
|
||||
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
|
||||
// Startup Ethernet
|
||||
bool initEthernet();
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1176,7 +1176,7 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_ETHERNET && !defined(USE_WS5500)
|
||||
#if HAS_ETHERNET && !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
|
||||
conn.has_ethernet = true;
|
||||
conn.ethernet.has_status = true;
|
||||
if (Ethernet.linkStatus() == LinkON) {
|
||||
|
@ -19,9 +19,14 @@
|
||||
#include "mesh/wifi/WiFiAPClient.h"
|
||||
#include <WiFi.h>
|
||||
#endif
|
||||
#if HAS_ETHERNET && defined(USE_WS5500)
|
||||
#if HAS_ETHERNET
|
||||
#if defined(USE_WS5500)
|
||||
#include <ETHClass2.h>
|
||||
#define ETH ETH2
|
||||
#endif
|
||||
#if defined(USE_ESP32_RMIIPHY)
|
||||
#include <ETH.h>
|
||||
#endif
|
||||
#endif // HAS_ETHERNET
|
||||
#include "Default.h"
|
||||
#if !defined(ARCH_NRF52) || NRF52_USE_JSON
|
||||
@ -309,10 +314,14 @@ bool connectPubSub(const PubSubConfig &config, PubSubClient &pubSub, Client &cli
|
||||
|
||||
inline bool isConnectedToNetwork()
|
||||
{
|
||||
#ifdef USE_WS5500
|
||||
#if defined(USE_WS5500)
|
||||
if (ETH.connected())
|
||||
return true;
|
||||
#endif
|
||||
#if defined(USE_ESP32_RMIIPHY)
|
||||
if (ETH.linkUp())
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#if HAS_WIFI
|
||||
return WiFi.isConnected();
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <WiFiClientSecure.h>
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_ETHERNET && !defined(USE_WS5500)
|
||||
#if HAS_ETHERNET && !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
|
||||
#include <EthernetClient.h>
|
||||
#endif
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !MESHTASTIC_EXCLUDE_BLUETOOTH
|
||||
void setBluetoothEnable(bool enable)
|
||||
{
|
||||
#ifdef USE_WS5500
|
||||
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
|
||||
if ((config.bluetooth.enabled == true) && (config.network.wifi_enabled == false))
|
||||
#elif HAS_WIFI
|
||||
if (!isWifiAvailable() && config.bluetooth.enabled == true)
|
||||
|
17
variants/esp32/diy/wesp32/platformio.ini
Normal file
17
variants/esp32/diy/wesp32/platformio.ini
Normal file
@ -0,0 +1,17 @@
|
||||
[env:wesp32]
|
||||
extends = esp32_base
|
||||
board = esp32dev
|
||||
board_level = extra
|
||||
|
||||
build_flags =
|
||||
${esp32_base.build_flags}
|
||||
-D PRIVATE_HW
|
||||
-I variants/esp32/diy/wesp32
|
||||
-DMESHTASTIC_EXCLUDE_SCREEN=1
|
||||
-DMESHTASTIC_EXCLUDE_INPUTBROKER=1
|
||||
|
||||
build_src_filter = ${esp32_base.build_src_filter}
|
||||
|
||||
monitor_speed = 115200
|
||||
upload_protocol = esptool
|
||||
upload_speed = 921600
|
54
variants/esp32/diy/wesp32/variant.h
Normal file
54
variants/esp32/diy/wesp32/variant.h
Normal file
@ -0,0 +1,54 @@
|
||||
//
|
||||
// WESP32, https://wesp32.com/
|
||||
// ESP-32-WROOM with RTL8201FI/LAN8720 and PoE
|
||||
//
|
||||
|
||||
#define HAS_BUTTON 0
|
||||
#undef BUTTON_PIN
|
||||
|
||||
#undef LED_PIN
|
||||
|
||||
#define HAS_SCREEN 0
|
||||
|
||||
#define HAS_GPS 0
|
||||
#undef GPS_RX_PIN
|
||||
#undef GPS_TX_PIN
|
||||
|
||||
// QWIIC connector on Revision 8
|
||||
#define I2C_SDA 15
|
||||
#define I2C_SCL 4
|
||||
|
||||
#define USE_SX1262
|
||||
//
|
||||
// GPIOs on JP1 connected to a Wio-SX1262 (nRF version) LoRa board
|
||||
//
|
||||
#define LORA_SCK 33
|
||||
#define LORA_MISO 35
|
||||
#define LORA_MOSI 32
|
||||
#define LORA_CS 5
|
||||
|
||||
#define LORA_DIO0 RADIOLIB_NC
|
||||
#define LORA_RESET 39
|
||||
#define LORA_DIO1 18
|
||||
#define LORA_BUSY 13
|
||||
|
||||
#define SX126X_DIO1 LORA_DIO1
|
||||
#define SX126X_BUSY LORA_BUSY
|
||||
#define SX126X_RESET LORA_RESET
|
||||
#define SX126X_RXEN 14
|
||||
#define SX126X_CS LORA_CS
|
||||
#define SX126X_TXEN RADIOLIB_NC
|
||||
#define SX126X_DIO2_AS_RF_SWITCH // DIO2 is used to control the TX side of the RF switch
|
||||
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||
|
||||
#define HAS_ETHERNET 1
|
||||
|
||||
// Configure ESP32 RMII PHY
|
||||
#define USE_ESP32_RMIIPHY
|
||||
// #define ESP32_RMIIPHY_TYPE ETH_PHY_LAN8720 // Before revision 7
|
||||
#define ESP32_RMIIPHY_TYPE ETH_PHY_RTL8201 // Revision 7 and later
|
||||
#define ESP32_RMIIPHY_ADDR 0
|
||||
#define ESP32_RMIIPHY_PWR -1
|
||||
#define ESP32_RMIIPHY_MDC 16
|
||||
#define ESP32_RMIIPHY_MDIO 17
|
||||
#define ESP32_RMIIPHY_CLKTYPE ETH_CLOCK_GPIO0_IN
|
Loading…
Reference in New Issue
Block a user