From 4a3db998e65bf55b088850728917cf82be3312a8 Mon Sep 17 00:00:00 2001 From: richonguzman Date: Fri, 26 Apr 2024 13:38:49 -0400 Subject: [PATCH] added but not working --- src/LoRa_APRS_iGate.cpp | 20 +++++++++----------- src/ethernet_utils.cpp | 5 ++++- src/pins_config.h | 3 ++- src/wifi_utils.cpp | 5 +++-- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index c2ba27e9..d806593c 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -1,6 +1,6 @@ #include #include - +#include #include #include "configuration.h" #include "battery_utils.h" @@ -28,13 +28,12 @@ #include EthernetClient espClient; #else -#include WiFiClient espClient; #endif Configuration Config; -String versionDate = "2024.04.23"; +String versionDate = "2024.04.26"; uint8_t myWiFiAPIndex = 0; int myWiFiAPSize = Config.wifiAPs.size(); WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex]; @@ -91,7 +90,10 @@ void setup() { Config.check(); - LoRa_Utils::setup(); +#ifdef ESP32_DIY_LoRa_Ethernet + ETHERNET_Utils::setup(); // ver si va antes o despues de LoRa_Utils::setup() por lo de SPI +#endif + /*LoRa_Utils::setup(); Utils::validateFreqs(); iGateBeaconPacket = GPS_Utils::generateBeacon(); @@ -163,22 +165,18 @@ void setup() { } #endif -#ifdef ESP32_DIY_LoRa_Ethernet - ETHERNET_Utils::setup(); // ver si va antes o despues de LoRa_Utils::setup() por lo de SPI -#else WIFI_Utils::setup(); -#endif SYSLOG_Utils::setup(); BME_Utils::setup(); WEB_Utils::setup(); TNC_Utils::setup(); #ifdef ESP32_DIY_LoRa_A7670 A7670_Utils::setup(); -#endif +#endif*/ } void loop() { - WIFI_Utils::checkIfAutoAPShouldPowerOff(); + /*WIFI_Utils::checkIfAutoAPShouldPowerOff(); if (isUpdatingOTA) { ElegantOTA.loop(); @@ -240,4 +238,4 @@ void loop() { STATION_Utils::processLoRaOutputPacketBuffer(); show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0); -} \ No newline at end of file +*/} \ No newline at end of file diff --git a/src/ethernet_utils.cpp b/src/ethernet_utils.cpp index 940f9e8a..4bd35728 100644 --- a/src/ethernet_utils.cpp +++ b/src/ethernet_utils.cpp @@ -19,7 +19,10 @@ namespace ETHERNET_Utils { pinMode(Ethernet_SCK, OUTPUT); SPI.endTransaction(); Ethernet.init(Ethernet_CS); - Ethernet.begin(mac); + Serial.println("post init ethernet"); + if (Ethernet.begin(mac) == 0) { + Serial.println("Not Ethernet begin"); + }; delay(1000); Serial.println(Ethernet.localIP()); } diff --git a/src/pins_config.h b/src/pins_config.h index 43d293ae..ab2f6921 100644 --- a/src/pins_config.h +++ b/src/pins_config.h @@ -10,7 +10,7 @@ // LORA MODULES #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA32_V2_1_915) || defined(ESP32_DIY_LoRa_Ethernet) -#define RADIO_SCLK_PIN 5 // GPIO5 - SX1278 SCK +#define RADIO_SCLK_PIN 5 // GPIO5 - SX1278 SCK #define RADIO_MISO_PIN 19 // GPIO19 - SX1278 MISO #define RADIO_MOSI_PIN 27 // GPIO27 - SX1278 MOSI #define RADIO_CS_PIN 18 // GPIO18 - SX1278 CS ---> NSS @@ -151,6 +151,7 @@ #define BATTERY_PIN 35 #endif #if defined(ESP32_DIY_LoRa_Ethernet) +// On W5500 Ethernet Module: MOSI=MO, MISO=MI, CS=CS, SCK=SCK, VCC=V, GND=G #define Ethernet_SCK 5 // Ethernet_SCK = Radio_SCK #define Ethernet_MISO 19 // Ethernet_MISO = Radio_MISO #define Ethernet_MOSI 27 // Ethernet_MOSI = Radio_MOSI diff --git a/src/wifi_utils.cpp b/src/wifi_utils.cpp index 5a1ffb08..d7c35cd0 100644 --- a/src/wifi_utils.cpp +++ b/src/wifi_utils.cpp @@ -18,6 +18,7 @@ extern bool WiFiAutoAPStarted; namespace WIFI_Utils { void checkWiFi() { + //??? #ifndef ESP32_DIY_LoRa_Ethernet if ((WiFi.status() != WL_CONNECTED) && ((millis() - previousWiFiMillis) >= 30*1000) && !WiFiAutoAPStarted) { Serial.print(millis()); @@ -103,7 +104,7 @@ namespace WIFI_Utils { } void checkIfAutoAPShouldPowerOff() { - #ifndef ESP32_DIY_LoRa_Ethernet + //#ifndef ESP32_DIY_LoRa_Ethernet if (WiFiAutoAPStarted && Config.wifiAutoAP.powerOff > 0) { if (WiFi.softAPgetStationNum() > 0) { WiFiAutoAPTime = 0; @@ -120,7 +121,7 @@ namespace WIFI_Utils { } } } - #endif + //#endif } void setup() {