summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-20 22:03:26 -0800
committerKeith Packard <keithp@keithp.com>2010-11-20 22:03:26 -0800
commite7954c820763f80e993f9f822e837725cf36af84 (patch)
tree3867388ce3085b0c97ca3bfc634cc53c2c5a9519
parent84e570d8a8a52e0d358582135ec1b3a12be94c26 (diff)
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 <keithp@keithp.com>
-rw-r--r--ao-tools/altosui/AltosEepromIterable.java6
1 files changed, 6 insertions, 0 deletions
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;