Unverified Commit 72e79f05 authored by Paolo Messina's avatar Paolo Messina Committed by GitHub

Fix ETH link status, missing duplex mode, IDF version check (#7593)

Co-authored-by: default avatarRodrigo Garcia <rodrigo.garcia@espressif.com>
parent f487d89c
...@@ -220,9 +220,6 @@ ETHClass::ETHClass() ...@@ -220,9 +220,6 @@ ETHClass::ETHClass()
,eth_handle(NULL) ,eth_handle(NULL)
#endif #endif
,started(false) ,started(false)
#if ESP_IDF_VERSION_MAJOR > 3
,eth_link(ETH_LINK_DOWN)
#endif
{ {
} }
...@@ -534,8 +531,10 @@ bool ETHClass::setHostname(const char * hostname) ...@@ -534,8 +531,10 @@ bool ETHClass::setHostname(const char * hostname)
bool ETHClass::fullDuplex() bool ETHClass::fullDuplex()
{ {
#ifdef ESP_IDF_VERSION_MAJOR #if ESP_IDF_VERSION_MAJOR > 3
return true;//todo: do not see an API for this eth_duplex_t link_duplex;
esp_eth_ioctl(eth_handle, ETH_CMD_G_DUPLEX_MODE, &link_duplex);
return (link_duplex == ETH_DUPLEX_FULL);
#else #else
return eth_config.phy_get_duplex_mode(); return eth_config.phy_get_duplex_mode();
#endif #endif
...@@ -543,8 +542,8 @@ bool ETHClass::fullDuplex() ...@@ -543,8 +542,8 @@ bool ETHClass::fullDuplex()
bool ETHClass::linkUp() bool ETHClass::linkUp()
{ {
#ifdef ESP_IDF_VERSION_MAJOR #if ESP_IDF_VERSION_MAJOR > 3
return eth_link == ETH_LINK_UP; return WiFiGenericClass::getStatusBits() & ETH_CONNECTED_BIT;
#else #else
return eth_config.phy_check_link(); return eth_config.phy_check_link();
#endif #endif
...@@ -552,7 +551,7 @@ bool ETHClass::linkUp() ...@@ -552,7 +551,7 @@ bool ETHClass::linkUp()
uint8_t ETHClass::linkSpeed() uint8_t ETHClass::linkSpeed()
{ {
#ifdef ESP_IDF_VERSION_MAJOR #if ESP_IDF_VERSION_MAJOR > 3
eth_speed_t link_speed; eth_speed_t link_speed;
esp_eth_ioctl(eth_handle, ETH_CMD_G_SPEED, &link_speed); esp_eth_ioctl(eth_handle, ETH_CMD_G_SPEED, &link_speed);
return (link_speed == ETH_SPEED_10M)?10:100; return (link_speed == ETH_SPEED_10M)?10:100;
......
...@@ -65,7 +65,6 @@ class ETHClass { ...@@ -65,7 +65,6 @@ class ETHClass {
protected: protected:
bool started; bool started;
eth_link_t eth_link;
static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data); static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
#else #else
bool started; bool started;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment