X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosuilib%2FAltosFlashUI.java;h=da36397abc7f7bda1c46ab3e81482d1a8cba2f0c;hb=c296acd643698d0128e2f58f91a9cfeea63f580a;hp=2e80bcbb820337ec488db45866efd8d3756573ea;hpb=df47839824dd4e708c22fbf8f4a3054b9c45b9c3;p=fw%2Faltos diff --git a/altosuilib/AltosFlashUI.java b/altosuilib/AltosFlashUI.java index 2e80bcbb..da36397a 100644 --- a/altosuilib/AltosFlashUI.java +++ b/altosuilib/AltosFlashUI.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,7 +16,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_3; +package org.altusmetrum.altosuilib_11; import java.awt.*; import java.awt.event.*; @@ -23,7 +24,7 @@ import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import java.io.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altoslib_11.*; public class AltosFlashUI extends AltosUIDialog @@ -54,7 +55,7 @@ public class AltosFlashUI // Flash controller AltosProgrammer programmer; - private static String[] pair_programmed = { + private static final String[] pair_programmed_files = { "teleballoon", "telebt-v1", "teledongle-v0", @@ -67,20 +68,34 @@ public class AltosFlashUI "teleterra" }; + private static final String[] pair_programmed_devices = { + "TeleBalloon", + "TeleBT-v1", + "TeleDongle-v0", + "TeleFire", + "TeleMetrum-v0", + "TeleMetrum-v1", + "TeleMini", + "TeleNano", + "TeleShield", + "TeleTerra" + }; + private boolean is_pair_programmed() { if (file != null) { String name = file.getName(); - for (int i = 0; i < pair_programmed.length; i++) { - if (name.startsWith(pair_programmed[i])) + for (int i = 0; i < pair_programmed_files.length; i++) { + if (name.startsWith(pair_programmed_files[i])) return true; } } if (device != null) { - if (!device.matchProduct(AltosLib.product_altusmetrum) && - (device.matchProduct(AltosLib.product_teledongle) || - device.matchProduct(AltosLib.product_telebt))) - return true; + String name = device.toString(); + for (int i = 0; i < pair_programmed_devices.length; i++) { + if (name.startsWith(pair_programmed_devices[i])) + return true; + } } return false; }