X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosEepromDownload.java;h=6e2fd061b1cbef6afe1f6ef223a118b95a57782c;hb=5c4b3658a96f1a64ccebf7bddda06b15b4ac4a6f;hp=931b55fd087e1334b96a46a9e78eee293a18ce1a;hpb=77dc89ed5b7bf8f5b3fa3b6131660f1a98f583ea;p=fw%2Faltos diff --git a/altosui/AltosEepromDownload.java b/altosui/AltosEepromDownload.java index 931b55fd..6e2fd061 100644 --- a/altosui/AltosEepromDownload.java +++ b/altosui/AltosEepromDownload.java @@ -23,7 +23,7 @@ import java.io.*; import java.util.*; import java.text.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_1.*; +import org.altusmetrum.altoslib_2.*; public class AltosEepromDownload implements Runnable { @@ -61,9 +61,9 @@ public class AltosEepromDownload implements Runnable { AltosGPS gps = state.gps; if (gps != null && - gps.year != AltosRecord.MISSING && - gps.month != AltosRecord.MISSING && - gps.day != AltosRecord.MISSING) + gps.year != AltosLib.MISSING && + gps.month != AltosLib.MISSING && + gps.day != AltosLib.MISSING) { eeprom_name = new AltosFile(gps.year, gps.month, gps.day, state.serial, state.flight, "eeprom"); @@ -94,18 +94,26 @@ public class AltosEepromDownload implements Runnable { void CaptureEeprom(AltosEepromChunk eechunk, int log_format) throws IOException { boolean any_valid = false; + boolean got_flight = false; int record_length = 8; state.set_serial(flights.config_data.serial); + 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); + AltosEeprom r = eechunk.eeprom(i, log_format, state); + + if (r == null) + continue; record_length = r.record_length(); r.update_state(state); + if (!got_flight && state.flight != AltosLib.MISSING) + monitor.set_flight(state.flight); + /* Monitor state transitions to update display */ if (state.state != AltosLib.ao_flight_invalid && state.state <= AltosLib.ao_flight_landed) @@ -231,7 +239,10 @@ public class AltosEepromDownload implements Runnable { serial_line.device.toShortString(), JOptionPane.ERROR_MESSAGE); } catch (InterruptedException ie) { - System.out.printf("download interrupted\n"); + show_message(String.format("Connection to \"%s\" interrupted", + serial_line.device.toShortString()), + "Connection Interrupted", + JOptionPane.ERROR_MESSAGE); } catch (TimeoutException te) { show_message(String.format("Connection to \"%s\" failed", serial_line.device.toShortString()),