From 0a898a40e61b0d3f9d209d67d6ee58d54c3513bf Mon Sep 17 00:00:00 2001 From: "Ricardo Guzman (Richonguzman)" Date: Sun, 28 Dec 2025 11:46:43 -0300 Subject: [PATCH] gps payload decoding fix2 --- src/gps_utils.cpp | 21 ++++++++++----------- src/wifi_utils.cpp | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/gps_utils.cpp b/src/gps_utils.cpp index b9b6f30..d044a9c 100644 --- a/src/gps_utils.cpp +++ b/src/gps_utils.cpp @@ -57,7 +57,7 @@ namespace GPS_Utils { String encodedGPS = APRSPacketLib::encodeGPSIntoBase91(Config.beacon.latitude, Config.beacon.longitude, 0, 0, Config.beacon.symbol, false, 0, true, Config.beacon.ambiguityLevel); iGateBeaconPacket = beaconPacket; - iGateBeaconPacket += ",qAC:!"; + iGateBeaconPacket += ",qAC:="; iGateBeaconPacket += Config.beacon.overlay; iGateBeaconPacket += encodedGPS; @@ -132,7 +132,7 @@ namespace GPS_Utils { convertedLongitude += Longitude.substring(3,5).toFloat() / 60; // Next 2 digits (Minutes) convertedLongitude += Longitude.substring(Longitude.indexOf(".") + 1, Longitude.indexOf(".") + 3).toFloat() / (60*100); if (Longitude.endsWith("W")) convertedLongitude = -convertedLongitude; // Handle Western Hemisphere - + return buildDistanceAndComment(convertedLatitude, convertedLongitude, infoGPS.substring(19)); } @@ -159,15 +159,14 @@ namespace GPS_Utils { int encondedByteIndex = baseIndex + encondedByteOffset; int packetLength = packet.length(); - if (latitudeIndex >= packetLength || longitudeIndex >= packetLength || encondedByteIndex >= packetLength) return " _ / _ / _ "; - - char latChar = packet[latitudeIndex]; - char lngChar = packet[longitudeIndex]; - if ((latChar == 'N' || latChar == 'S') && (lngChar == 'E' || lngChar == 'W')) return getReceivedGPS(packet); - - char byteChar = packet[encondedByteIndex]; - if (byteChar == 'G' || byteChar == 'Q' || byteChar == '[' || byteChar == 'H' || byteChar == 'X' || byteChar == '3') return decodeEncodedGPS(packet); - + if (latitudeIndex < packetLength && longitudeIndex < packetLength) { + char latChar = packet[latitudeIndex]; + char lngChar = packet[longitudeIndex]; + if ((latChar == 'N' || latChar == 'S') && (lngChar == 'E' || lngChar == 'W')) return getReceivedGPS(packet); + } else if (encondedByteIndex < packetLength) { + char byteChar = packet[encondedByteIndex]; + if (byteChar == 'G' || byteChar == 'Q' || byteChar == '[' || byteChar == 'H' || byteChar == 'X' || byteChar == '3') return decodeEncodedGPS(packet); + } return " _ / _ / _ "; } diff --git a/src/wifi_utils.cpp b/src/wifi_utils.cpp index 33d2e94..acb291a 100644 --- a/src/wifi_utils.cpp +++ b/src/wifi_utils.cpp @@ -98,7 +98,7 @@ namespace WIFI_Utils { delay(500); unsigned long start = millis(); displayShow("", "Connecting to WiFi:", "", currentWiFi->ssid + " ...", 0); - Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ..."); + Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.print("' "); WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str()); while (WiFi.status() != WL_CONNECTED && wifiCounter