X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosIgniteUI.java;h=5a09252ecc14babaa5d101a7758ae3e33ff4d970;hp=debbf763481136e781ff274d165da27c2d0abb54;hb=HEAD;hpb=a61217f0a6d0ef48b6471f632c4600255867e831 diff --git a/altosui/AltosIgniteUI.java b/altosui/AltosIgniteUI.java index debbf763..5a09252e 100644 --- a/altosui/AltosIgniteUI.java +++ b/altosui/AltosIgniteUI.java @@ -25,8 +25,8 @@ import java.io.*; import java.text.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_12.*; -import org.altusmetrum.altosuilib_12.*; +import org.altusmetrum.altoslib_14.*; +import org.altusmetrum.altosuilib_14.*; public class AltosIgniteUI extends AltosUIDialog @@ -42,6 +42,7 @@ public class AltosIgniteUI ButtonGroup group; Boolean opened; + boolean has_standard; int npyro; final static int timeout = 1 * 1000; @@ -65,7 +66,7 @@ public class AltosIgniteUI } Igniter(AltosIgniteUI ui, String label, String name, int y) { - Container pane = getContentPane(); + Container pane = getScrollablePane(); GridBagConstraints c = new GridBagConstraints(); Insets i = new Insets(4,4,4,4); @@ -127,7 +128,7 @@ public class AltosIgniteUI public void run () { try { ignite = new AltosIgnite(link, - !device.matchProduct(Altos.product_altimeter)); + device.matchProduct(Altos.product_basestation)); } catch (Exception e) { send_exception(e); @@ -151,7 +152,7 @@ public class AltosIgniteUI } reply = "status"; } else if (command.equals("get_npyro")) { - reply = String.format("npyro %d", ignite.npyro()); + reply = String.format("npyro %d %d", ignite.npyro(), ignite.has_standard() ? 1 : 0); } else if (command.equals("quit")) { ignite.close(); break; @@ -212,9 +213,11 @@ public class AltosIgniteUI } else if (reply.equals("fired")) { fired(); } else if (reply.startsWith("npyro")) { - npyro = Integer.parseInt(reply.substring(6)); + String items[] = reply.split("\\s+"); + npyro = Integer.parseInt(items[1]); if (npyro == AltosLib.MISSING) npyro = 0; + has_standard = Integer.parseInt(items[2]) != 0; make_ui(); } } @@ -388,7 +391,7 @@ public class AltosIgniteUI private void make_ui() { group = new ButtonGroup(); - Container pane = getContentPane(); + Container pane = getScrollablePane(); GridBagConstraints c = new GridBagConstraints(); Insets i = new Insets(4,4,4,4); @@ -417,15 +420,21 @@ public class AltosIgniteUI y++; - igniters = new Igniter[2 + npyro]; + int nstandard = 0; + if (has_standard) + nstandard = 2; - igniters[0] = new Igniter(this, "Apogee", AltosIgnite.Apogee, y++); - igniters[1] = new Igniter(this, "Main", AltosIgnite.Main, y++); + igniters = new Igniter[nstandard + npyro]; + + if (has_standard) { + igniters[0] = new Igniter(this, "Apogee", AltosIgnite.Apogee, y++); + igniters[1] = new Igniter(this, "Main", AltosIgnite.Main, y++); + } for (int p = 0; p < npyro; p++) { String name = String.format("%d", p); String label = String.format("%c", 'A' + p); - igniters[2+p] = new Igniter(this, label, name, y++); + igniters[nstandard+p] = new Igniter(this, label, name, y++); } c.gridx = 0;