mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-01-28 19:34:35 +01:00
gps distance correction when Overlay is not /
This commit is contained in:
parent
09eacd652d
commit
970fface06
|
|
@ -20,7 +20,7 @@
|
|||
Configuration Config;
|
||||
WiFiClient espClient;
|
||||
|
||||
String versionDate = "2023.08.05";
|
||||
String versionDate = "2023.08.15";
|
||||
int myWiFiAPIndex = 0;
|
||||
int myWiFiAPSize = Config.wifiAPs.size();
|
||||
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ double calculateDistanceTo(double latitude, double longitude) {
|
|||
}
|
||||
|
||||
String decodeEncodedGPS(String packet) {
|
||||
String GPSPacket = packet.substring(packet.indexOf(":!/")+3);
|
||||
String GPSPacket = packet.substring(packet.indexOf(":!")+3);
|
||||
String encodedLatitude = GPSPacket.substring(0,4);
|
||||
String encodedLongtitude = GPSPacket.substring(4,8);
|
||||
|
||||
|
|
@ -160,10 +160,15 @@ String getReceivedGPS(String packet) {
|
|||
}
|
||||
|
||||
String getDistance(String packet) {
|
||||
int gpsIndexEx = packet.indexOf(":!");
|
||||
int gpsIndexEq = packet.indexOf(":=");
|
||||
if (gpsIndexEx > 10 || gpsIndexEq > 10) {
|
||||
if ((gpsIndexEx + 15 == packet.indexOf("G")) || (gpsIndexEx + 15 == packet.indexOf("Q")) || (gpsIndexEq + 15 == packet.indexOf("G")) || (gpsIndexEq + 15 == packet.indexOf("Q"))) {
|
||||
int encodedBytePosition = 0;
|
||||
if (packet.indexOf(":!") > 10) {
|
||||
encodedBytePosition = packet.indexOf(":!") + 14;
|
||||
}
|
||||
if (packet.indexOf(":=") > 10) {
|
||||
encodedBytePosition = packet.indexOf(":=") + 14;
|
||||
}
|
||||
if (encodedBytePosition != 0) {
|
||||
if (String(packet[encodedBytePosition]) == "G" || String(packet[encodedBytePosition]) == "Q") {
|
||||
return decodeEncodedGPS(packet);
|
||||
} else {
|
||||
return getReceivedGPS(packet);
|
||||
|
|
|
|||
Loading…
Reference in a new issue