From e7954c820763f80e993f9f822e837725cf36af84 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 20 Nov 2010 22:03:26 -0800 Subject: [PATCH] altosui: When fixing eeprom gps time information, make GPS data valid Eeprom files may be missing the GPS time (due to a firmware bug). Working around this involves finding the next valid GPS time and using that to create a fake GPS time entry. However, that next GPS time may not be locked or may have few sats as it is from the boost stage of the flight. Fix this by simply forcing the fake time packet to have 4 sats and be locked. Signed-off-by: Keith Packard --- ao-tools/altosui/AltosEepromIterable.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ao-tools/altosui/AltosEepromIterable.java b/ao-tools/altosui/AltosEepromIterable.java index fc683321..f8e6d7e5 100644 --- a/ao-tools/altosui/AltosEepromIterable.java +++ b/ao-tools/altosui/AltosEepromIterable.java @@ -309,6 +309,12 @@ public class AltosEepromIterable extends AltosRecordIterable { int flags = (good.b >> 8); int seconds = hour * 3600 + minute * 60 + second; + /* Make sure this looks like a good GPS value */ + if ((flags & Altos.AO_GPS_NUM_SAT_MASK) >> Altos.AO_GPS_NUM_SAT_SHIFT < 4) + flags = (flags & ~Altos.AO_GPS_NUM_SAT_MASK) | (4 << Altos.AO_GPS_NUM_SAT_SHIFT); + flags |= Altos.AO_GPS_RUNNING; + flags |= Altos.AO_GPS_VALID; + int new_seconds = seconds + diff; if (new_seconds < 0) new_seconds += 24 * 3600; -- 2.30.2