8000 Fix ETH link status, missing duplex mode, IDF version check (#7593) · M-Kush/arduino-esp32@72e79f0 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 72e79f0

Browse files
ppescherSuGlider
andauthored
Fix ETH link status, missing duplex mode, IDF version check (espressif#7593)
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
1 parent f487d89 commit 72e79f0

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

libraries/Ethernet/src/ETH.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,6 @@ ETHClass::ETHClass()
220220
,eth_handle(NULL)
221221
#endif
222222
,started(false)
223-
#if ESP_IDF_VERSION_MAJOR > 3
224-
,eth_link(ETH_LINK_DOWN)
225-
#endif
226223
{
227224
}
228225

@@ -534,25 +531,27 @@ bool ETHClass::setHostname(const char * hostname)
534531

535532
bool ETHClass::fullDuplex()
536533
{
537-
#ifdef ESP_IDF_VERSION_MAJOR
538-
return true;//todo: do not see an API for this
534+
#if ESP_IDF_VERSION_MAJOR > 3
535+
eth_duplex_t link_duplex;
536+
esp_eth_ioctl(eth_handle, ETH_CMD_G_DUPLEX_MODE, &link_duplex);
537+
return (link_duplex == ETH_DUPLEX_FULL);
539538
#else
540539
return eth_config.phy_get_duplex_mode();
541540
#endif
542541
}
543542

544543
bool ETHClass::linkUp()
545544
{
546-
#ifdef ESP_IDF_VERSION_MAJOR
547-
return eth_link == ETH_LINK_UP;
545+
#if ESP_IDF_VERSION_MAJOR > 3
546+
return WiFiGenericClass::getStatusBits() & ETH_CONNECTED_BIT;
548547
#else
549548
return eth_config.phy_check_link();
550549
#endif
551550
}
552551

553552
uint8_t ETHClass::linkSpeed()
554553
{
555-
#ifdef ESP_IDF_VERSION_MAJOR
554+
#if ESP_IDF_VERSION_MAJOR > 3
556555
eth_speed_t link_speed;
557556
esp_eth_ioctl(eth_handle, ETH_CMD_G_SPEED, &link_speed);
558557
return (link_speed == ETH_SPEED_10M)?10:100;

libraries/Ethernet/src/ETH.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ class ETHClass {
6565

6666
protected:
6767
bool started;
68-
eth_link_t eth_link;
6968
static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
7069
#else
7170
bool started;

0 commit comments

Comments
 (0)
0