X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Faltosui%2FAltosFlashUI.java;h=86f57a5fb3c862e755f1909c4310357e7b59bc09;hp=73a97a6b9177d29c073153bd32a4d37333a88607;hb=b16b873723ee3e5097e6725c59ce191119439ad7;hpb=5f2f6a8f9ba56be867888758848bc7f152ccbd47 diff --git a/ao-tools/altosui/AltosFlashUI.java b/ao-tools/altosui/AltosFlashUI.java index 73a97a6b..86f57a5f 100644 --- a/ao-tools/altosui/AltosFlashUI.java +++ b/ao-tools/altosui/AltosFlashUI.java @@ -75,17 +75,17 @@ public class AltosFlashUI AltosRomconfigUI romconfig_ui = new AltosRomconfigUI (frame); romconfig_ui.set(flash.romconfig()); - romconfig_ui.showDialog(); - - AltosRomconfig romconfig = romconfig_ui.romconfig(); - if (romconfig == null || !romconfig.valid()) - return; - flash.set_romconfig(romconfig); - serial_value.setText(String.format("%d", - flash.romconfig().serial_number)); - file_value.setText(file.toString()); - setVisible(true); - flash.flash(); + AltosRomconfig romconfig = romconfig_ui.showDialog(); + + if (romconfig != null && romconfig.valid()) { + flash.set_romconfig(romconfig); + serial_value.setText(String.format("%d", + flash.romconfig().serial_number)); + file_value.setText(file.toString()); + setVisible(true); + flash.flash(); + flash = null; + } } catch (FileNotFoundException ee) { JOptionPane.showMessageDialog(frame, "Cannot open image", @@ -97,6 +97,8 @@ public class AltosFlashUI file.toString(), JOptionPane.ERROR_MESSAGE); } catch (InterruptedException ie) { + } finally { + abort(); } dispose(); } @@ -185,13 +187,17 @@ public class AltosFlashUI build_dialog(); - debug_dongle = AltosDeviceDialog.show(frame, AltosDevice.Any); + debug_dongle = AltosDeviceDialog.show(frame, AltosDevice.product_any); if (debug_dongle == null) return; JFileChooser hexfile_chooser = new JFileChooser(); + File firmwaredir = AltosPreferences.firmwaredir(); + if (firmwaredir != null) + hexfile_chooser.setCurrentDirectory(firmwaredir); + hexfile_chooser.setDialogTitle("Select Flash Image"); hexfile_chooser.setFileFilter(new FileNameExtensionFilter("Flash Image", "ihx")); int returnVal = hexfile_chooser.showOpenDialog(frame); @@ -201,6 +207,9 @@ public class AltosFlashUI file = hexfile_chooser.getSelectedFile(); + if (file != null) + AltosPreferences.set_firmwaredir(file.getParentFile()); + thread = new Thread(this); thread.start(); }