mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-01-21 16:20:15 +01:00
testing new Syslog Comments info
This commit is contained in:
parent
2496c12763
commit
916cbade8c
|
|
@ -66,9 +66,10 @@ namespace GPS_Utils {
|
|||
}
|
||||
|
||||
String decodeEncodedGPS(const String& packet) {
|
||||
String GPSPacket = packet.substring(packet.indexOf(":!")+3);
|
||||
String encodedLatitude = GPSPacket.substring(0,4);
|
||||
String encodedLongtitude = GPSPacket.substring(4,8);
|
||||
String GPSPacket = packet.substring(packet.indexOf(":!")+3);
|
||||
String encodedLatitude = GPSPacket.substring(0,4);
|
||||
String encodedLongtitude = GPSPacket.substring(4,8);
|
||||
String comment = GPSPacket.substring(13);
|
||||
|
||||
int Y1 = int(encodedLatitude[0]);
|
||||
int Y2 = int(encodedLatitude[1]);
|
||||
|
|
@ -82,7 +83,11 @@ namespace GPS_Utils {
|
|||
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,5) + "N / " + String(decodedLongitude,5) + "E / " + distance + "km";
|
||||
if (comment != "") {
|
||||
return String(decodedLatitude,5) + "N / " + String(decodedLongitude,5) + "E / " + distance + "km / " + comment;
|
||||
} else {
|
||||
return String(decodedLatitude,5) + "N / " + String(decodedLongitude,5) + "E / " + distance + "km";
|
||||
}
|
||||
}
|
||||
|
||||
String getReceivedGPS(const String& packet) {
|
||||
|
|
@ -94,6 +99,7 @@ namespace GPS_Utils {
|
|||
}
|
||||
String Latitude = infoGPS.substring(0,8);
|
||||
String Longitude = infoGPS.substring(9,18);
|
||||
String comment = infoGPS.substring(19);
|
||||
|
||||
float convertedLatitude, convertedLongitude;
|
||||
String firstLatPart = Latitude.substring(0,2);
|
||||
|
|
@ -114,10 +120,14 @@ namespace GPS_Utils {
|
|||
convertedLongitude = -convertedLongitude;
|
||||
}
|
||||
distance = String(calculateDistanceTo(convertedLatitude, convertedLongitude),1);
|
||||
return String(convertedLatitude,5) + "N / " + String(convertedLongitude,5) + "E / " + distance + "km";
|
||||
}
|
||||
if (comment != "") {
|
||||
return String(convertedLatitude,5) + "N / " + String(convertedLongitude,5) + "E / " + distance + "km / " + comment;
|
||||
} else {
|
||||
return String(convertedLatitude,5) + "N / " + String(convertedLongitude,5) + "E / " + distance + "km";
|
||||
}
|
||||
}
|
||||
|
||||
String getDistance(const String& packet) {
|
||||
String getDistanceAndComment(const String& packet) {
|
||||
uint8_t encodedBytePosition = 0;
|
||||
if (packet.indexOf(":!") > 10) {
|
||||
encodedBytePosition = packet.indexOf(":!") + 14;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace GPS_Utils {
|
|||
double calculateDistanceCourse(double latitude, double longitude);
|
||||
String decodeEncodedGPS(const String& packet);
|
||||
String getReceivedGPS(const String& packet);
|
||||
String getDistance(const String& packet);
|
||||
String getDistanceAndComment(const String& packet);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace SYSLOG_Utils {
|
|||
} else {
|
||||
syslogPacket += packet.substring(packet.indexOf(">")+1,packet.indexOf(":")) + " / - / ";
|
||||
}
|
||||
syslogPacket += String(rssi) + "dBm / " + String(snr) + "dB / " + String(freqError) + "Hz / " + GPS_Utils::getDistance(packet);
|
||||
syslogPacket += String(rssi) + "dBm / " + String(snr) + "dB / " + String(freqError) + "Hz / " + GPS_Utils::getDistanceAndComment(packet);
|
||||
} else if (packet.indexOf(":>") > 10) {
|
||||
syslogPacket += type + " / STATUS / " + packet.substring(3,packet.indexOf(">")) + " ---> " + packet.substring(packet.indexOf(":>")+2);
|
||||
syslogPacket += " / " + String(rssi) + "dBm / " + String(snr) + "dB / " + String(freqError) + "Hz";
|
||||
|
|
|
|||
|
|
@ -218,7 +218,9 @@ namespace Utils {
|
|||
seventhLine = "RSSI:" + String(rssi) + "dBm SNR: " + String(snr) + "dBm";
|
||||
} else if (packet.indexOf(":!") >= 10 || packet.indexOf(":=") >= 10) {
|
||||
sixthLine = sender + "> GPS BEACON";
|
||||
GPS_Utils::getDistance(packet);
|
||||
if (!Config.syslog.active) {
|
||||
GPS_Utils::getDistanceAndComment(packet); // to be checked!!!
|
||||
}
|
||||
seventhLine = "RSSI:" + String(rssi) + "dBm";
|
||||
if (rssi <= -100) {
|
||||
seventhLine += " ";
|
||||
|
|
|
|||
Loading…
Reference in a new issue