From 20687cd9d2773523d5c1d6c799c427cc1e26044c Mon Sep 17 00:00:00 2001 From: richonguzman Date: Thu, 8 Jun 2023 00:44:13 -0400 Subject: [PATCH] configuration path repack --- README.md | 25 ++++++++++++++++++------- data/igate_conf.json | 2 +- src/LoRa_APRS_iGate.cpp | 9 ++++++--- src/configuration.cpp | 10 ++++++---- src/configuration.h | 3 +-- src/utils.cpp | 12 ++++++++++-- 6 files changed, 42 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index d269974..df57d1f 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,17 @@ -# Richonguzman / CD2RXU LoRa APRS iGate +# Richonguzman / CD2RXU LoRa APRS iGate/Digirepeater # Firmware for Tx and Rx !!! -LoRa APRS iGATE for: -- LILYGO ESP32 LoRa v2-1-1.6 +LoRa APRS iGATE/Digirepeater for: +- LILYGO ESP32 LoRa32 v2-1-1.6 - ESP32 Wroom Dev + SX1278 LoRa Module for a DIY Version __________________________________________ Achievements: -- listening to LoRa packets the same as messages for Stations/Callsing in near 80Kms. -- transmiting messages listened from APRS-IS to LoRa - +- Rx LoRa packets and upload to APRS-IS servers +- Be able to listen for 80kms or more Stations/Callsing. +- Tx LoRa packets from APRS-IS feed. +- Digirepeater Modes. __________________________________________ Instrucctions (add your information into the '/data/igate_conf.json'): @@ -25,7 +26,16 @@ Instrucctions (add your information into the '/data/igate_conf.json'): 5.- Change "aprs_is">"passcode" from "XYZVW" to yours (remember that is 5 digits integer). -6.- Change "lora">"enableTx" to _"true"_ ONLY(!) if you are an valid Ham Operator +6.- Change "stationMode" value to other than 1 ONLY(!) if you are an valid Ham Operator. + +__________________________________________ + +Digirepeater Modes: +1.- iGate (only Rx). +2.- iGate (Tx and Rx) HAM LICENSE REQUIRED! +3.- Digirepeater (Rx Freq = Tx Freq) HAM LICENSE REQUIRED! +4.- Digirepeater (Rx Freq != Tx Freq) HAM LICENSE REQUIRED! +5.- iGate changes to Digirepeater when it looses APRS-IS+WiFi connection (on development). __________________________________________ Versions: @@ -36,6 +46,7 @@ Versions: - 2023.05.19 Saving Last-Heard Stations for validating Tx Responses - 2023.05.23 Processing Query's from RF/LoRa or APRS-IS (Send "Help" Message to test) - 2023.06.06 Full repack of Code and adding _enableTx_ only for Ham Ops +- 2023.06.08 Adding Digirepeater Funtions __________________________________________ diff --git a/data/igate_conf.json b/data/igate_conf.json index 0a343e3..66fff4b 100644 --- a/data/igate_conf.json +++ b/data/igate_conf.json @@ -23,7 +23,7 @@ "server": "soam.aprs2.net", "port": 14580, "softwareName": "ESP32_LoRa_iGate", - "softwareVersion": "0.1.1", + "softwareVersion": "1.2", "reportingDistance": 30 }, "lora": { diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index ba106d7..b0af43c 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -17,12 +17,11 @@ #include #include */ -#define VERSION "2023.06.07" +#define VERSION "2023.06.08" +Configuration Config; WiFiClient espClient; //AsyncWebServer server(80); -String ConfigurationFilePath = "/igate_conf.json"; -Configuration Config(ConfigurationFilePath); int myWiFiAPIndex = 0; int myWiFiAPSize = Config.wifiAPs.size(); @@ -63,6 +62,9 @@ void loop() { utils::checkBeaconInterval(); show_display(firstLine, secondLine, thirdLine, fourthLine, 0); DIGI_Utils::processPacket(LoRa_Utils::receivePacket()); + if (statusAfterBoot) { + utils::processStatus(); + } } else if (stationMode==1 || stationMode==2 ) { // iGate (1 Only Rx / 2 Rx+Tx) unsigned long currentWiFiMillis = millis(); if ((WiFi.status() != WL_CONNECTED) && (currentWiFiMillis - previousWiFiMillis >= currentWiFi->checkInterval*1000)) { @@ -143,6 +145,7 @@ void loop() { } } else { Serial.println(stationMode); + // stationMode = 5 // this mode is only for when iGate loses Wifi and transforms into Digirepeater } } \ No newline at end of file diff --git a/src/configuration.cpp b/src/configuration.cpp index 45074ec..f1febf3 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -1,12 +1,13 @@ #include "configuration.h" +#include "display.h" -Configuration::Configuration(const String &filePath) { - _filePath = filePath; +Configuration::Configuration() { + _filePath = "/igate_conf.json"; if (!SPIFFS.begin(false)) { Serial.println("SPIFFS Mount Failed"); return; } - readFile(SPIFFS, _filePath.c_str()); + readFile(SPIFFS, _filePath.c_str()); } void Configuration::readFile(fs::FS &fs, const char *fileName) { @@ -60,7 +61,8 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) { void Configuration::validateConfigFile(String currentBeaconCallsign) { if (currentBeaconCallsign == "NOCALL-10") { - Serial.println("Change Callsign in /data/wx_report_config.json"); + Serial.println("Change Callsign in /data/igate_conf.json"); + show_display("ERROR", "Change your settings", "'igate_conf.json'", "--> File System image", 0); while (true) { delay(1000); } diff --git a/src/configuration.h b/src/configuration.h index e5b84db..577311d 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -60,11 +60,10 @@ public: Display display; - Configuration(const String &filePath); + Configuration(); void validateConfigFile(String currentBeaconCallsign); private: - Configuration() {}; // Hide default constructor void readFile(fs::FS &fs, const char *fileName) ; String _filePath; }; diff --git a/src/utils.cpp b/src/utils.cpp index 7b24b0e..9aee8fd 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -22,8 +22,16 @@ extern String iGateBeaconPacket; namespace utils { void processStatus() { - delay(1000); - espClient.write((Config.callsign + ">APLRG1,qAC:>" + Config.defaultStatus + "\n").c_str()); + String status = Config.callsign + ">APLRG1"; + if (stationMode==1 || stationMode==2) { + delay(1000); + status += ",qAC:>" + Config.defaultStatus; + espClient.write((status + "\n").c_str()); + } else { + delay(5000); + status += ":>" + Config.defaultStatus; + LoRa_Utils::sendNewPacket("APRS", status); + } statusAfterBoot = false; }