Add Waveshare ESP32-S3-ETH support (#636)

This commit is contained in:
Jan-Ole Schümann
2025-03-05 18:46:21 +07:00
committed by GitHub
parent 6626df13e0
commit 879b6ab365
5 changed files with 33 additions and 18 deletions

View File

@@ -6974,6 +6974,7 @@ const std::vector<std::pair<String, String>> WebCfgServer::getNetworkDetectionOp
options.push_back(std::make_pair("12", "LilyGO T-ETH ELite"));
options.push_back(std::make_pair("8", "GL-S10"));
options.push_back(std::make_pair("9", "ETH01-Evo"));
options.push_back(std::make_pair("13", "Waveshare ESP32-S3-ETH / ESP32-S3-ETH-POE"));
options.push_back(std::make_pair("11", "Custom LAN module"));
return options;

View File

@@ -13,5 +13,6 @@ enum class NetworkDeviceType
LilyGO_T_ETH_ELite,
GL_S10,
ETH01_Evo,
Waveshare_ESP32_S3_ETH,
CUSTOM
};

View File

@@ -29,3 +29,13 @@
#define ETH_PHY_SPI_SCK_GENERIC_W5500 8
#define ETH_PHY_SPI_MISO_GENERIC_W5500 9
#define ETH_PHY_SPI_MOSI_GENERIC_W5500 10
#define ETH_ADDR_WAVESHARE_ESP32_S3_ETH 1
#define ETH_PHY_SPI_IRQ_WAVESHARE_ESP32_S3_ETH 10
#define ETH_PHY_SPI_RST_WAVESHARE_ESP32_S3_ETH 9
#define ETH_PHY_SPI_CS_WAVESHARE_ESP32_S3_ETH 14
#define ETH_PHY_SPI_SCK_WAVESHARE_ESP32_S3_ETH 13
#define ETH_PHY_SPI_MISO_WAVESHARE_ESP32_S3_ETH 12
#define ETH_PHY_SPI_MOSI_WAVESHARE_ESP32_S3_ETH 11
#define ETH_ADDR 1

View File

@@ -47,6 +47,17 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
ETH_PHY_SPI_MOSI_M5_W5500_S3,
ETH_PHY_W5500);
break;
case NetworkDeviceType::Waveshare_ESP32_S3_ETH:
device = new EthernetDevice(hostname, preferences, ipConfiguration, "Waveshare ESP32-S3-ETH / ESP32-S3-ETH-POE",
ETH_ADDR_WAVESHARE_ESP32_S3_ETH,
ETH_PHY_SPI_CS_WAVESHARE_ESP32_S3_ETH,
ETH_PHY_SPI_IRQ_WAVESHARE_ESP32_S3_ETH,
ETH_PHY_SPI_RST_WAVESHARE_ESP32_S3_ETH,
ETH_PHY_SPI_SCK_WAVESHARE_ESP32_S3_ETH,
ETH_PHY_SPI_MISO_WAVESHARE_ESP32_S3_ETH,
ETH_PHY_SPI_MOSI_WAVESHARE_ESP32_S3_ETH,
ETH_PHY_W5500);
break;
case NetworkDeviceType::ETH01_Evo:
device = new EthernetDevice(hostname, preferences, ipConfiguration, "ETH01-Evo",
ETH_PHY_ADDR_ETH01EVO,
@@ -117,7 +128,13 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
eth_phy_type_t custEthtype = NetworkUtil::GetCustomEthernetType(custPHY);
eth_clock_mode_t custCLK = NetworkUtil::GetCustomClock(custCLKpref);
device = new EthernetDevice(hostname, preferences, ipConfiguration, custName, preferences->getInt(preference_network_custom_addr, -1), preferences->getInt(preference_network_custom_pwr, -1), preferences->getInt(preference_network_custom_mdc, -1), preferences->getInt(preference_network_custom_mdio, -1), custEthtype, custCLK);
device = new EthernetDevice(hostname, preferences, ipConfiguration, custName,
preferences->getInt(preference_network_custom_addr, -1),
preferences->getInt(preference_network_custom_pwr, -1),
preferences->getInt(preference_network_custom_mdc, -1),
preferences->getInt(preference_network_custom_mdio, -1),
custEthtype,
custCLK);
}
#endif
#ifndef CONFIG_IDF_TARGET_ESP32H2

View File

@@ -8,51 +8,37 @@ NetworkDeviceType NetworkUtil::GetDeviceTypeFromPreference(int hardwareDetect, i
{
case 1:
return NetworkDeviceType::WiFi;
break;
case 2:
return NetworkDeviceType::W5500;
break;
case 3:
return NetworkDeviceType::W5500M5;
break;
case 4:
return NetworkDeviceType::Olimex_LAN8720;
break;
case 5:
return NetworkDeviceType::WT32_LAN8720;
break;
case 6:
return NetworkDeviceType::M5STACK_PoESP32_Unit;
break;
case 7:
return NetworkDeviceType::LilyGO_T_ETH_POE;
break;
case 8:
return NetworkDeviceType::GL_S10;
break;
case 9:
return NetworkDeviceType::ETH01_Evo;
break;
case 10:
return NetworkDeviceType::W5500M5S3;
break;
case 11:
if(customPhy> 0)
{
return NetworkDeviceType::CUSTOM;
}
else
{
return NetworkDeviceType::WiFi;
}
break;
return NetworkDeviceType::WiFi;
case 12:
return NetworkDeviceType::LilyGO_T_ETH_ELite;
break;
case 13:
return NetworkDeviceType::Waveshare_ESP32_S3_ETH;
default:
Log->println("Unknown hardware selected, falling back to Wi-Fi.");
return NetworkDeviceType::WiFi;
break;
}
}