feat: add LAN8720 support and extend ESP32 Ethernet profiles

This commit is contained in:
Yurii committed 2026-12-04 15:12:16 +03:00
1 parent cea8231015
commit 54caf4fd7f
16 files changed
+441 -123

No files matched your search

+9 -1
View File
@@ -32,7 +32,7 @@ struct NetworkSettings {
} wifi;
struct {
EthernetType type = EthernetType::W5500;
EthernetType type = DEFAULT_ETHERNET_TYPE;
struct {
uint8_t clk = DEFAULT_ETH_CLK_GPIO;
@@ -42,6 +42,14 @@ struct NetworkSettings {
uint8_t irq = DEFAULT_ETH_IRQ_GPIO;
uint8_t rst = DEFAULT_ETH_RST_GPIO;
} w5500;
struct {
uint8_t mdc = DEFAULT_ETH_MDC_GPIO;
uint8_t mdio = DEFAULT_ETH_MDIO_GPIO;
uint8_t power = DEFAULT_ETH_POWER_GPIO;
uint8_t phyAddr = DEFAULT_ETH_PHY_ADDR;
uint8_t clockMode = 0; // External REF_CLK on GPIO0.
} lan8720;
} ethernet;
NetworkMode type = NetworkMode::STA;
+1 -1
View File
@@ -153,7 +153,7 @@ IPAddress getNetworkSubnet();
IPAddress getNetworkGateway();
IPAddress getNetworkDns();
String getNetworkMac();
bool isEthernetConfigured(const NetworkSettings& config = networkSettings);
bool isEthernetConfigValid(const NetworkSettings& config = networkSettings);
bool isNetworkInterfaceStarted(NetworkMode mode);
// Last state published by the system worker, including during event callbacks.
bool isNetworkConnected();
+20
View File
@@ -87,6 +87,10 @@
#define DEFAULT_STATUS_LED_GPIO GPIO_IS_NOT_CONFIGURED
#endif
#ifndef DEFAULT_ETHERNET_TYPE
#define DEFAULT_ETHERNET_TYPE EthernetType::W5500
#endif
#ifndef DEFAULT_ETH_CLK_GPIO
#define DEFAULT_ETH_CLK_GPIO GPIO_IS_NOT_CONFIGURED
#endif
@@ -111,6 +115,22 @@
#define DEFAULT_ETH_RST_GPIO GPIO_IS_NOT_CONFIGURED
#endif
#ifndef DEFAULT_ETH_MDC_GPIO
#define DEFAULT_ETH_MDC_GPIO GPIO_IS_NOT_CONFIGURED
#endif
#ifndef DEFAULT_ETH_MDIO_GPIO
#define DEFAULT_ETH_MDIO_GPIO GPIO_IS_NOT_CONFIGURED
#endif
#ifndef DEFAULT_ETH_POWER_GPIO
#define DEFAULT_ETH_POWER_GPIO GPIO_IS_NOT_CONFIGURED
#endif
#ifndef DEFAULT_ETH_PHY_ADDR
#define DEFAULT_ETH_PHY_ADDR 1
#endif
#ifndef DEFAULT_PORTAL_LOGIN
#define DEFAULT_PORTAL_LOGIN ""
#endif
+6 -1
View File
@@ -52,9 +52,9 @@ inline const char S_CH2_ALWAYS_ENABLED[] = "ch2_always_enabled
inline const char S_CH2_DISABLING_ACTION[] = "ch2_disabling_action";
inline const char S_CHIP[] = "chip";
inline const char S_CLK[] = "clk";
inline const char S_CLOCK_MODE[] = "clock_mode";
inline const char S_CODE[] = "code";
inline const char S_COMMIT[] = "commit";
inline const char S_CONFIGURED[] = "configured";
inline const char S_CONNECTED[] = "connected";
inline const char S_CONNECTION_TYPE[] = "connection_type";
inline const char S_COOLING[] = "cooling";
@@ -125,6 +125,7 @@ inline const char S_IP[] = "ip";
inline const char S_IRQ[] = "irq";
inline const char S_I_FACTOR[] = "i_factor";
inline const char S_I_MULTIPLIER[] = "i_multiplier";
inline const char S_LAN8720[] = "lan8720";
inline const char S_LOGIN[] = "login";
inline const char S_LOG_LEVEL[] = "loglevel";
inline const char S_LOW_TEMP[] = "low_temp";
@@ -136,6 +137,8 @@ inline const char S_MAX_MODULATION[] = "max_modulation";
inline const char S_MAX_POWER[] = "max_power";
inline const char S_MAX_TEMP[] = "max_temp";
inline const char S_MAX_TEMP_SYNC_WITH_TARGET_TEMP[] = "max_temp_sync_with_target_temp";
inline const char S_MDC[] = "mdc";
inline const char S_MDIO[] = "mdio";
inline const char S_MDNS[] = "mdns";
inline const char S_MEMBER_ID[] = "member_id";
inline const char S_MIN[] = "min";
@@ -166,6 +169,7 @@ inline const char S_OUTPUT[] = "output";
inline const char S_OVERHEAT[] = "overheat";
inline const char S_OVERHEAT_PROTECTION[] = "overheat_protection";
inline const char S_PASSWORD[] = "password";
inline const char S_PHY_ADDR[] = "phy_addr";
inline const char S_PID[] = "pid";
inline const char S_PORT[] = "port";
inline const char S_PORTAL[] = "portal";
@@ -228,5 +232,6 @@ inline const char S_USE_DHCP[] = "use_dhcp";
inline const char S_USER[] = "user";
inline const char S_VALUE[] = "value";
inline const char S_VERSION[] = "version";
inline const char S_W5500[] = "w5500";
inline const char S_WEBSERIAL[] = "web_serial";
inline const char S_WIFI[] = "wifi";
+5 -2
View File
@@ -21,10 +21,13 @@ enum class PumpStartReason {
};
enum class EthernetType : uint8_t {
NONE = 0,
W5500 = 1
NONE = 0,
W5500 = 1,
LAN8720 = 2
};
typedef std::function<bool(uint8_t)> GpioValidator;
struct SettingResult {
bool changed = false;
bool accepted = false;