summaryrefslogtreecommitdiff
path: root/altoslib/AltosTelemetryLocation.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-07-10 17:10:49 -0700
committerKeith Packard <keithp@keithp.com>2014-07-10 17:35:44 -0700
commited2a08c50d6b8ebcc8c1d2f15e73c1f2a1e25041 (patch)
tree201873b16557375d3204b2e9c79038ae899c3e7f /altoslib/AltosTelemetryLocation.java
parent34d5be68ca23e8beb05db9a480faef63ecc911d0 (diff)
altoslib: Handle wide GPS altitude values in eeprom and telemetry
Detect when the wider data is present and handle it correctly Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosTelemetryLocation.java')
-rw-r--r--altoslib/AltosTelemetryLocation.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/altoslib/AltosTelemetryLocation.java b/altoslib/AltosTelemetryLocation.java
index 9d50e2fa..427ae16e 100644
--- a/altoslib/AltosTelemetryLocation.java
+++ b/altoslib/AltosTelemetryLocation.java
@@ -37,11 +37,12 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard {
int climb_rate;
int course;
+ public static final int AO_GPS_MODE_ALTITUDE_24 = (1 << 0); /* Reports 24-bits of altitude */
+
public AltosTelemetryLocation(int[] bytes) {
super(bytes);
flags = uint8(5);
- altitude = int16(6);
latitude = uint32(8);
longitude = uint32(12);
year = uint8(16);
@@ -57,6 +58,11 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard {
ground_speed = uint16(26);
climb_rate = int16(28);
course = uint8(30);
+
+ if ((mode & AO_GPS_MODE_ALTITUDE_24) != 0) {
+ altitude = (int8(31) << 16) | uint16(6);
+ } else
+ altitude = int16(6);
}
public void update_state(AltosState state) {