summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-02-19 01:02:00 -0800
committerKeith Packard <keithp@keithp.com>2011-03-19 16:50:34 -0700
commit62fc5b2d33d4f64afff1f965ac52598ba9373bc0 (patch)
tree6d95e8e03e801866e758e8eba6636090b3ce5ca3
parent2bb83d90aa03d825ca1b751418c91b194b72f1f9 (diff)
altosui: Mark empty eeprom records 'invalid', don't generate exception
When reading empty eeprom records, mark them as 'invalid', but don't generate an exception as it's normal to read these at the end of the flight log. Signed-off-by: Keith Packard <keithp@keithp.com> (cherry picked from commit 7ca2cf1b7e03b8453b45b45e313a33ad65da9ad5)
-rw-r--r--altosui/AltosEepromRecord.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/altosui/AltosEepromRecord.java b/altosui/AltosEepromRecord.java
index 584a04b7..e5196c50 100644
--- a/altosui/AltosEepromRecord.java
+++ b/altosui/AltosEepromRecord.java
@@ -72,15 +72,24 @@ public class AltosEepromRecord {
if (values[0] != (addr & 0xff))
throw new ParseException(String.format("data address out of sync at 0x%x",
addr), 0);
- if (checksum(values) != 0)
- throw new ParseException(String.format("invalid checksum at 0x%x", addr), 0);
-
+ int i;
+ for (i = 1; i < values.length; i++)
+ if (values[i] != 0xff)
+ break;
cmd = values[1];
+ tick_valid = true;
+ if (i != values.length) {
+ if (checksum(values) != 0)
+ throw new ParseException(String.format("invalid checksum at 0x%x in line %s", addr, line), 0);
+ } else {
+ cmd = Altos.AO_LOG_INVALID;
+ tick_valid = false;
+ }
+
tick = values[3] + (values[4] << 8);
a = values[5] + (values[6] << 8);
b = values[7] + (values[8] << 8);
data = null;
- tick_valid = true;
}
public AltosEepromRecord (String line) {