mods for syslog and PinPoint

This commit is contained in:
richonguzman 2023-10-06 11:11:39 -03:00
parent 0f8f082ff7
commit c5132b0eca
5 changed files with 26 additions and 14 deletions

View file

@ -4,6 +4,11 @@
"iGateComment": "LoRa_APRS_iGate",
"wifi": {
"AP": [
{ "ssid": "Stam2.4",
"password": "Stamaudio295.",
"latitude": -32.8805195,
"longitude": -71.4282433
},
{ "ssid": "Richon",
"password": "k4fPnmg5qnyf",
"latitude": -32.8805195,

View file

@ -82,9 +82,10 @@ void processLoRaPacket(String packet) {
bool queryMessage = false;
String aprsPacket, Sender, AddresseeAndMessage, Addressee, ackMessage, receivedMessage;
if (packet != "") {
Serial.print("Received Lora Packet : " + String(packet));
//Serial.print("Received Lora Packet : " + String(packet));
Serial.println(packet.substring(3));
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("TCPIP") == -1) && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
Serial.print(" ---> APRS LoRa Packet!");
//Serial.print(" ---> APRS LoRa Packet!");
Sender = packet.substring(3,packet.indexOf(">"));
if (Sender != Config.callsign) { // avoid listening yourself by digirepeating
if (stationMode == 2 || stationMode == 5) {
@ -97,7 +98,7 @@ void processLoRaPacket(String packet) {
ackMessage = "ack" + AddresseeAndMessage.substring(AddresseeAndMessage.indexOf("{")+1);
ackMessage.trim();
delay(4000);
Serial.println(ackMessage);
//Serial.println(ackMessage);
for(int i = Sender.length(); i < 9; i++) {
Sender += ' ';
}
@ -126,14 +127,14 @@ void processLoRaPacket(String packet) {
}
lastScreenOn = millis();
espClient.write(aprsPacket.c_str());
Serial.println(" ---> Uploaded to APRS-IS");
//Serial.println(" ---> Uploaded to APRS-IS");
STATION_Utils::updateLastHeard(Sender);
Utils::typeOfPacket(aprsPacket, "LoRa-APRS");
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
}
}
} else {
Serial.println(" ---> LoRa Packet Ignored (first 3 bytes or TCPIP/NOGATE/RFONLY)\n");
//Serial.println(" ---> LoRa Packet Ignored (first 3 bytes or TCPIP/NOGATE/RFONLY)\n");
}
}
}
@ -151,7 +152,7 @@ void processAPRSISPacket(String packet) {
String ackMessage = "ack" + AddresseeAndMessage.substring(AddresseeAndMessage.indexOf("{")+1);
ackMessage.trim();
delay(4000);
Serial.println(ackMessage);
//Serial.println(ackMessage);
for(int i = Sender.length(); i < 9; i++) {
Sender += ' ';
}
@ -162,9 +163,9 @@ void processAPRSISPacket(String packet) {
receivedMessage = AddresseeAndMessage.substring(AddresseeAndMessage.indexOf(":")+1);
}
if (receivedMessage.indexOf("?") == 0) {
Serial.println("Received Query APRS-IS : " + packet);
//Serial.println("Received Query APRS-IS : " + packet);
String queryAnswer = QUERY_Utils::process(receivedMessage, Sender, "APRSIS");
Serial.println("---> QUERY Answer : " + queryAnswer.substring(0,queryAnswer.indexOf("\n")));
//Serial.println("---> QUERY Answer : " + queryAnswer.substring(0,queryAnswer.indexOf("\n")));
if (!Config.display.alwaysOn) {
display_toggle(true);
}
@ -180,7 +181,7 @@ void processAPRSISPacket(String packet) {
seventhLine = "QUERY = " + receivedMessage;
}
} else {
Serial.print("Received from APRS-IS : " + packet);
//Serial.print("Received from APRS-IS : " + packet);
if ((stationMode==2 || stationMode==5) && STATION_Utils::wasHeard(Addressee)) {
LoRa_Utils::sendNewPacket("APRS", LoRa_Utils::generatePacket(packet));
display_toggle(true);

View file

@ -40,9 +40,15 @@ namespace DIGI_Utils {
espClient.write(APRS_IS_Utils::createPacket(packet).c_str());
Serial.print("(Uploaded to APRS-IS)");
}
loraPacket = packet.substring(3);
//loraPacket = packet.substring(3);
//
loraPacket = packet.substring(3) + " test sM6";
//
loraPacket.replace("WIDE1-1", Config.callsign + "*");
delay(500);
//delay(500);
//
delay(5000);
//
LoRa_Utils::sendNewPacket("APRS", loraPacket);
display_toggle(true);
lastScreenOn = millis();

View file

@ -128,7 +128,7 @@ String decodeEncodedGPS(String packet) {
int X4 = int(encodedLongtitude[3]);
float decodedLongitude = -180.0 + ((((X1-33) * pow(91,3)) + ((X2-33) * pow(91,2)) + ((X3-33) * 91) + X4-33) / 190463.0);
distance = String(calculateDistanceTo(decodedLatitude, decodedLongitude),1);
return String(decodedLatitude) + "N / " + String(decodedLongitude) + "E / " + distance + "km";
return String(decodedLatitude,5) + "N / " + String(decodedLongitude,5) + "E / " + distance + "km";
}
String getReceivedGPS(String packet) {
@ -160,7 +160,7 @@ String getReceivedGPS(String packet) {
convertedLongitude = -convertedLongitude;
}
distance = String(calculateDistanceTo(convertedLatitude, convertedLongitude),1);
return String(convertedLatitude) + "N / " + String(convertedLongitude) + "E / " + distance + "km";
return String(convertedLatitude,5) + "N / " + String(convertedLongitude,5) + "E / " + distance + "km";
}
String getDistance(String packet) {

View file

@ -73,7 +73,7 @@ String receivePacket() {
rssi = LoRa.packetRssi();
snr = LoRa.packetSnr();
freqError = LoRa.packetFrequencyError();
Serial.println("(RSSI:" +String(rssi) + " / SNR:" + String(snr) + " / FreqErr:" + String(freqError) + ")");
//Serial.println("(RSSI:" +String(rssi) + " / SNR:" + String(snr) + " / FreqErr:" + String(freqError) + ")");
if (Config.syslog.active && (stationMode==1 || stationMode==2)) {
SYSLOG_Utils::log("LoRa Rx", loraPacket, rssi, snr, freqError);
}