From d221c5ce06a655eaeda503bfca20151391fa8b14 Mon Sep 17 00:00:00 2001 From: Christopher Liebman Date: Thu, 26 Aug 2021 09:08:53 -0700 Subject: [PATCH 1/3] only use ksz8081 for idf versions later than 4.3 --- libraries/WiFi/src/ETH.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/WiFi/src/ETH.cpp b/libraries/WiFi/src/ETH.cpp index 092d6a3d467..a7dc6798263 100644 --- a/libraries/WiFi/src/ETH.cpp +++ b/libraries/WiFi/src/ETH.cpp @@ -287,8 +287,10 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ eth_phy = esp_eth_phy_new_dm9051(&phy_config); break; #endif +#if ESP_IDF_VERSION_MINOR > 3 || ESP_IDF_VERSION_MAJOR > 4 // added starting after 4.3 case ETH_PHY_KSZ8081: eth_phy = esp_eth_phy_new_ksz8081(&phy_config); +#endif default: break; } From 44c4f696f3272433c1314bfc1fd0f0153b7d00ee Mon Sep 17 00:00:00 2001 From: Christopher Liebman Date: Thu, 26 Aug 2021 12:58:13 -0700 Subject: [PATCH 2/3] updates from PR comments --- libraries/WiFi/src/ETH.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/WiFi/src/ETH.cpp b/libraries/WiFi/src/ETH.cpp index a7dc6798263..8af673d4dd9 100644 --- a/libraries/WiFi/src/ETH.cpp +++ b/libraries/WiFi/src/ETH.cpp @@ -287,9 +287,11 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ eth_phy = esp_eth_phy_new_dm9051(&phy_config); break; #endif -#if ESP_IDF_VERSION_MINOR > 3 || ESP_IDF_VERSION_MAJOR > 4 // added starting after 4.3 case ETH_PHY_KSZ8081: +#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(4,3,0) eth_phy = esp_eth_phy_new_ksz8081(&phy_config); +#else + log_e("unsupported ethernet type 'ETH_PHY_KSZ8081'"); #endif default: break; From 151af033fddbf190593aa1d57ee15121e4d8b2c8 Mon Sep 17 00:00:00 2001 From: Christopher Liebman Date: Thu, 26 Aug 2021 16:42:11 -0700 Subject: [PATCH 3/3] add break so as not to fall thur --- libraries/WiFi/src/ETH.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/WiFi/src/ETH.cpp b/libraries/WiFi/src/ETH.cpp index 8af673d4dd9..cb5ad7a8c59 100644 --- a/libraries/WiFi/src/ETH.cpp +++ b/libraries/WiFi/src/ETH.cpp @@ -293,6 +293,7 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ #else log_e("unsupported ethernet type 'ETH_PHY_KSZ8081'"); #endif + break; default: break; }