X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosTelemetryLocation.java;h=85da27d5b8642aec301eef9fc895d2ed96432f59;hb=4e53a5da5a8921829a3bb290e7c051950a66ab75;hp=fa3c24d03a192cc96508d32bb1b70ebe84c6feca;hpb=77dc89ed5b7bf8f5b3fa3b6131660f1a98f583ea;p=fw%2Faltos diff --git a/altoslib/AltosTelemetryLocation.java b/altoslib/AltosTelemetryLocation.java index fa3c24d0..85da27d5 100644 --- a/altoslib/AltosTelemetryLocation.java +++ b/altoslib/AltosTelemetryLocation.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_1; +package org.altusmetrum.altoslib_6; public class AltosTelemetryLocation extends AltosTelemetryStandard { @@ -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,11 +58,16 @@ 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) { super.update_state(state); - AltosGPS gps = state.make_temp_gps(); + AltosGPS gps = state.make_temp_gps(false); gps.nsat = flags & 0xf; gps.locked = (flags & (1 << 4)) != 0; @@ -80,8 +86,9 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard { gps.ground_speed = ground_speed * 1.0e-2; gps.course = course * 2; gps.climb_rate = climb_rate * 1.0e-2; - gps.hdop = hdop; - gps.vdop = vdop; + gps.pdop = pdop / 10.0; + gps.hdop = hdop / 10.0; + gps.vdop = vdop / 10.0; } state.set_temp_gps(); }