X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosFlashUI.java;h=296ad8ef9d761997aebf142704e1d4c6b5adde0a;hb=39cb8c2896317b7538353be979ac99baffc14489;hp=5ec5ea8a2bc49a645640a05d8b3d2c1e09afa0a8;hpb=710343a23c7e6e9c079eafdf3aeea8a40cc2ce61;p=fw%2Faltos diff --git a/altosui/AltosFlashUI.java b/altosui/AltosFlashUI.java index 5ec5ea8a..296ad8ef 100644 --- a/altosui/AltosFlashUI.java +++ b/altosui/AltosFlashUI.java @@ -69,9 +69,18 @@ public class AltosFlashUI }; private boolean is_pair_programmed() { - String name = file.getName(); - for (int i = 0; i < pair_programmed.length; i++) { - if (name.startsWith(pair_programmed[i])) + + if (file != null) { + String name = file.getName(); + for (int i = 0; i < pair_programmed.length; i++) { + if (name.startsWith(pair_programmed[i])) + return true; + } + } + if (device != null) { + if (!device.matchProduct(AltosLib.product_altusmetrum) && + (device.matchProduct(AltosLib.product_teledongle) || + device.matchProduct(AltosLib.product_telebt))) return true; } return false; @@ -223,7 +232,7 @@ public class AltosFlashUI hexfile_chooser.addChoosableFileFilter(ihx_filter); hexfile_chooser.setFileFilter(ihx_filter); - if (!device.matchProduct(AltosLib.product_altusmetrum)) { + if (!is_pair_programmed() && !device.matchProduct(AltosLib.product_altusmetrum)) { for (int i = 0; i < filters.length; i++) { if (device != null && device.matchProduct(filters[i].product)) hexfile_chooser.setFileFilter(filters[i]); @@ -356,7 +365,7 @@ public class AltosFlashUI flash_task flasher; - private boolean open_device() { + private boolean open_device() throws InterruptedException { try { link = new AltosSerial(device); if (is_pair_programmed()) @@ -399,8 +408,12 @@ public class AltosFlashUI return; if (!select_source_file()) return; - if (!open_device()) + try { + if (!open_device()) + return; + } catch (InterruptedException ie) { return; + } build_dialog(); flash_task f = new flash_task(this); }