summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-09-05 01:01:10 -0700
committerKeith Packard <keithp@keithp.com>2010-09-05 01:01:10 -0700
commit2d58f319a7c1a6a8ccc6a539722009996ba886ab (patch)
tree483e38ea4d594b7a6b2d892b8c4c0b79abe1dffb
parentb2aa689bf3d61e4a3ebe7c828162d1be20aad0f6 (diff)
altosui: Eeprom files contain only one date; save it.
While reading eeprom files, the GPS record is reconstructed each time the system sees the first GPS log item (the time field), but as the date isn't repeated, we need to copy it from the old GPS data record. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--ao-tools/altosui/AltosEepromReader.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/ao-tools/altosui/AltosEepromReader.java b/ao-tools/altosui/AltosEepromReader.java
index e2a780ac..ac54ff44 100644
--- a/ao-tools/altosui/AltosEepromReader.java
+++ b/ao-tools/altosui/AltosEepromReader.java
@@ -116,7 +116,7 @@ public class AltosEepromReader extends AltosReader {
if (last_reported)
return null;
last_reported = true;
- return state;
+ return new AltosRecord(state);
}
record = record_iterator.next();
@@ -167,7 +167,15 @@ public class AltosEepromReader extends AltosReader {
break;
case Altos.AO_LOG_GPS_TIME:
gps_tick = state.tick;
+ AltosGPS old = state.gps;
state.gps = new AltosGPS();
+
+ /* GPS date doesn't get repeated through the file */
+ if (old != null) {
+ state.gps.year = old.year;
+ state.gps.month = old.month;
+ state.gps.day = old.day;
+ }
state.gps.hour = (record.a & 0xff);
state.gps.minute = (record.a >> 8);
state.gps.second = (record.b & 0xff);
@@ -197,7 +205,7 @@ public class AltosEepromReader extends AltosReader {
}
break;
case Altos.AO_LOG_GPS_DATE:
- state.gps.year = record.a & 0xff;
+ state.gps.year = (record.a & 0xff) + 2000;
state.gps.month = record.a >> 8;
state.gps.day = record.b & 0xff;
break;
@@ -334,6 +342,8 @@ public class AltosEepromReader extends AltosReader {
AltosOrderedRecord record = new AltosOrderedRecord(line, index++, tick);
if (record == null)
break;
+ if (record.cmd == Altos.AO_LOG_INVALID)
+ continue;
tick = record.tick;
if (!saw_boost && record.cmd == Altos.AO_LOG_STATE &&
record.a >= Altos.ao_flight_boost)