add iGate with APRS and LoRa beacon mode

This commit is contained in:
richonguzman 2024-01-11 23:22:58 -03:00
parent 2312eada2c
commit d587246be8
7 changed files with 46 additions and 14 deletions

View file

@ -1,18 +1,18 @@
{
"callsign": "NOCALL-10",
"callsign": "CA2RXU-11",
"stationMode": 2,
"iGateComment": "LoRa_APRS_iGate",
"wifi": {
"AP": [
{ "ssid": "WIFI_1",
"password": "wifi_1_password",
"latitude": 0.0000000,
"longitude": 0.0000000
{ "ssid": "Richon",
"password": "k4fPnmg5qnyf",
"latitude": -33.0337718,
"longitude": -71.5737141
},
{ "ssid": "WIFI_2",
"password": "wifi_2_password",
"latitude": 0.0000000,
"longitude": 0.0000000
{ "ssid": "Jimenita",
"password": "mg6wyMhqRnxk",
"latitude": -33.0312492,
"longitude": -71.5796215
}
]
},
@ -22,7 +22,7 @@
"longitude": 0.0000000
},
"aprs_is": {
"passcode": "XYZVW",
"passcode": "23204",
"server": "soam.aprs2.net",
"port": 14580,
"reportingDistance": 30
@ -55,6 +55,8 @@
},
"other": {
"beaconInterval": 15,
"igateLoRaBeacon": true,
"igateRepeatsLoRaPackets": true,
"rememberStationTime": 30,
"sendBatteryVoltage": false,
"externalVoltageMeasurement" : false,

View file

@ -20,7 +20,7 @@
Configuration Config;
WiFiClient espClient;
String versionDate = "2024.01.05";
String versionDate = "2024.01.11";
int myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
@ -43,7 +43,7 @@ std::vector<String> lastHeardStation_temp;
std::vector<String> packetBuffer;
std::vector<String> packetBuffer_temp;
String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, iGateBeaconPacket;
String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, iGateBeaconPacket, iGateLoRaBeaconPacket;
void setup() {
Serial.begin(115200);
@ -65,6 +65,7 @@ void setup() {
LoRa_Utils::setup();
Utils::validateDigiFreqs();
iGateBeaconPacket = GPS_Utils::generateBeacon();
iGateLoRaBeaconPacket = GPS_Utils::generateiGateLoRaBeacon();
//Utils::startServer();
SYSLOG_Utils::setup();
BME_Utils::setup();

View file

@ -35,6 +35,8 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
stationMode = data["stationMode"].as<int>();
iGateComment = data["iGateComment"].as<String>();
beaconInterval = data["other"]["beaconInterval"].as<int>();
igateLoRaBeacon = data["other"]["igateLoRaBeacon"].as<bool>();
igateRepeatsLoRaPackets = data["other"]["igateRepeatsLoRaPackets"].as<bool>();
rememberStationTime = data["other"]["rememberStationTime"].as<int>();
sendBatteryVoltage = data["other"]["sendBatteryVoltage"].as<bool>();
externalVoltageMeasurement = data["other"]["externalVoltageMeasurement"].as<bool>();

View file

@ -73,6 +73,8 @@ public:
int stationMode;
String iGateComment;
int beaconInterval;
bool igateLoRaBeacon;
bool igateRepeatsLoRaPackets;
int rememberStationTime;
bool sendBatteryVoltage;
bool externalVoltageMeasurement;

View file

@ -107,6 +107,19 @@ namespace GPS_Utils {
return beaconPacket;
}
String generateiGateLoRaBeacon() {
String stationLatitude, stationLongitude, beaconPacket;
stationLatitude = processLatitudeAPRS(currentWiFi->latitude);
stationLongitude = processLongitudeAPRS(currentWiFi->longitude);
beaconPacket = Config.callsign + ">APLRG1,RFONLY:=" + stationLatitude + "L" + stationLongitude;
if (Config.bme.active) {
beaconPacket += "_";
} else {
beaconPacket += "a";
}
return beaconPacket;
}
double calculateDistanceTo(double latitude, double longitude) {
return TinyGPSPlus::distanceBetween(currentWiFi->latitude,currentWiFi->longitude, latitude, longitude) / 1000.0;
}

View file

@ -9,6 +9,7 @@ namespace GPS_Utils {
String processLatitudeAPRS();
String processLongitudeAPRS();
String generateBeacon();
String generateiGateLoRaBeacon();
double calculateDistanceCourse(double latitude, double longitude);
String decodeEncodedGPS(String packet);
String getReceivedGPS(String packet);

View file

@ -34,6 +34,7 @@ extern uint32_t lastScreenOn;
extern bool beaconUpdate;
extern int stationMode;
extern String iGateBeaconPacket;
extern String iGateLoRaBeaconPacket;
extern std::vector<String> lastHeardStation;
extern int rssi;
extern float snr;
@ -103,7 +104,7 @@ namespace Utils {
void checkBeaconInterval() {
uint32_t lastTx = millis() - lastBeaconTx;
String beaconPacket;
String beaconPacket, secondaryBeaconPacket;
if (lastTx >= Config.beaconInterval*60*1000) {
beaconUpdate = true;
}
@ -113,9 +114,16 @@ namespace Utils {
STATION_Utils::deleteNotHeard();
activeStations();
if (Config.bme.active) {
beaconPacket = iGateBeaconPacket.substring(0,iGateBeaconPacket.indexOf(":=")+20) + "_" + BME_Utils::readDataSensor() + iGateBeaconPacket.substring(iGateBeaconPacket.indexOf(":=")+21) + " + WX";
String sensorData = BME_Utils::readDataSensor();
beaconPacket = iGateBeaconPacket.substring(0,iGateBeaconPacket.indexOf(":=")+20) + "_" + sensorData + iGateBeaconPacket.substring(iGateBeaconPacket.indexOf(":=")+21) + " + WX";
if (Config.igateLoRaBeacon) {
secondaryBeaconPacket = iGateLoRaBeaconPacket + sensorData + Config.iGateComment + " + WX";
}
} else {
beaconPacket = iGateBeaconPacket;
if (Config.igateLoRaBeacon) {
secondaryBeaconPacket = iGateLoRaBeaconPacket + Config.iGateComment;
}
}
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2)
if (Config.sendBatteryVoltage) {
@ -142,6 +150,9 @@ namespace Utils {
}
seventhLine = " listening...";
espClient.write((beaconPacket + "\n").c_str());
if (Config.igateLoRaBeacon) {
LoRa_Utils::sendNewPacket("APRS", secondaryBeaconPacket);
}
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
} else if (stationMode==3 || stationMode==4) {
String Rx = String(Config.loramodule.digirepeaterRxFreq);