diff options
author | Keith Packard <keithp@keithp.com> | 2014-06-11 18:48:11 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-06-11 18:48:11 -0700 |
commit | a8325483adb8d9ffda62d3f4900cf52bde70ff62 (patch) | |
tree | c567d87873a137cad9feecfc5b86cdda964062f8 /altoslib/AltosEepromGPS.java | |
parent | db2443fdbf65b65703217174303027c439124a83 (diff) |
altoslib: Use GPS seconds as an additional sort key for TeleGPS eeprom
Long idle periods with TeleGPS can easily overflow 16 bits of tick
count. Using the GPS seconds provides an additional sort which will
span the tick wrap-around.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosEepromGPS.java')
-rw-r--r-- | altoslib/AltosEepromGPS.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/altoslib/AltosEepromGPS.java b/altoslib/AltosEepromGPS.java index 1820cd61..3c1852c0 100644 --- a/altoslib/AltosEepromGPS.java +++ b/altoslib/AltosEepromGPS.java @@ -53,6 +53,17 @@ public class AltosEepromGPS extends AltosEeprom { public int vdop() { return data8(24); } public int mode() { return data8(25); } + public boolean has_seconds() { return cmd == AltosLib.AO_LOG_GPS_TIME; } + + public int seconds() { + switch (cmd) { + case AltosLib.AO_LOG_GPS_TIME: + return second() + 60 * (minute() + 60 * (hour() + 24 * (day() + 31 * month()))); + default: + return 0; + } + } + public AltosEepromGPS (AltosEepromChunk chunk, int start) throws ParseException { parse_chunk(chunk, start); } |