From 3c1431c3226aaea5579d5b019a28a50345e7fa0b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 18 Mar 2026 17:39:50 -1000 Subject: [PATCH] [ethernet] Address additional review feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove dead ENC28J60 entry from _IDF6_ETHERNET_COMPONENTS - Simplify get_duplex_mode() — both chips are full-duplex on RP2040 - Add #error guard for unsupported RP2040 SPI Ethernet type --- esphome/components/ethernet/__init__.py | 1 - esphome/components/ethernet/ethernet_component.h | 4 ++++ esphome/components/ethernet/ethernet_component_rp2040.cpp | 7 +------ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/esphome/components/ethernet/__init__.py b/esphome/components/ethernet/__init__.py index 6d72e329ba..5dd0392682 100644 --- a/esphome/components/ethernet/__init__.py +++ b/esphome/components/ethernet/__init__.py @@ -157,7 +157,6 @@ _IDF6_ETHERNET_COMPONENTS: dict[str, IDFRegistryComponent] = { "KSZ8081RNA": IDFRegistryComponent("espressif/ksz80xx", "1.0.0"), "W5500": IDFRegistryComponent("espressif/w5500", "1.0.1"), "DM9051": IDFRegistryComponent("espressif/dm9051", "1.0.0"), - "ENC28J60": IDFRegistryComponent("espressif/enc28j60", "1.0.1"), } SPI_ETHERNET_TYPES = ["W5500", "DM9051", "ENC28J60"] diff --git a/esphome/components/ethernet/ethernet_component.h b/esphome/components/ethernet/ethernet_component.h index 1112ee3116..91ae01cf34 100644 --- a/esphome/components/ethernet/ethernet_component.h +++ b/esphome/components/ethernet/ethernet_component.h @@ -27,6 +27,8 @@ extern "C" eth_esp32_emac_config_t eth_esp32_emac_default_config(void); #include #elif defined(USE_ETHERNET_ENC28J60) #include +#else +#error "Unsupported RP2040 SPI Ethernet type" #endif #endif @@ -224,6 +226,8 @@ class EthernetComponent final : public Component { Wiznet5500lwIP *eth_{nullptr}; #elif defined(USE_ETHERNET_ENC28J60) ENC28J60lwIP *eth_{nullptr}; +#else +#error "Unsupported RP2040 SPI Ethernet type" #endif uint32_t last_link_check_{0}; uint8_t clk_pin_; diff --git a/esphome/components/ethernet/ethernet_component_rp2040.cpp b/esphome/components/ethernet/ethernet_component_rp2040.cpp index 6bf4751d37..bd8c458985 100644 --- a/esphome/components/ethernet/ethernet_component_rp2040.cpp +++ b/esphome/components/ethernet/ethernet_component_rp2040.cpp @@ -226,13 +226,8 @@ const char *EthernetComponent::get_eth_mac_address_pretty_into_buffer( } eth_duplex_t EthernetComponent::get_duplex_mode() { -#ifdef USE_ETHERNET_ENC28J60 - // ENC28J60 is configured for full-duplex by the arduino-pico driver + // Both W5500 and ENC28J60 are full-duplex on RP2040 return ETH_DUPLEX_FULL; -#else - // W5500 is always full duplex - return ETH_DUPLEX_FULL; -#endif } eth_speed_t EthernetComponent::get_link_speed() {