This commit is contained in:
richonguzman 2023-07-30 23:53:59 -04:00
parent a8f013ba7d
commit 35499c36c6
11 changed files with 58 additions and 64 deletions

View file

@ -93,6 +93,7 @@ Versions:
- 2023.06.18 Info on Oled Screen mayor update, added RSSI and Distance to Listened Station.
- 2023.07.05 Adding monitor info of Battery connected.
- 2023.07.16 Small OTA, BME module update.
- 2023.07.31 StationMode5 added: iGate when WiFi and APRS available, DigiRepeater when not.
__________________________________________

View file

@ -1,29 +1,29 @@
{
"callsign": "CD2RXU-11",
"stationMode": 5,
"callsign": "CD2RXU-10",
"stationMode": 2,
"iGateComment": "LoRa_APRS_iGate",
"wifi": {
"AP": [
{ "ssid": "Richon",
"password": "k4fPnmg5qnyf",
"latitude": -32.9543284,
"longitude": -71.1202063
"latitude": -33.0337313,
"longitude": -71.5737261
},
{ "ssid": "iPhone Richon",
"password": "1234poto5678",
"latitude": -32.9543284,
"longitude": -71.1202063
}
{ "ssid": "Jimenita",
"password": "mg6wyMhqRnxk",
"latitude": -33.0312492,
"longitude": -71.5796215
}
]
},
"digi": {
"comment": "LoRa_APRS_Digirepeater",
"latitude": -32.9543284,
"longitude": -71.1202063
"latitude": -33.0338131,
"longitude": -71.5737237
},
"aprs_is": {
"passcode": "23201",
"server": "euro.aprs2.net",
"server": "soam.aprs2.net",
"port": 14580,
"reportingDistance": 30
},
@ -37,7 +37,7 @@
"power": 20
},
"display": {
"alwaysOn": true,
"alwaysOn": false,
"timeout": 4,
"turn180" : false
},
@ -49,8 +49,7 @@
"other": {
"beaconInterval": 15,
"rememberStationTime": 30,
"sendBatteryVoltage": false,
"lastWiFiCheck": 15
"sendBatteryVoltage": false
},
"bme": {
"active": false

View file

@ -20,7 +20,7 @@
Configuration Config;
WiFiClient espClient;
String versionDate = "2023.07.30";
String versionDate = "2023.07.31";
int myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
@ -64,23 +64,9 @@ void loop() {
if (!espClient.connected()) {
APRS_IS_Utils::connect();
}
APRS_IS_Utils::checkStatus();
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
while (espClient.connected()) {
Utils::checkDisplayInterval();
Utils::checkBeaconInterval();
APRS_IS_Utils::processLoRaPacket(LoRa_Utils::receivePacket());
if (espClient.available()) {
String aprsisPacket;
aprsisPacket.concat(espClient.readStringUntil('\r'));
APRS_IS_Utils::processAPRSISPacket(aprsisPacket);
}
}
APRS_IS_Utils::loop();
} else if (stationMode==3 || stationMode==4) { // DigiRepeater (3 RxFreq=TxFreq / 4 RxFreq!=TxFreq)
Utils::checkDisplayInterval();
Utils::checkBeaconInterval();
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
DIGI_Utils::processPacket(LoRa_Utils::receivePacket());
DIGI_Utils::loop();
} else if (stationMode==5) { // iGate when WiFi and APRS available , DigiRepeater when not (RxFreq=TxFreq)
Utils::checkWiFiInterval();
if (WiFi.status() == WL_CONNECTED) { // iGate Mode
@ -93,31 +79,9 @@ void loop() {
lastStationModeState = 0;
Utils::startOTAServer();
}
APRS_IS_Utils::checkStatus();
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
while (espClient.connected()) {
Utils::checkDisplayInterval();
Utils::checkBeaconInterval();
APRS_IS_Utils::processLoRaPacket(LoRa_Utils::receivePacket());
if (espClient.available()) {
String aprsisPacket;
aprsisPacket.concat(espClient.readStringUntil('\r'));
APRS_IS_Utils::processAPRSISPacket(aprsisPacket);
}
}
APRS_IS_Utils::loop();
} else { // DigiRepeater Mode
if (lastStationModeState == 0) {
iGateBeaconPacket = GPS_Utils::generateBeacon();
lastStationModeState = 1;
String Tx = String(Config.loramodule.digirepeaterTxFreq);
secondLine = "Rx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
secondLine += " Tx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
thirdLine = "<< DigiRepeater >>";
}
Utils::checkDisplayInterval();
Utils::checkBeaconInterval();
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
DIGI_Utils::processPacket(LoRa_Utils::receivePacket());
DIGI_Utils::loop();
}
}
}

View file

@ -193,4 +193,19 @@ void processAPRSISPacket(String packet) {
}
}
void loop() {
checkStatus();
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
while (espClient.connected()) {
Utils::checkDisplayInterval();
Utils::checkBeaconInterval();
processLoRaPacket(LoRa_Utils::receivePacket());
if (espClient.available()) {
String aprsisPacket;
aprsisPacket.concat(espClient.readStringUntil('\r'));
processAPRSISPacket(aprsisPacket);
}
}
}
}

View file

@ -10,6 +10,7 @@ void checkStatus();
String createPacket(String unprocessedPacket);
void processLoRaPacket(String packet);
void processAPRSISPacket(String packet);
void loop();
}

View file

@ -37,7 +37,6 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
beaconInterval = data["other"]["beaconInterval"].as<int>();
rememberStationTime = data["other"]["rememberStationTime"].as<int>();
sendBatteryVoltage = data["other"]["sendBatteryVoltage"].as<bool>();
lastWiFiCheck = data["other"]["lastWiFiCheck"].as<int>();
digi.comment = data["digi"]["comment"].as<String>();
digi.latitude = data["digi"]["latitude"].as<double>();

View file

@ -67,7 +67,6 @@ public:
int beaconInterval;
int rememberStationTime;
bool sendBatteryVoltage;
int lastWiFiCheck;
std::vector<WiFi_AP> wifiAPs;
DIGI digi;
APRS_IS aprs_is;

View file

@ -2,12 +2,22 @@
#include "station_utils.h"
#include "lora_utils.h"
#include "digi_utils.h"
#include "gps_utils.h"
#include "display.h"
#include "utils.h"
extern Configuration Config;
extern int stationMode;
extern uint32_t lastScreenOn;
extern int lastStationModeState;
extern String iGateBeaconPacket;
extern String firstLine;
extern String secondLine;
extern String thirdLine;
extern String fourthLine;
extern String fifthLine;
extern String sixthLine;
extern String seventhLine;
namespace DIGI_Utils {
@ -49,8 +59,9 @@ void processPacket(String packet) {
}
}
}
void loop() {
if (lastStationModeState == 0) {
if (lastStationModeState==0 && stationMode==5) {
iGateBeaconPacket = GPS_Utils::generateBeacon();
lastStationModeState = 1;
String Tx = String(Config.loramodule.digirepeaterTxFreq);

View file

@ -90,9 +90,14 @@ String generateBeacon() {
beaconPacket += "a";
}
beaconPacket += Config.iGateComment;
} else { //stationMode 3 y 4
stationLatitude = processLatitudeAPRS(Config.digi.latitude);
stationLongitude = processLongitudeAPRS(Config.digi.longitude);
} else { //stationMode 3, 4 and 5
if (stationMode==5) {
stationLatitude = processLatitudeAPRS(currentWiFi->latitude);
stationLongitude = processLongitudeAPRS(currentWiFi->longitude);
} else {
stationLatitude = processLatitudeAPRS(Config.digi.latitude);
stationLongitude = processLongitudeAPRS(Config.digi.longitude);
}
beaconPacket = Config.callsign + ">APLRG1:=" + stationLatitude + "L" + stationLongitude + "#" + Config.digi.comment;
}
return beaconPacket;

View file

@ -48,7 +48,7 @@ namespace Utils {
void processStatus() {
String status = Config.callsign + ">APLRG1";
if (stationMode==1 || stationMode==2) {
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status() == WL_CONNECTED)) {
delay(1000);
status += ",qAC:>https://github.com/richonguzman/LoRa_APRS_iGate " + versionDate ;
espClient.write((status + "\n").c_str());
@ -189,7 +189,7 @@ void checkDisplayInterval() {
void checkWiFiInterval() {
uint32_t WiFiCheck = millis() - lastWiFiCheck;
if (WiFi.status() != WL_CONNECTED && WiFiCheck >= Config.lastWiFiCheck*60*1000) {
if (WiFi.status() != WL_CONNECTED && WiFiCheck >= 15*60*1000) {
WiFiConnect = true;
}
if (WiFiConnect) {