X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosEepromDelete.java;h=94951ced3758c66be524b980643d394accb98fe8;hb=81bb6f42d8b859195ea5a35806c42d98ba82e8e1;hp=c95eda153d5c5edc07eee944b0cd0324a7266d8d;hpb=8801b8c1947bd39f7c985b91a2ba8dbc81bcc91a;p=fw%2Faltos diff --git a/altosui/AltosEepromDelete.java b/altosui/AltosEepromDelete.java index c95eda15..94951ced 100644 --- a/altosui/AltosEepromDelete.java +++ b/altosui/AltosEepromDelete.java @@ -49,11 +49,9 @@ public class AltosEepromDelete implements Runnable { */ serial_line.flush_input(); serial_line.printf("d %d\n", log.flight); - System.out.printf("Attempt to delete flight %d\n", log.flight); for (;;) { /* It can take a while to erase the flash... */ String line = serial_line.get_reply(20000); - System.out.printf("got back line %s\n", line); if (line == null) throw new TimeoutException(); if (line.equals("Erased")) @@ -86,17 +84,16 @@ public class AltosEepromDelete implements Runnable { } public void run () { - if (remote) - serial_line.start_remote(); - success = false; try { + if (remote) + serial_line.start_remote(); + for (AltosEepromLog log : flights) { if (log.delete) { DeleteLog(log); } } - System.out.printf("All flights successfully deleted\n"); success = true; } catch (IOException ee) { show_error (ee.getLocalizedMessage(), @@ -106,11 +103,12 @@ public class AltosEepromDelete implements Runnable { show_error (String.format("Connection to \"%s\" failed", serial_line.device.toShortString()), "Connection Failed"); + } finally { + if (remote) + serial_line.stop_remote(); + serial_line.flush_output(); + serial_line.close(); } - if (remote) - serial_line.stop_remote(); - serial_line.flush_output(); - serial_line.close(); if (listener != null) { Runnable r = new Runnable() { public void run() {