Skip to content

Commit

Permalink
added but not working
Browse files Browse the repository at this point in the history
  • Loading branch information
richonguzman committed Apr 26, 2024
1 parent 791dcdf commit 4a3db99
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
20 changes: 9 additions & 11 deletions src/LoRa_APRS_iGate.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <ElegantOTA.h>
#include <Arduino.h>

#include <WiFi.h>
#include <vector>
#include "configuration.h"
#include "battery_utils.h"
Expand Down Expand Up @@ -28,13 +28,12 @@
#include <Ethernet.h>
EthernetClient espClient;
#else
#include <WiFi.h>
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];
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -240,4 +238,4 @@ void loop() {
STATION_Utils::processLoRaOutputPacketBuffer();
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
}
*/}
5 changes: 4 additions & 1 deletion src/ethernet_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
3 changes: 2 additions & 1 deletion src/pins_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/wifi_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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;
Expand All @@ -120,7 +121,7 @@ namespace WIFI_Utils {
}
}
}
#endif
//#endif
}

void setup() {
Expand Down

0 comments on commit 4a3db99

Please sign in to comment.