Skip to content

Commit 9afee31

Browse files
committed
Fix ETH in 4.0
1 parent 176077b commit 9afee31

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

libraries/SD/src/sd_diskio.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "sd_diskio.h"
1515
#include "esp_system.h"
1616
extern "C" {
17-
#include "ffconf.h"
1817
#include "ff.h"
1918
#include "diskio.h"
2019
#ifdef ESP_IDF_VERSION_MAJOR

libraries/WiFi/src/ETH.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,13 @@ static void _eth_phy_power_enable(bool enable)
125125
ETHClass::ETHClass()
126126
:initialized(false)
127127
,staticIP(false)
128+
#if ESP_IDF_VERSION_MAJOR > 3
128129
,eth_handle(NULL)
130+
#endif
129131
,started(false)
132+
#if ESP_IDF_VERSION_MAJOR > 3
130133
,eth_link(ETH_LINK_DOWN)
134+
#endif
131135
{
132136
}
133137

@@ -348,13 +352,8 @@ IPAddress ETHClass::gatewayIP()
348352

349353
IPAddress ETHClass::dnsIP(uint8_t dns_no)
350354
{
351-
#ifdef ESP_IDF_VERSION_MAJOR
352355
const ip_addr_t * dns_ip = dns_getserver(dns_no);
353356
return IPAddress(dns_ip->u_addr.ip4.addr);
354-
#else
355-
ip_addr_t dns_ip = dns_getserver(dns_no);
356-
return IPAddress(dns_ip.u_addr.ip4.addr);
357-
#endif
358357
}
359358

360359
IPAddress ETHClass::broadcastIP()

libraries/WiFi/src/ETH.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#define ETH_PHY_MDIO 18
4646
#endif
4747

48-
#ifndef ESP_IDF_VERSION_MAJOR
48+
#if ESP_IDF_VERSION_MAJOR < 4
4949
#ifndef ETH_CLK_MODE
5050
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
5151
#endif
@@ -57,7 +57,7 @@ class ETHClass {
5757
private:
5858
bool initialized;
5959
bool staticIP;
60-
#ifdef ESP_IDF_VERSION_MAJOR
60+
#if ESP_IDF_VERSION_MAJOR > 3
6161
esp_eth_handle_t eth_handle;
6262

6363
protected:
@@ -72,7 +72,7 @@ class ETHClass {
7272
ETHClass();
7373
~ETHClass();
7474

75-
#ifdef ESP_IDF_VERSION_MAJOR
75+
#if ESP_IDF_VERSION_MAJOR > 3
7676
bool begin(uint8_t phy_addr=ETH_PHY_ADDR, int power=ETH_PHY_POWER, int mdc=ETH_PHY_MDC, int mdio=ETH_PHY_MDIO, eth_phy_type_t type=ETH_PHY_TYPE);
7777
#else
7878
bool begin(uint8_t phy_addr=ETH_PHY_ADDR, int power=ETH_PHY_POWER, int mdc=ETH_PHY_MDC, int mdio=ETH_PHY_MDIO, eth_phy_type_t type=ETH_PHY_TYPE, eth_clock_mode_t clk_mode=ETH_CLK_MODE);

0 commit comments

Comments
 (0)