summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
629a763)
When reading the eeprom, any parsing errors (most likely bad
checksums) indicate some kind of problem with either the hardware or
the flight software. Display these to the user and do not erase the
flight.
Signed-off-by: Keith Packard <keithp@keithp.com>
double lon;
boolean has_time;
int hour, minute, second;
double lon;
boolean has_time;
int hour, minute, second;
+ ParseException parse_exception = null;
public AltosEepromBlock (AltosSerial serial_line, int block) throws TimeoutException, InterruptedException {
int addr;
public AltosEepromBlock (AltosSerial serial_line, int block) throws TimeoutException, InterruptedException {
int addr;
} catch (ParseException pe) {
AltosEepromRecord r = new AltosEepromRecord(Altos.AO_LOG_INVALID,
0, 0, 0);
} catch (ParseException pe) {
AltosEepromRecord r = new AltosEepromRecord(Altos.AO_LOG_INVALID,
0, 0, 0);
+ if (parse_exception == null)
+ parse_exception = pe;
if (!done)
add(addr/8, r);
}
if (!done)
add(addr/8, r);
}
AltosEepromList flights;
ActionListener listener;
boolean success;
AltosEepromList flights;
ActionListener listener;
boolean success;
+ ParseException parse_exception;
private void FlushPending() throws IOException {
for (String s : flights.config_data) {
private void FlushPending() throws IOException {
for (String s : flights.config_data) {
+ if (parse_exception == null && eeblock.parse_exception != null)
+ parse_exception = eeblock.parse_exception;
+
CheckFile(false);
for (record = 0; record < eeblock.size(); record++) {
AltosEepromRecord r = eeblock.get(record);
CheckFile(false);
for (record = 0; record < eeblock.size(); record++) {
AltosEepromRecord r = eeblock.get(record);
- String log_line = String.format("%c %4x %4x %4x\n",
- r.cmd, r.tick, r.a, r.b);
- if (eeprom_file != null)
- eeprom_file.write(log_line);
- else
- eeprom_pending.add(log_line);
+ if (r.cmd != Altos.AO_LOG_INVALID) {
+ String log_line = String.format("%c %4x %4x %4x\n",
+ r.cmd, r.tick, r.a, r.b);
+ if (eeprom_file != null)
+ eeprom_file.write(log_line);
+ else
+ eeprom_pending.add(log_line);
+ }
- private void show_error_internal(String message, String title) {
+ private void show_message_internal(String message, String title, int message_type) {
JOptionPane.showMessageDialog(frame,
message,
title,
JOptionPane.showMessageDialog(frame,
message,
title,
- JOptionPane.ERROR_MESSAGE);
- private void show_error(String in_message, String in_title) {
+ private void show_message(String in_message, String in_title, int in_message_type) {
final String message = in_message;
final String title = in_title;
final String message = in_message;
final String title = in_title;
+ final int message_type = in_message_type;
Runnable r = new Runnable() {
public void run() {
try {
Runnable r = new Runnable() {
public void run() {
try {
- show_error_internal(message, title);
+ show_message_internal(message, title, message_type);
} catch (Exception ex) {
}
}
} catch (Exception ex) {
}
}
serial_line.start_remote();
try {
serial_line.start_remote();
try {
+ boolean failed = false;
for (AltosEepromLog log : flights) {
for (AltosEepromLog log : flights) {
+ parse_exception = null;
if (log.download) {
monitor.reset();
CaptureLog(log);
}
if (log.download) {
monitor.reset();
CaptureLog(log);
}
+ if (parse_exception != null) {
+ failed = true;
+ show_message(String.format("Flight %d download error\n%s\nValid log data saved",
+ log.flight,
+ parse_exception.getMessage()),
+ serial_line.device.toShortString(),
+ JOptionPane.WARNING_MESSAGE);
+ }
} catch (IOException ee) {
} catch (IOException ee) {
- show_error (serial_line.device.toShortString(),
- ee.getLocalizedMessage());
+ show_message(ee.getLocalizedMessage(),
+ serial_line.device.toShortString(),
+ JOptionPane.ERROR_MESSAGE);
} catch (InterruptedException ie) {
} catch (TimeoutException te) {
} catch (InterruptedException ie) {
} catch (TimeoutException te) {
- show_error (String.format("Connection to \"%s\" failed",
- serial_line.device.toShortString()),
- "Connection Failed");
+ show_message(String.format("Connection to \"%s\" failed",
+ serial_line.device.toShortString()),
+ "Connection Failed",
+ JOptionPane.ERROR_MESSAGE);
}
if (remote)
serial_line.stop_remote();
}
if (remote)
serial_line.stop_remote();