mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-07-10 20:01:14 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bf7f136e56 |
@@ -0,0 +1,13 @@
|
|||||||
|
#ifndef ETHERNET_UTILS_H_
|
||||||
|
#define ETHERNET_UTILS_H_
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace ETHERNET_Utils {
|
||||||
|
|
||||||
|
void setup();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
+36
-13
@@ -23,7 +23,6 @@ ___________________________________________________________________*/
|
|||||||
#include <ElegantOTA.h>
|
#include <ElegantOTA.h>
|
||||||
#include <TinyGPS++.h>
|
#include <TinyGPS++.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <WiFi.h>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "battery_utils.h"
|
#include "battery_utils.h"
|
||||||
@@ -35,7 +34,13 @@ ___________________________________________________________________*/
|
|||||||
#include "query_utils.h"
|
#include "query_utils.h"
|
||||||
#include "power_utils.h"
|
#include "power_utils.h"
|
||||||
#include "lora_utils.h"
|
#include "lora_utils.h"
|
||||||
#include "wifi_utils.h"
|
#ifdef HAS_ETHERNET
|
||||||
|
#include <Ethernet.h>
|
||||||
|
#include "ethernet_utils.h"
|
||||||
|
#else
|
||||||
|
#include <WiFi.h>
|
||||||
|
#include "wifi_utils.h"
|
||||||
|
#endif
|
||||||
#include "digi_utils.h"
|
#include "digi_utils.h"
|
||||||
#include "gps_utils.h"
|
#include "gps_utils.h"
|
||||||
#include "web_utils.h"
|
#include "web_utils.h"
|
||||||
@@ -48,9 +53,15 @@ ___________________________________________________________________*/
|
|||||||
#include "A7670_utils.h"
|
#include "A7670_utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String versionDate = "2025.03.03";
|
String versionDate = "2025.03.06";
|
||||||
Configuration Config;
|
Configuration Config;
|
||||||
WiFiClient espClient;
|
|
||||||
|
#ifdef HAS_ETHERNET
|
||||||
|
EthernetClient espClient;
|
||||||
|
#else
|
||||||
|
WiFiClient espClient;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_GPS
|
#ifdef HAS_GPS
|
||||||
HardwareSerial gpsSerial(1);
|
HardwareSerial gpsSerial(1);
|
||||||
TinyGPSPlus gps;
|
TinyGPSPlus gps;
|
||||||
@@ -80,9 +91,10 @@ String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seven
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
delay(5000);
|
||||||
POWER_Utils::setup();
|
POWER_Utils::setup();
|
||||||
Utils::setupDisplay();
|
Utils::setupDisplay();
|
||||||
LoRa_Utils::setup();
|
//LoRa_Utils::setup();
|
||||||
Utils::validateFreqs();
|
Utils::validateFreqs();
|
||||||
GPS_Utils::setup();
|
GPS_Utils::setup();
|
||||||
STATION_Utils::loadBlackList();
|
STATION_Utils::loadBlackList();
|
||||||
@@ -133,7 +145,12 @@ void setup() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
DIGI_Utils::checkEcoMode();
|
DIGI_Utils::checkEcoMode();
|
||||||
WIFI_Utils::setup();
|
#ifdef HAS_ETHERNET
|
||||||
|
ETHERNET_Utils::setup();
|
||||||
|
#else
|
||||||
|
WIFI_Utils::setup();
|
||||||
|
#endif
|
||||||
|
LoRa_Utils::setup();
|
||||||
NTP_Utils::setup();
|
NTP_Utils::setup();
|
||||||
SYSLOG_Utils::setup();
|
SYSLOG_Utils::setup();
|
||||||
WX_Utils::setup();
|
WX_Utils::setup();
|
||||||
@@ -147,14 +164,16 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
WIFI_Utils::checkAutoAPTimeout();
|
#ifndef HAS_ETHERNET
|
||||||
|
WIFI_Utils::checkAutoAPTimeout();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (isUpdatingOTA) {
|
/*if (isUpdatingOTA) {
|
||||||
ElegantOTA.loop();
|
ElegantOTA.loop();
|
||||||
return; // Don't process IGate and Digi during OTA update
|
return; // Don't process IGate and Digi during OTA update
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (Config.lowVoltageCutOff > 0) {
|
/*if (Config.lowVoltageCutOff > 0) {
|
||||||
BATTERY_Utils::checkIfShouldSleep();
|
BATTERY_Utils::checkIfShouldSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,8 +201,12 @@ void loop() {
|
|||||||
#ifdef HAS_A7670
|
#ifdef HAS_A7670
|
||||||
if (Config.aprs_is.active && !modemLoggedToAPRSIS) A7670_Utils::APRS_IS_connect();
|
if (Config.aprs_is.active && !modemLoggedToAPRSIS) A7670_Utils::APRS_IS_connect();
|
||||||
#else
|
#else
|
||||||
WIFI_Utils::checkWiFi();
|
#ifdef HAS_ETHERNET
|
||||||
if (Config.aprs_is.active && (WiFi.status() == WL_CONNECTED) && !espClient.connected()) APRS_IS_Utils::connect();
|
if (Config.aprs_is.active && !espClient.connected()) APRS_IS_Utils::connect();
|
||||||
|
#else
|
||||||
|
WIFI_Utils::checkWiFi();
|
||||||
|
if (Config.aprs_is.active && (WiFi.status() == WL_CONNECTED) && !espClient.connected()) APRS_IS_Utils::connect();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NTP_Utils::update();
|
NTP_Utils::update();
|
||||||
@@ -237,5 +260,5 @@ void loop() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Utils::checkRebootTime();
|
Utils::checkRebootTime();
|
||||||
Utils::checkSleepByLowBatteryVoltage(1);
|
Utils::checkSleepByLowBatteryVoltage(1);*/
|
||||||
}
|
}
|
||||||
+25
-6
@@ -1,7 +1,7 @@
|
|||||||
#include <WiFi.h>
|
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "aprs_is_utils.h"
|
#include "aprs_is_utils.h"
|
||||||
#include "station_utils.h"
|
#include "station_utils.h"
|
||||||
|
#include "board_pinout.h"
|
||||||
#include "syslog_utils.h"
|
#include "syslog_utils.h"
|
||||||
#include "query_utils.h"
|
#include "query_utils.h"
|
||||||
#include "A7670_utils.h"
|
#include "A7670_utils.h"
|
||||||
@@ -10,7 +10,15 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
extern WiFiClient espClient;
|
|
||||||
|
#ifdef HAS_ETHERNET
|
||||||
|
#include <Ethernet.h>
|
||||||
|
extern EthernetClient espClient;
|
||||||
|
#else
|
||||||
|
#include <WiFi.h>
|
||||||
|
extern WiFiClient espClient;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern uint32_t lastScreenOn;
|
extern uint32_t lastScreenOn;
|
||||||
extern String firstLine;
|
extern String firstLine;
|
||||||
extern String secondLine;
|
extern String secondLine;
|
||||||
@@ -58,7 +66,7 @@ namespace APRS_IS_Utils {
|
|||||||
aprsAuth += Config.callsign;
|
aprsAuth += Config.callsign;
|
||||||
aprsAuth += " pass ";
|
aprsAuth += " pass ";
|
||||||
aprsAuth += Config.aprs_is.passcode;
|
aprsAuth += Config.aprs_is.passcode;
|
||||||
aprsAuth += " vers CA2RXU_LoRa_iGate 2.0 filter ";
|
aprsAuth += " vers CA2RXU_LoRa_iGate 2.1 filter ";
|
||||||
aprsAuth += Config.aprs_is.filter;
|
aprsAuth += Config.aprs_is.filter;
|
||||||
upload(aprsAuth);
|
upload(aprsAuth);
|
||||||
}
|
}
|
||||||
@@ -66,8 +74,14 @@ namespace APRS_IS_Utils {
|
|||||||
|
|
||||||
void checkStatus() {
|
void checkStatus() {
|
||||||
String wifiState, aprsisState;
|
String wifiState, aprsisState;
|
||||||
if (WiFi.status() == WL_CONNECTED) {
|
if (true) {
|
||||||
wifiState = "OK";
|
/*#ifdef HAS_ETHERNET
|
||||||
|
if (Ethernet.linkStatus() == LinkON) {
|
||||||
|
wifiState = "ET";
|
||||||
|
#else
|
||||||
|
if (WiFi.status() == WL_CONNECTED) {
|
||||||
|
wifiState = "OK";
|
||||||
|
#endif*/
|
||||||
} else {
|
} else {
|
||||||
if (backUpDigiMode || Config.digi.ecoMode) {
|
if (backUpDigiMode || Config.digi.ecoMode) {
|
||||||
wifiState = "--";
|
wifiState = "--";
|
||||||
@@ -362,7 +376,12 @@ namespace APRS_IS_Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void firstConnection() {
|
void firstConnection() {
|
||||||
if (Config.aprs_is.active && (WiFi.status() == WL_CONNECTED) && !espClient.connected()) {
|
|
||||||
|
//#ifdef HAS_ETHERNET
|
||||||
|
if (Config.aprs_is.active && !espClient.connected()) {
|
||||||
|
//#else
|
||||||
|
// if (Config.aprs_is.active && (WiFi.status() == WL_CONNECTED) && !espClient.connected()) {
|
||||||
|
//#endif
|
||||||
connect();
|
connect();
|
||||||
while (!passcodeValid) {
|
while (!passcodeValid) {
|
||||||
listenAPRSIS();
|
listenAPRSIS();
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*#include <WiFi.h>
|
||||||
|
#include "configuration.h"
|
||||||
|
#include "station_utils.h"
|
||||||
|
#include "aprs_is_utils.h"
|
||||||
|
#include "query_utils.h"
|
||||||
|
#include "digi_utils.h"
|
||||||
|
#include "wifi_utils.h"
|
||||||
|
#include "lora_utils.h"
|
||||||
|
#include "gps_utils.h"
|
||||||
|
#include "display.h"
|
||||||
|
#include "utils.h"*/
|
||||||
|
#include <Ethernet.h>
|
||||||
|
#include <SPI.h>
|
||||||
|
#include "ethernet_utils.h"
|
||||||
|
#include "board_pinout.h"
|
||||||
|
|
||||||
|
/*extern Configuration Config;
|
||||||
|
extern uint32_t lastScreenOn;
|
||||||
|
extern String iGateBeaconPacket;
|
||||||
|
extern String firstLine;
|
||||||
|
extern String secondLine;
|
||||||
|
extern String thirdLine;
|
||||||
|
extern String fourthLine;
|
||||||
|
extern String fifthLine;
|
||||||
|
extern String sixthLine;
|
||||||
|
extern String seventhLine;
|
||||||
|
extern bool backUpDigiMode;*/
|
||||||
|
|
||||||
|
|
||||||
|
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
|
||||||
|
|
||||||
|
namespace ETHERNET_Utils {
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));
|
||||||
|
pinMode(Ethernet_CS, OUTPUT);
|
||||||
|
pinMode(Ethernet_MOSI, OUTPUT);
|
||||||
|
pinMode(Ethernet_MISO, INPUT);
|
||||||
|
pinMode(Ethernet_SCK, OUTPUT);
|
||||||
|
SPI.endTransaction();
|
||||||
|
Ethernet.init(Ethernet_CS);
|
||||||
|
Ethernet.begin(mac);
|
||||||
|
delay(1000);
|
||||||
|
Serial.println(Ethernet.localIP());
|
||||||
|
|
||||||
|
delay(1000);
|
||||||
|
Serial.println(Ethernet.linkStatus());
|
||||||
|
delay(1000);
|
||||||
|
Serial.println(Ethernet.linkStatus());
|
||||||
|
delay(1000);
|
||||||
|
Serial.println(Ethernet.linkStatus());
|
||||||
|
delay(1000);
|
||||||
|
Serial.println(Ethernet.linkStatus());
|
||||||
|
delay(1000);
|
||||||
|
if (Ethernet.linkStatus() == LinkON) {
|
||||||
|
Serial.println("Ethernet connected...");
|
||||||
|
} else {
|
||||||
|
Serial.println("Ethernet not connected...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef BOARD_PINOUT_H_
|
||||||
|
#define BOARD_PINOUT_H_
|
||||||
|
|
||||||
|
// LoRa Radio
|
||||||
|
#define HAS_SX1278
|
||||||
|
#define RADIO_SCLK_PIN 4
|
||||||
|
#define RADIO_MISO_PIN 5
|
||||||
|
#define RADIO_MOSI_PIN 6
|
||||||
|
#define RADIO_CS_PIN 20
|
||||||
|
#define RADIO_RST_PIN 3
|
||||||
|
#define RADIO_BUSY_PIN 2
|
||||||
|
|
||||||
|
// Ethernet W5500
|
||||||
|
#define HAS_ETHERNET
|
||||||
|
#define Ethernet_SCK 4 // W5550 SCK
|
||||||
|
#define Ethernet_MISO 5 // W5550 MI
|
||||||
|
#define Ethernet_MOSI 6 // W5550 MO
|
||||||
|
#define Ethernet_CS 7 // W5550 CS (CS = NSS = SS)
|
||||||
|
//#define Ethernet_VCC 3.3v
|
||||||
|
//#define Ethernet_GND GND
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
[env:ESP32C3_DIY_Ethernet_LoRa]
|
||||||
|
board = esp32-c3-devkitm-1
|
||||||
|
board_build.mcu = esp32c3
|
||||||
|
build_flags =
|
||||||
|
${common.build_flags}
|
||||||
|
${common.usb_flags}
|
||||||
|
-D ESP32C3_DIY_Ethernet_LoRa
|
||||||
|
lib_deps =
|
||||||
|
${common.lib_deps}
|
||||||
|
arduino-libraries/Ethernet @ 2.0.2
|
||||||
Reference in New Issue
Block a user