diff --git a/src/networkDevices/EthLan8720Device.cpp b/src/networkDevices/EthLan8720Device.cpp index 8f66aaf..3d45f0b 100644 --- a/src/networkDevices/EthLan8720Device.cpp +++ b/src/networkDevices/EthLan8720Device.cpp @@ -76,15 +76,14 @@ void EthLan8720Device::initialize() WiFi.setHostname(_hostname.c_str()); - #if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)) +#if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)) _hardwareInitialized = ETH.begin(_phy_addr, _power, _mdc, _mdio, _type, _clock_mode, _use_mac_from_efuse); - #else - #ifdef CONFIG_IDF_TARGET_ESP32 - _hardwareInitialized = ETH.begin(_type, _phy_addr, _mdc, _mdio, ETH_RESET_PIN, _clock_mode); - #else +#elif CONFIG_IDF_TARGET_ESP32 + _hardwareInitialized = ETH.begin(_type, _phy_addr, _mdc, _mdio, _power, _clock_mode); +#else _hardwareInitialized = false; - #endif - #endif +#endif + ETH.setHostname(_hostname.c_str()); if(!_ipConfiguration->dhcpEnabled()) { diff --git a/src/networkDevices/EthLan8720Device.h b/src/networkDevices/EthLan8720Device.h index 8530b3c..23e36aa 100644 --- a/src/networkDevices/EthLan8720Device.h +++ b/src/networkDevices/EthLan8720Device.h @@ -1,17 +1,17 @@ #pragma once #if (ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0, 0)) -#ifndef CONFIG_IDF_TARGET_ESP32 -typedef enum { - ETH_CLOCK_GPIO0_IN = 0, - ETH_CLOCK_GPIO16_OUT = 2, - ETH_CLOCK_GPIO17_OUT = 3 -} eth_clock_mode_t; + #ifndef CONFIG_IDF_TARGET_ESP32 +// typedef enum { +// ETH_CLOCK_GPIO0_IN = 0, +// ETH_CLOCK_GPIO16_OUT = 2, +// ETH_CLOCK_GPIO17_OUT = 3 +// } eth_clock_mode_t; -#define ETH_PHY_TYPE ETH_PHY_MAX -#else -#define ETH_PHY_TYPE ETH_PHY_LAN8720 -#endif + #define ETH_PHY_TYPE ETH_PHY_MAX + #else + #define ETH_PHY_TYPE ETH_PHY_LAN8720 + #endif #define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN