summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-09-21 07:01:19 +0100
committerKeith Packard <keithp@keithp.com>2015-10-13 13:54:28 -0700
commit926522c6791c2a5529ea24ebd67eea45350e3526 (patch)
tree0a861b1268e142ea8ed328681e5fff3a4765e901
parent431c713389dc819d2433d893c898ff82c7941722 (diff)
altoslib: Keep downloading when a parse error occurs
Eventually, we'll hit a block with no valid data and give up. Until then, keep going in case the flight computer glitched and wrote bad data. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altoslib/AltosEepromDownload.java28
1 files changed, 21 insertions, 7 deletions
diff --git a/altoslib/AltosEepromDownload.java b/altoslib/AltosEepromDownload.java
index c4ddb0e7..594f053f 100644
--- a/altoslib/AltosEepromDownload.java
+++ b/altoslib/AltosEepromDownload.java
@@ -35,7 +35,7 @@ public class AltosEepromDownload implements Runnable {
AltosEepromList flights;
boolean success;
- ParseException parse_exception;
+ String parse_errors;
AltosState state;
private void FlushPending() throws IOException {
@@ -88,6 +88,13 @@ public class AltosEepromDownload implements Runnable {
}
}
+ void LogError(String error) {
+ if (parse_errors != null)
+ parse_errors.concat(error.concat("\n"));
+ else
+ parse_errors = error;
+ }
+
void CaptureEeprom(AltosEepromChunk eechunk, int log_format) throws IOException, ParseException {
boolean any_valid = false;
boolean got_flight = false;
@@ -98,7 +105,14 @@ public class AltosEepromDownload implements Runnable {
monitor.set_serial(flights.config_data.serial);
for (int i = 0; i < AltosEepromChunk.chunk_size && !done; i += record_length) {
- AltosEeprom r = eechunk.eeprom(i, log_format, state);
+ AltosEeprom r = null;
+
+ try {
+ r = eechunk.eeprom(i, log_format, state);
+ } catch (ParseException pe) {
+ LogError(pe.getMessage());
+ r = null;
+ }
if (r == null)
continue;
@@ -193,25 +207,25 @@ public class AltosEepromDownload implements Runnable {
link.start_remote();
for (AltosEepromLog log : flights) {
- parse_exception = null;
+ parse_errors = null;
if (log.selected) {
monitor.reset();
eeprom_file = null;
try {
CaptureLog(log);
} catch (ParseException e) {
- parse_exception = e;
+ LogError(e.getMessage());
}
if (eeprom_file != null) {
eeprom_file.flush();
eeprom_file.close();
}
}
- if (parse_exception != null) {
+ if (parse_errors != null) {
failed = true;
- monitor.show_message(String.format("Flight %d download error\n%s\nValid log data saved",
+ monitor.show_message(String.format("Flight %d download error. Valid log data saved\n%s",
log.flight,
- parse_exception.getMessage()),
+ parse_errors),
link.name,
AltosEepromMonitor.WARNING_MESSAGE);
}