diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 53e1f84..21a4f0c 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -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]; diff --git a/src/gps_utils.cpp b/src/gps_utils.cpp index d0b40d4..b3567ef 100644 --- a/src/gps_utils.cpp +++ b/src/gps_utils.cpp @@ -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);