feat: keep Ethernet settings independent of the framework

Prepares the move to Arduino 3.x / ESP-IDF 5.5, which renumbers
eth_phy_type_t (ETH_PHY_GENERIC is now 0) and only has the RMII MAC
API on the original ESP32.

- Store the PHY chip as our own id (eth_phy_id_t, the 2.x values) and
  translate it by name at ETH.begin(), so NVS, backups and the web UI
  keep their numbers on either framework.
- Build Ethernet only where CONFIG_ETH_USE_ESP32_EMAC is set instead of
  everywhere but the C6.  C3 and S3 could never use it.  A stored
  Ethernet connection falls back to Wi-Fi on those chips.
- /networksettings reports hasEthernet; the UI hides the Ethernet
  options without it.
- Fix the UI PHY list: 5 is the KSZ8041, add the KSZ8081 (6), drop the
  DM9051, an SPI chip the MAC can't drive.
- SSDP takes its address from WiFi/ETH.localIP() instead of the
  tcpip_adapter API IDF 5 removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cjkas 2026-10-19 21:13:49 +02:00
parent b74f382650
commit e1a62fe5be
12 changed files with 190 additions and 64 deletions

View file

@ -621,7 +621,7 @@ bool ShadeConfigFile::restoreFile(SomfyShadeController *s, const char *filename,
if(opts.network) {
settings.IP.save();
settings.WIFI.save();
#ifndef CONFIG_IDF_TARGET_ESP32C6
#if HAS_ETHERNET
settings.Ethernet.save();
#endif
}
@ -679,9 +679,9 @@ bool ShadeConfigFile::readNetRecord(restore_options_t &opts) {
if(opts.network) {
if(strncmp(settings.serverId, this->header.serverId, sizeof(settings.serverId)) == 0) {
ESP_LOGI(TAG, "Restoring Ethernet adapter settings");
#ifndef CONFIG_IDF_TARGET_ESP32C6
#if HAS_ETHERNET
settings.Ethernet.boardType = this->readUInt8(1);
settings.Ethernet.phyType = static_cast<eth_phy_type_t>(this->readUInt8(0));
settings.Ethernet.phyType = this->readUInt8(0);
settings.Ethernet.CLKMode = static_cast<eth_clock_mode_t>(this->readUInt8(0));
settings.Ethernet.phyAddress = this->readInt8(1);
settings.Ethernet.PWRPin = this->readInt8(1);
@ -1048,9 +1048,9 @@ bool ShadeConfigFile::writeNetRecord() {
this->writeBool(settings.MQTT.pubDisco);
this->writeVarString(settings.MQTT.rootTopic);
this->writeVarString(settings.MQTT.discoTopic);
#ifndef CONFIG_IDF_TARGET_ESP32C6
#if HAS_ETHERNET
this->writeUInt8(settings.Ethernet.boardType);
this->writeUInt8(static_cast<uint8_t>(settings.Ethernet.phyType));
this->writeUInt8(settings.Ethernet.phyType);
this->writeUInt8(static_cast<uint8_t>(settings.Ethernet.CLKMode));
this->writeInt8(settings.Ethernet.phyAddress);
this->writeInt8(settings.Ethernet.PWRPin);