From def3ba9d6666f589b853e662efb81e9e25c1834a Mon Sep 17 00:00:00 2001 From: Damjan Adamic Date: Thu, 6 Oct 2016 10:50:33 +0200 Subject: [PATCH] S-PORT GPS parsing was wrong: latitude and longitude were exchanged with each other Telemetry simulator latitude and longitude were exchanged with each other (reverted from commit e7f6d321dd41f7281bad39927b5167b1fda0e907) --- companion/src/simulation/telemetrysimu.cpp | 6 +++--- radio/src/telemetry/frsky_sport.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/companion/src/simulation/telemetrysimu.cpp b/companion/src/simulation/telemetrysimu.cpp index 229d2ab95..f36e95ab3 100644 --- a/companion/src/simulation/telemetrysimu.cpp +++ b/companion/src/simulation/telemetrysimu.cpp @@ -496,11 +496,11 @@ TelemetrySimulator::GPSEmulator::GPSEmulator() uint32_t TelemetrySimulator::GPSEmulator::encodeLatLon(double latLon, bool isLat) { uint32_t data = (uint32_t)((latLon < 0 ? -latLon : latLon) * 60 * 10000) & 0x3FFFFFFF; - if (isLat) { - data |= (1 << 31); + if (isLat == false) { + data |= 0x80000000; } if (latLon < 0) { - data |= (1 << 30); + data |= 0x40000000; } return data; } diff --git a/radio/src/telemetry/frsky_sport.cpp b/radio/src/telemetry/frsky_sport.cpp index 7e62b73d2..be3df1bc3 100644 --- a/radio/src/telemetry/frsky_sport.cpp +++ b/radio/src/telemetry/frsky_sport.cpp @@ -173,9 +173,9 @@ void sportProcessTelemetryPacket(uint8_t * packet) value = -value; value = (value * 5) / 3; // min/10000 => deg/1000000 if (data & (1 << 31)) - sportProcessTelemetryPacket(id, 0, instance, value, UNIT_GPS_LATITUDE); - else sportProcessTelemetryPacket(id, 0, instance, value, UNIT_GPS_LONGITUDE); + else + sportProcessTelemetryPacket(id, 0, instance, value, UNIT_GPS_LATITUDE); } else if (id >= RBOX_BATT1_FIRST_ID && id <= RBOX_BATT2_LAST_ID) { sportProcessTelemetryPacket(id, 0, instance, data & 0xffff);