X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altoslib%2FAltosEepromGPS.java;h=e76b36dde0f0492f004e4633b394a02c030fb8bf;hp=46a2173de6063c08211789598df215241c1178f2;hb=1085ec5d57e0ed5d132f2bbdac1a0b6a32c0ab4a;hpb=b8fa4e9a077e8e04b922d0c434c139ad0a57ee66 diff --git a/altoslib/AltosEepromGPS.java b/altoslib/AltosEepromGPS.java index 46a2173d..e76b36dd 100644 --- a/altoslib/AltosEepromGPS.java +++ b/altoslib/AltosEepromGPS.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,7 +16,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_5; +package org.altusmetrum.altoslib_11; import java.io.*; import java.util.*; @@ -37,7 +38,7 @@ public class AltosEepromGPS extends AltosEeprom { /* AO_LOG_GPS_TIME elements */ public int latitude() { return data32(0); } public int longitude() { return data32(4); } - public int altitude() { return data16(8); } + public int altitude_low() { return data16(8); } public int hour() { return data8(10); } public int minute() { return data8(11); } public int second() { return data8(12); } @@ -52,6 +53,7 @@ public class AltosEepromGPS extends AltosEeprom { public int hdop() { return data8(23); } public int vdop() { return data8(24); } public int mode() { return data8(25); } + public int altitude_high() { return data16(26); } public boolean has_seconds() { return cmd == AltosLib.AO_LOG_GPS_TIME; } @@ -90,8 +92,10 @@ public class AltosEepromGPS extends AltosEeprom { switch (cmd) { case AltosLib.AO_LOG_FLIGHT: - state.set_boost_tick(tick); - state.set_flight(flight()); + if (state.flight == AltosLib.MISSING) { + state.set_boost_tick(tick); + state.set_flight(flight()); + } /* no place to log start lat/lon yet */ break; case AltosLib.AO_LOG_GPS_TIME: @@ -99,7 +103,10 @@ public class AltosEepromGPS extends AltosEeprom { gps = state.make_temp_gps(false); gps.lat = latitude() / 1e7; gps.lon = longitude() / 1e7; - gps.alt = altitude(); + if (state.altitude_32()) + gps.alt = (altitude_low() & 0xffff) | (altitude_high() << 16); + else + gps.alt = altitude_low(); gps.hour = hour(); gps.minute = minute();