From 993b8b40037e19afe98bdaaed7406151c175e520 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 13 Mar 2021 22:27:46 +0100 Subject: [PATCH] ethernet fix --- src/LoRa_APRS_iGate.cpp | 3 ++- src/TaskEth.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index e57691b..533360f 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -86,8 +86,9 @@ void setup() { TaskManager::instance().addTask(std::shared_ptr(new LoraTask())); if (boardConfig->Type == eETH_BOARD) { TaskManager::instance().addTask(std::shared_ptr(new EthTask())); + } else { + TaskManager::instance().addTask(std::shared_ptr(new WifiTask())); } - TaskManager::instance().addTask(std::shared_ptr(new WifiTask())); TaskManager::instance().addTask(std::shared_ptr(new OTATask())); TaskManager::instance().addTask(std::shared_ptr(new NTPTask())); if (userConfig->ftp.active) { diff --git a/src/TaskEth.cpp b/src/TaskEth.cpp index e61d736..9435a5f 100644 --- a/src/TaskEth.cpp +++ b/src/TaskEth.cpp @@ -51,14 +51,14 @@ EthTask::~EthTask() { bool EthTask::setup(std::shared_ptr config, std::shared_ptr boardConfig) { WiFi.onEvent(WiFiEvent); -#define ETH_POWER_PIN -1 -#define ETH_TYPE ETH_PHY_LAN8720 -#define ETH_ADDR 0 -#define ETH_MDC_PIN 23 -#define ETH_MDIO_PIN 18 -#define ETH_NRST 5 -#define ETH_CLK ETH_CLOCK_GPIO17_OUT // TTGO PoE V1.0 - //#define ETH_CLK ETH_CLOCK_GPIO0_OUT // TTGO PoE V1.2 + constexpr uint8_t ETH_NRST = 5; + constexpr uint8_t ETH_ADDR = 0; + constexpr int ETH_POWER_PIN = -1; + constexpr int ETH_MDC_PIN = 23; + constexpr int ETH_MDIO_PIN = 18; + constexpr eth_phy_type_t ETH_TYPE = ETH_PHY_LAN8720; + constexpr eth_clock_mode_t ETH_CLK = ETH_CLOCK_GPIO17_OUT; // TTGO PoE V1.0 + // constexpr eth_clock_mode_t ETH_CLK = ETH_CLOCK_GPIO0_OUT; // TTGO PoE V1.2 pinMode(ETH_NRST, OUTPUT); digitalWrite(ETH_NRST, 0);