mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
[Network] Fix ESP32-classic display build with ETH disabled
This commit is contained in:
@@ -87,12 +87,10 @@ lib_ignore = ESP8266Ping
|
||||
${esp32_base_idf5.lib_ignore}
|
||||
|
||||
|
||||
|
||||
[esp32_common_LittleFS_ETH]
|
||||
[esp32_common_LittleFS]
|
||||
extends = esp32_base_idf5
|
||||
build_flags = ${esp32_base_idf5.build_flags}
|
||||
; -mtext-section-literals
|
||||
-DFEATURE_ETHERNET=1
|
||||
-DESP32_CLASSIC
|
||||
-DUSE_LITTLEFS
|
||||
build_unflags = ${esp32_base_idf5.build_unflags}
|
||||
@@ -104,6 +102,12 @@ lib_ignore = ${esp32_always.lib_ignore}
|
||||
${esp32_base_idf5.lib_ignore}
|
||||
|
||||
|
||||
[esp32_common_LittleFS_ETH]
|
||||
extends = esp32_common_LittleFS
|
||||
build_flags = ${esp32_common_LittleFS.build_flags}
|
||||
-DFEATURE_ETHERNET=1
|
||||
|
||||
|
||||
[esp32_IRExt_LittleFS_ETH]
|
||||
extends = esp32_common_LittleFS_ETH
|
||||
lib_ignore = ${esp32_always.lib_ignore}
|
||||
@@ -275,10 +279,10 @@ build_flags = ${esp32_common_LittleFS_ETH.build_flags}
|
||||
-DPLUGIN_ENERGY_COLLECTION
|
||||
|
||||
|
||||
[env:display_ESP32_4M316k_LittleFS_ETH]
|
||||
extends = esp32_common_LittleFS_ETH
|
||||
[env:display_ESP32_4M316k_LittleFS]
|
||||
extends = esp32_common_LittleFS
|
||||
board = esp32_4M
|
||||
build_flags = ${esp32_common_LittleFS_ETH.build_flags}
|
||||
build_flags = ${esp32_common_LittleFS.build_flags}
|
||||
-DFEATURE_ARDUINO_OTA=1
|
||||
-DPLUGIN_DISPLAY_COLLECTION
|
||||
-D ST7789_EXTRA_INIT=1
|
||||
|
||||
@@ -59,5 +59,5 @@ uint8_t EthLinkSpeed();
|
||||
#endif // if FEATURE_ETHERNET
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace net
|
||||
} // namespace ESPEasy
|
||||
|
||||
@@ -108,7 +108,7 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
Settings.ETH_Pin_mdio_irq = getFormItemInt(F("ethmdio"));
|
||||
Settings.ETH_Pin_power_rst = getFormItemInt(F("ethpower"));
|
||||
Settings.ETH_Phy_Type = static_cast<EthPhyType_t>(getFormItemInt(F("ethtype")));
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
Settings.ETH_Clock_Mode = static_cast<EthClockMode_t>(getFormItemInt(F("ethclock")));
|
||||
# endif
|
||||
Settings.NetworkMedium = static_cast<NetworkMedium_t>(getFormItemInt(F("ethwifi")));
|
||||
@@ -144,7 +144,7 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
const __FlashStringHelper *ethPhyTypes[] = {
|
||||
toString(EthPhyType_t::notSet),
|
||||
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
toString(EthPhyType_t::LAN8720),
|
||||
toString(EthPhyType_t::TLK110),
|
||||
toString(EthPhyType_t::RTL8201),
|
||||
@@ -154,7 +154,7 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
toString(EthPhyType_t::DP83848),
|
||||
toString(EthPhyType_t::KSZ8041),
|
||||
toString(EthPhyType_t::KSZ8081),
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
# if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
@@ -171,7 +171,7 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
const int ethPhyTypes_index[] = {
|
||||
static_cast<int>(EthPhyType_t::notSet),
|
||||
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
static_cast<int>(EthPhyType_t::LAN8720),
|
||||
static_cast<int>(EthPhyType_t::TLK110),
|
||||
static_cast<int>(EthPhyType_t::RTL8201),
|
||||
@@ -181,7 +181,7 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
static_cast<int>(EthPhyType_t::DP83848),
|
||||
static_cast<int>(EthPhyType_t::KSZ8041),
|
||||
static_cast<int>(EthPhyType_t::KSZ8081),
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
# if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
@@ -222,7 +222,7 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
# define MDC_CS_PIN_DESCR "Ethernet CS pin"
|
||||
# define MIO_IRQ_PIN_DESCR "Ethernet IRQ pin"
|
||||
# define PWR_RST_PIN_DESCR "Ethernet RST pin"
|
||||
# else // #elif CONFIG_ETH_USE_ESP32_EMAC
|
||||
# else // #elif CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
# define MDC_CS_PIN_DESCR "Ethernet MDC pin"
|
||||
# define MIO_IRQ_PIN_DESCR "Ethernet MIO pin"
|
||||
# define PWR_RST_PIN_DESCR "Ethernet Power pin"
|
||||
@@ -230,7 +230,7 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
|
||||
addFormNumericBox(F("Ethernet PHY Address"), F("ethphy"), Settings.ETH_Phy_Addr, -1, 127);
|
||||
addFormNote(F("I²C-address of Ethernet PHY"
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
" (0 or 1 for LAN8720, 31 for TLK110, -1 autodetect)"
|
||||
# endif
|
||||
));
|
||||
@@ -243,7 +243,7 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
addFormPinSelect(PinSelectPurpose::Ethernet, formatGpioName_output(
|
||||
F(PWR_RST_PIN_DESCR)),
|
||||
F("ethpower"), Settings.ETH_Pin_power_rst);
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
addRowLabel_tr_id(F("Ethernet Clock"), F("ethclock"));
|
||||
{
|
||||
# if CONFIG_IDF_TARGET_ESP32
|
||||
@@ -278,7 +278,7 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
indices);
|
||||
selector.addSelector(F("ethclock"), static_cast<int>(Settings.ETH_Clock_Mode));
|
||||
}
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ bool NWPlugin_004(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
Settings.ETH_Pin_mdio_irq = getFormItemInt(F("ethmdio"));
|
||||
Settings.ETH_Pin_power_rst = getFormItemInt(F("ethpower"));
|
||||
Settings.ETH_Phy_Type = static_cast<EthPhyType_t>(getFormItemInt(F("ethtype")));
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
Settings.ETH_Clock_Mode = static_cast<EthClockMode_t>(getFormItemInt(F("ethclock")));
|
||||
# endif
|
||||
Settings.NetworkMedium = static_cast<NetworkMedium_t>(getFormItemInt(F("ethwifi")));
|
||||
@@ -147,7 +147,7 @@ bool NWPlugin_004(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
const __FlashStringHelper *ethPhyTypes[] = {
|
||||
toString(EthPhyType_t::notSet),
|
||||
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
toString(EthPhyType_t::LAN8720),
|
||||
toString(EthPhyType_t::TLK110),
|
||||
toString(EthPhyType_t::RTL8201),
|
||||
@@ -157,7 +157,7 @@ bool NWPlugin_004(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
toString(EthPhyType_t::DP83848),
|
||||
toString(EthPhyType_t::KSZ8041),
|
||||
toString(EthPhyType_t::KSZ8081),
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
# if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
@@ -174,7 +174,7 @@ bool NWPlugin_004(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
const int ethPhyTypes_index[] = {
|
||||
static_cast<int>(EthPhyType_t::notSet),
|
||||
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
static_cast<int>(EthPhyType_t::LAN8720),
|
||||
static_cast<int>(EthPhyType_t::TLK110),
|
||||
static_cast<int>(EthPhyType_t::RTL8201),
|
||||
@@ -184,7 +184,7 @@ bool NWPlugin_004(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
static_cast<int>(EthPhyType_t::DP83848),
|
||||
static_cast<int>(EthPhyType_t::KSZ8041),
|
||||
static_cast<int>(EthPhyType_t::KSZ8081),
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
# if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
@@ -225,7 +225,7 @@ bool NWPlugin_004(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
# define MDC_CS_PIN_DESCR "Ethernet CS pin"
|
||||
# define MIO_IRQ_PIN_DESCR "Ethernet IRQ pin"
|
||||
# define PWR_RST_PIN_DESCR "Ethernet RST pin"
|
||||
# else // #elif CONFIG_ETH_USE_ESP32_EMAC
|
||||
# else // #elif CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
# define MDC_CS_PIN_DESCR "Ethernet MDC pin"
|
||||
# define MIO_IRQ_PIN_DESCR "Ethernet MIO pin"
|
||||
# define PWR_RST_PIN_DESCR "Ethernet Power pin"
|
||||
@@ -233,7 +233,7 @@ bool NWPlugin_004(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
|
||||
addFormNumericBox(F("Ethernet PHY Address"), F("ethphy"), Settings.ETH_Phy_Addr, -1, 127);
|
||||
addFormNote(F("I²C-address of Ethernet PHY"
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
" (0 or 1 for LAN8720, 31 for TLK110, -1 autodetect)"
|
||||
# endif
|
||||
));
|
||||
@@ -246,7 +246,7 @@ bool NWPlugin_004(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
addFormPinSelect(PinSelectPurpose::Ethernet, formatGpioName_output(
|
||||
F(PWR_RST_PIN_DESCR)),
|
||||
F("ethpower"), Settings.ETH_Pin_power_rst);
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
addRowLabel_tr_id(F("Ethernet Clock"), F("ethclock"));
|
||||
{
|
||||
# if CONFIG_IDF_TARGET_ESP32
|
||||
@@ -281,7 +281,7 @@ bool NWPlugin_004(NWPlugin::Function function, EventStruct *event, String& strin
|
||||
indices);
|
||||
selector.addSelector(F("ethclock"), static_cast<int>(Settings.ETH_Clock_Mode));
|
||||
}
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ void ethSetupStaticIPconfig() {
|
||||
|
||||
bool ethCheckSettings() {
|
||||
return isValid(Settings.ETH_Phy_Type)
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
&& (isValid(Settings.ETH_Clock_Mode) /* || isSPI_EthernetType(Settings.ETH_Phy_Type)*/)
|
||||
# endif
|
||||
&& isValid(Settings.NetworkMedium)
|
||||
@@ -214,7 +214,7 @@ bool ETHConnectRelaxed() {
|
||||
# endif // if ETH_SPI_SUPPORTS_CUSTOM
|
||||
}
|
||||
} else {
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
# ifndef ESP32P4
|
||||
ethResetGPIOpins();
|
||||
# endif
|
||||
@@ -225,7 +225,7 @@ bool ETHConnectRelaxed() {
|
||||
Settings.ETH_Pin_mdio_irq,
|
||||
Settings.ETH_Pin_power_rst,
|
||||
(eth_clock_mode_t)Settings.ETH_Clock_Mode);
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
}
|
||||
|
||||
# endif // if ESP_IDF_VERSION_MAJOR < 5
|
||||
@@ -304,7 +304,7 @@ void ethPower(bool enable) {
|
||||
GPIO_Write(PLUGIN_GPIO, Settings.ETH_Pin_power_rst, enable ? 1 : 0);
|
||||
|
||||
if (!enable) {
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
# if CONFIG_IDF_TARGET_ESP32P4
|
||||
const bool isExternalCrystal = Settings.ETH_Clock_Mode == EthClockMode_t::Ext_crystal;
|
||||
# else
|
||||
@@ -315,7 +315,7 @@ void ethPower(bool enable) {
|
||||
delay(600); // Give some time to discharge any capacitors
|
||||
// Delay is needed to make sure no clock signal remains present which may cause the ESP to boot into flash mode.
|
||||
}
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
} else {
|
||||
delay(400); // LAN chip needs to initialize before calling Eth.begin()
|
||||
}
|
||||
@@ -333,7 +333,7 @@ void ethResetGPIOpins() {
|
||||
addLog(LOG_LEVEL_INFO, F("ethResetGPIOpins()"));
|
||||
gpio_reset_pin((gpio_num_t)Settings.ETH_Pin_mdc_cs);
|
||||
gpio_reset_pin((gpio_num_t)Settings.ETH_Pin_mdio_irq);
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
gpio_reset_pin(GPIO_NUM_19); // EMAC_TXD0 - hardcoded
|
||||
gpio_reset_pin(GPIO_NUM_21); // EMAC_TX_EN - hardcoded
|
||||
@@ -341,7 +341,7 @@ void ethResetGPIOpins() {
|
||||
gpio_reset_pin(GPIO_NUM_25); // EMAC_RXD0 - hardcoded
|
||||
gpio_reset_pin(GPIO_NUM_26); // EMAC_RXD1 - hardcoded
|
||||
gpio_reset_pin(GPIO_NUM_27); // EMAC_RX_CRS_DV - hardcoded
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
/*
|
||||
switch (Settings.ETH_Clock_Mode) {
|
||||
|
||||
@@ -296,7 +296,7 @@ bool InternalCommands::executeInternalCommand()
|
||||
case ESPEasy_cmd_e::ethpinmdio: COMMAND_CASE_R(Command_ETH_Pin_mdio, 1); // Network Command
|
||||
case ESPEasy_cmd_e::ethpinpower: COMMAND_CASE_R(Command_ETH_Pin_power, 1); // Network Command
|
||||
case ESPEasy_cmd_e::ethphytype: COMMAND_CASE_R(Command_ETH_Phy_Type, 1); // Network Command
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
case ESPEasy_cmd_e::ethclockmode: COMMAND_CASE_R(Command_ETH_Clock_Mode, 1); // Network Command
|
||||
#endif
|
||||
case ESPEasy_cmd_e::ethip: COMMAND_CASE_R(Command_ETH_IP, 1); // Network Command
|
||||
|
||||
@@ -74,7 +74,7 @@ const char Internal_commands_e[] PROGMEM =
|
||||
"ethpinmdio|"
|
||||
"ethpinpower|"
|
||||
"ethphytype|"
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
"ethclockmode|"
|
||||
#endif
|
||||
"ethip|"
|
||||
|
||||
@@ -51,7 +51,7 @@ enum class ESPEasy_cmd_e : uint8_t {
|
||||
ethpinmdio,
|
||||
ethpinpower,
|
||||
ethphytype,
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
ethclockmode,
|
||||
#endif
|
||||
ethip,
|
||||
|
||||
@@ -93,7 +93,7 @@ String Command_ETH_Phy_Type (struct EventStruct *event, const char* Line)
|
||||
{
|
||||
return Command_GetORSetInt8_t(event, F("ETH_Phy_Type:"), Line, reinterpret_cast<int8_t*>(&Settings.ETH_Phy_Type),1);
|
||||
}
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
String Command_ETH_Clock_Mode (struct EventStruct *event, const char* Line)
|
||||
{
|
||||
return Command_GetORSetETH(event,
|
||||
|
||||
@@ -19,7 +19,7 @@ String Command_ETH_Pin_mdc (struct EventStruct *event, const char* Line);
|
||||
String Command_ETH_Pin_mdio (struct EventStruct *event, const char* Line);
|
||||
String Command_ETH_Pin_power (struct EventStruct *event, const char* Line);
|
||||
String Command_ETH_Phy_Type (struct EventStruct *event, const char* Line);
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
String Command_ETH_Clock_Mode (struct EventStruct *event, const char* Line);
|
||||
#endif
|
||||
String Command_ETH_IP (struct EventStruct *event, const char* Line);
|
||||
|
||||
@@ -313,7 +313,7 @@
|
||||
#endif
|
||||
#endif
|
||||
#ifndef DEFAULT_ETH_CLOCK_MODE
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
#define DEFAULT_ETH_CLOCK_MODE static_cast<EthClockMode_t>(0)
|
||||
#else
|
||||
#define DEFAULT_ETH_CLOCK_MODE (0)
|
||||
|
||||
@@ -43,7 +43,7 @@ bool FactoryDefault_Network_NVS::applyToSettings_from_NVS(ESPEasy_NVS_Helper& pr
|
||||
#else
|
||||
Settings.ETH_Phy_Type = 0;
|
||||
#endif
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
Settings.ETH_Clock_Mode = static_cast<EthClockMode_t>(bits.ETH_Clock_Mode);
|
||||
#endif
|
||||
Settings.NetworkMedium = static_cast<NetworkMedium_t>(bits.NetworkMedium);
|
||||
|
||||
@@ -112,7 +112,7 @@ GpioFactorySettingsStruct::GpioFactorySettingsStruct(DeviceModel model)
|
||||
# endif // if defined(ESP8266)
|
||||
|
||||
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
# if CONFIG_IDF_TARGET_ESP32
|
||||
case DeviceModel::DeviceModel_Olimex_ESP32_PoE:
|
||||
button[0] = 34; // BUT1 Button
|
||||
@@ -208,7 +208,7 @@ GpioFactorySettingsStruct::GpioFactorySettingsStruct(DeviceModel model)
|
||||
# else // if CONFIG_IDF_TARGET_ESP32
|
||||
default: break;
|
||||
# endif // if CONFIG_IDF_TARGET_ESP32
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
case DeviceModel::DeviceModel_default:
|
||||
case DeviceModel::DeviceModel_MAX:
|
||||
|
||||
@@ -580,7 +580,7 @@ public:
|
||||
int8_t ETH_Pin_power_rst = -1;
|
||||
#if FEATURE_ETHERNET
|
||||
EthPhyType_t ETH_Phy_Type = EthPhyType_t::notSet;
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
EthClockMode_t ETH_Clock_Mode = static_cast<EthClockMode_t>(0);
|
||||
#else
|
||||
uint8_t ETH_Clock_Mode{};
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "include/esp32x_fixes.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
#include <pins_arduino.h>
|
||||
#endif
|
||||
|
||||
@@ -1230,7 +1230,7 @@ bool SettingsStruct_tmpl<N_TASKS>::isEthernetPin(int8_t pin) const {
|
||||
if (pin < 0) return false;
|
||||
if (NetworkMedium == NetworkMedium_t::Ethernet &&
|
||||
!isSPI_EthernetType(ETH_Phy_Type)) {
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
#ifdef ESP32P4
|
||||
switch (pin) {
|
||||
// MDC/MDIO/Power can be configured by user
|
||||
@@ -1267,7 +1267,7 @@ bool SettingsStruct_tmpl<N_TASKS>::isEthernetPinOptional(int8_t pin) const {
|
||||
if (pin < 0) return false;
|
||||
if (NetworkMedium == NetworkMedium_t::Ethernet) {
|
||||
if (!isSPI_EthernetType(ETH_Phy_Type)
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
&& isGpioUsedInETHClockMode(ETH_Clock_Mode, pin)
|
||||
#endif
|
||||
) return true;
|
||||
|
||||
@@ -21,7 +21,7 @@ enum class DeviceModel : uint8_t {
|
||||
DeviceModel_Sonoff_POWr2,
|
||||
DeviceModel_Shelly1,
|
||||
DeviceModel_ShellyPLUG_S,
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
DeviceModel_Olimex_ESP32_PoE,
|
||||
DeviceModel_Olimex_ESP32_EVB,
|
||||
DeviceModel_Olimex_ESP32_GATEWAY,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
bool isValid(EthPhyType_t phyType) {
|
||||
switch (phyType)
|
||||
{
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
case EthPhyType_t::LAN8720:
|
||||
case EthPhyType_t::TLK110:
|
||||
case EthPhyType_t::RTL8201:
|
||||
@@ -16,7 +16,7 @@ bool isValid(EthPhyType_t phyType) {
|
||||
case EthPhyType_t::KSZ8041:
|
||||
case EthPhyType_t::KSZ8081:
|
||||
return true;
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
# if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
@@ -59,7 +59,7 @@ eth_phy_type_t to_ESP_phy_type(EthPhyType_t phyType)
|
||||
{
|
||||
switch (phyType)
|
||||
{
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
case EthPhyType_t::LAN8720: return ETH_PHY_LAN8720;
|
||||
case EthPhyType_t::TLK110: return ETH_PHY_TLK110;
|
||||
case EthPhyType_t::RTL8201: return ETH_PHY_RTL8201;
|
||||
@@ -69,7 +69,7 @@ eth_phy_type_t to_ESP_phy_type(EthPhyType_t phyType)
|
||||
case EthPhyType_t::DP83848: return ETH_PHY_DP83848;
|
||||
case EthPhyType_t::KSZ8041: return ETH_PHY_KSZ8041;
|
||||
case EthPhyType_t::KSZ8081: return ETH_PHY_KSZ8081;
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
# if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
@@ -93,7 +93,7 @@ eth_phy_type_t to_ESP_phy_type(EthPhyType_t phyType)
|
||||
const __FlashStringHelper* toString(EthPhyType_t phyType) {
|
||||
switch (phyType)
|
||||
{
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
case EthPhyType_t::LAN8720: return F("LAN8710 / LAN8720");
|
||||
case EthPhyType_t::TLK110: return F("TLK110 / IP101");
|
||||
case EthPhyType_t::RTL8201: return F("RTL8201");
|
||||
@@ -103,7 +103,7 @@ const __FlashStringHelper* toString(EthPhyType_t phyType) {
|
||||
case EthPhyType_t::DP83848: return F("DP83848");
|
||||
case EthPhyType_t::KSZ8041: return F("KSZ8041");
|
||||
case EthPhyType_t::KSZ8081: return F("KSZ8081");
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
# if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
|
||||
@@ -37,7 +37,7 @@ enum class EthClockMode_t : uint8_t {
|
||||
|
||||
# endif // if CONFIG_IDF_TARGET_ESP32
|
||||
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
bool isValid(EthClockMode_t clockMode);
|
||||
|
||||
@@ -49,7 +49,7 @@ bool isGpioUsedInETHClockMode(EthClockMode_t clockMode,
|
||||
|
||||
// Is stored in settings
|
||||
enum class EthPhyType_t : uint8_t {
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
LAN8720 = 0,
|
||||
TLK110 = 1,
|
||||
RTL8201 = 2,
|
||||
@@ -59,7 +59,7 @@ enum class EthPhyType_t : uint8_t {
|
||||
DP83848 = 4,
|
||||
KSZ8041 = 5,
|
||||
KSZ8081 = 6,
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
# if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
DM9051 = 10,
|
||||
|
||||
@@ -791,7 +791,7 @@ const __FlashStringHelper* getDeviceModelBrandString(DeviceModel model) {
|
||||
case DeviceModel::DeviceModel_Sonoff_POWr2: return F("Sonoff");
|
||||
case DeviceModel::DeviceModel_Shelly1:
|
||||
case DeviceModel::DeviceModel_ShellyPLUG_S: return F("Shelly");
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
case DeviceModel::DeviceModel_Olimex_ESP32_PoE:
|
||||
case DeviceModel::DeviceModel_Olimex_ESP32_EVB:
|
||||
case DeviceModel::DeviceModel_Olimex_ESP32_GATEWAY:
|
||||
@@ -844,13 +844,13 @@ const __FlashStringHelper* getDeviceModelTypeString(DeviceModel model)
|
||||
case DeviceModel::DeviceModel_ShellyPLUG_S:
|
||||
return F("default");
|
||||
#endif // if defined(ESP8266) && !defined(LIMIT_BUILD_SIZE)
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
case DeviceModel::DeviceModel_Olimex_ESP32_PoE: return F(" ESP32-PoE");
|
||||
case DeviceModel::DeviceModel_Olimex_ESP32_EVB: return F(" ESP32-EVB");
|
||||
case DeviceModel::DeviceModel_Olimex_ESP32_GATEWAY: return F(" ESP32-GATEWAY");
|
||||
case DeviceModel::DeviceModel_wESP32: break;
|
||||
case DeviceModel::DeviceModel_WT32_ETH01: return F(" add-on");
|
||||
#endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
#endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
case DeviceModel::DeviceModel_default:
|
||||
case DeviceModel::DeviceModel_MAX: return F("default");
|
||||
@@ -903,7 +903,7 @@ bool modelMatchingFlashSize(DeviceModel model) {
|
||||
#endif // ifdef ESP8266
|
||||
|
||||
// These Olimex boards all have Ethernet
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
case DeviceModel::DeviceModel_Olimex_ESP32_PoE:
|
||||
case DeviceModel::DeviceModel_Olimex_ESP32_EVB:
|
||||
case DeviceModel::DeviceModel_Olimex_ESP32_GATEWAY:
|
||||
@@ -914,7 +914,7 @@ bool modelMatchingFlashSize(DeviceModel model) {
|
||||
# else // if defined(ESP32_CLASSIC) && FEATURE_ETHERNET
|
||||
return false;
|
||||
# endif // if defined(ESP32_CLASSIC) && FEATURE_ETHERNET
|
||||
#endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
#endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
case DeviceModel::DeviceModel_default:
|
||||
case DeviceModel::DeviceModel_MAX:
|
||||
return true;
|
||||
|
||||
@@ -390,7 +390,7 @@ const __FlashStringHelper* getConflictingUse(int gpio, PinSelectPurpose purpose,
|
||||
#endif
|
||||
|
||||
if (includeEthernet && Settings.isEthernetPinOptional(gpio)) {
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
if (isGpioUsedInETHClockMode(Settings.ETH_Clock_Mode, gpio)) { return F("Eth Clock"); }
|
||||
|
||||
if (Settings.ETH_Pin_mdc_cs == gpio) { return F("Eth MDC"); }
|
||||
|
||||
@@ -128,7 +128,7 @@ void handle_hardware() {
|
||||
Settings.ETH_Pin_mdio_irq = getFormItemInt(F("ethmdio"));
|
||||
Settings.ETH_Pin_power_rst = getFormItemInt(F("ethpower"));
|
||||
Settings.ETH_Phy_Type = static_cast<EthPhyType_t>(getFormItemInt(F("ethtype")));
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
Settings.ETH_Clock_Mode = static_cast<EthClockMode_t>(getFormItemInt(F("ethclock")));
|
||||
#endif
|
||||
Settings.NetworkMedium = static_cast<NetworkMedium_t>(getFormItemInt(F("ethwifi")));
|
||||
@@ -347,7 +347,7 @@ void handle_hardware() {
|
||||
const __FlashStringHelper * ethPhyTypes[] = {
|
||||
toString(EthPhyType_t::notSet),
|
||||
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
toString(EthPhyType_t::LAN8720),
|
||||
toString(EthPhyType_t::TLK110),
|
||||
toString(EthPhyType_t::RTL8201),
|
||||
@@ -357,7 +357,7 @@ void handle_hardware() {
|
||||
toString(EthPhyType_t::DP83848),
|
||||
toString(EthPhyType_t::KSZ8041),
|
||||
toString(EthPhyType_t::KSZ8081),
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
@@ -374,7 +374,7 @@ void handle_hardware() {
|
||||
const int ethPhyTypes_index[] = {
|
||||
static_cast<int>(EthPhyType_t::notSet),
|
||||
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
static_cast<int>(EthPhyType_t::LAN8720),
|
||||
static_cast<int>(EthPhyType_t::TLK110),
|
||||
static_cast<int>(EthPhyType_t::RTL8201),
|
||||
@@ -384,7 +384,7 @@ void handle_hardware() {
|
||||
static_cast<int>(EthPhyType_t::DP83848),
|
||||
static_cast<int>(EthPhyType_t::KSZ8041),
|
||||
static_cast<int>(EthPhyType_t::KSZ8081),
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC
|
||||
# endif // if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
@@ -424,7 +424,7 @@ void handle_hardware() {
|
||||
#define MDC_CS_PIN_DESCR "Ethernet CS pin"
|
||||
#define MIO_IRQ_PIN_DESCR "Ethernet IRQ pin"
|
||||
#define PWR_RST_PIN_DESCR "Ethernet RST pin"
|
||||
#else // #elif CONFIG_ETH_USE_ESP32_EMAC
|
||||
#else // #elif CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
#define MDC_CS_PIN_DESCR "Ethernet MDC pin"
|
||||
#define MIO_IRQ_PIN_DESCR "Ethernet MIO pin"
|
||||
#define PWR_RST_PIN_DESCR "Ethernet Power pin"
|
||||
@@ -432,7 +432,7 @@ void handle_hardware() {
|
||||
|
||||
addFormNumericBox(F("Ethernet PHY Address"), F("ethphy"), Settings.ETH_Phy_Addr, -1, 127);
|
||||
addFormNote(F("I²C-address of Ethernet PHY"
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
" (0 or 1 for LAN8720, 31 for TLK110, -1 autodetect)"
|
||||
#endif
|
||||
));
|
||||
@@ -445,7 +445,7 @@ void handle_hardware() {
|
||||
addFormPinSelect(PinSelectPurpose::Ethernet, formatGpioName_output(
|
||||
F(PWR_RST_PIN_DESCR)),
|
||||
F("ethpower"), Settings.ETH_Pin_power_rst);
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC && FEATURE_ETHERNET
|
||||
addRowLabel_tr_id(F("Ethernet Clock"), F("ethclock"));
|
||||
{
|
||||
const __FlashStringHelper * ethClockOptions[] = {
|
||||
|
||||
Reference in New Issue
Block a user