提交 93d77859 编写于 作者: M me-no-dev

Add fixes

上级 856e596c
...@@ -14,10 +14,9 @@ ...@@ -14,10 +14,9 @@
#include "sd_diskio.h" #include "sd_diskio.h"
#include "esp_system.h" #include "esp_system.h"
extern "C" { extern "C" {
#include "ffconf.h"
#include "ff.h" #include "ff.h"
#include "diskio.h" #include "diskio.h"
#ifdef ESP_IDF_VERSION_MAJOR #if ESP_IDF_VERSION_MAJOR > 3
#include "diskio_impl.h" #include "diskio_impl.h"
#endif #endif
//#include "esp_vfs.h" //#include "esp_vfs.h"
......
...@@ -125,9 +125,13 @@ static void _eth_phy_power_enable(bool enable) ...@@ -125,9 +125,13 @@ static void _eth_phy_power_enable(bool enable)
ETHClass::ETHClass() ETHClass::ETHClass()
:initialized(false) :initialized(false)
,staticIP(false) ,staticIP(false)
,eth_handle(NULL) #if ESP_IDF_VERSION_MAJOR > 3
,started(false) ,eth_handle(NULL)
,eth_link(ETH_LINK_DOWN) #endif
,started(false)
#if ESP_IDF_VERSION_MAJOR > 3
,eth_link(ETH_LINK_DOWN)
#endif
{ {
} }
...@@ -348,13 +352,8 @@ IPAddress ETHClass::gatewayIP() ...@@ -348,13 +352,8 @@ IPAddress ETHClass::gatewayIP()
IPAddress ETHClass::dnsIP(uint8_t dns_no) IPAddress ETHClass::dnsIP(uint8_t dns_no)
{ {
#ifdef ESP_IDF_VERSION_MAJOR
const ip_addr_t * dns_ip = dns_getserver(dns_no); const ip_addr_t * dns_ip = dns_getserver(dns_no);
return IPAddress(dns_ip->u_addr.ip4.addr); return IPAddress(dns_ip->u_addr.ip4.addr);
#else
ip_addr_t dns_ip = dns_getserver(dns_no);
return IPAddress(dns_ip.u_addr.ip4.addr);
#endif
} }
IPAddress ETHClass::broadcastIP() IPAddress ETHClass::broadcastIP()
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#define ETH_PHY_MDIO 18 #define ETH_PHY_MDIO 18
#endif #endif
#ifndef ESP_IDF_VERSION_MAJOR #if ESP_IDF_VERSION_MAJOR < 4
#ifndef ETH_CLK_MODE #ifndef ETH_CLK_MODE
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN #define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
#endif #endif
...@@ -57,7 +57,7 @@ class ETHClass { ...@@ -57,7 +57,7 @@ class ETHClass {
private: private:
bool initialized; bool initialized;
bool staticIP; bool staticIP;
#ifdef ESP_IDF_VERSION_MAJOR #if ESP_IDF_VERSION_MAJOR > 3
esp_eth_handle_t eth_handle; esp_eth_handle_t eth_handle;
protected: protected:
...@@ -72,7 +72,7 @@ class ETHClass { ...@@ -72,7 +72,7 @@ class ETHClass {
ETHClass(); ETHClass();
~ETHClass(); ~ETHClass();
#ifdef ESP_IDF_VERSION_MAJOR #if ESP_IDF_VERSION_MAJOR > 3
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); 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);
#else #else
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); 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);
......
...@@ -488,13 +488,8 @@ IPAddress WiFiSTAClass::dnsIP(uint8_t dns_no) ...@@ -488,13 +488,8 @@ IPAddress WiFiSTAClass::dnsIP(uint8_t dns_no)
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
return IPAddress(); return IPAddress();
} }
#ifdef ESP_IDF_VERSION_MAJOR
const ip_addr_t * dns_ip = dns_getserver(dns_no); const ip_addr_t * dns_ip = dns_getserver(dns_no);
return IPAddress(dns_ip->u_addr.ip4.addr); return IPAddress(dns_ip->u_addr.ip4.addr);
#else
ip_addr_t dns_ip = dns_getserver(dns_no);
return IPAddress(dns_ip.u_addr.ip4.addr);
#endif
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册