X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosIgniteUI.java;h=9f2f15dab9fc05fd42e27ce3cf74579dba14ad94;hb=1a3c0805f88c50f27dd4e78b9be2a4c3ef9e46c8;hp=14a2b606cb2651a4db4036645ef857c587f3b569;hpb=d6445b3739ac2c5dd040efdb97317a6b2a48044a;p=fw%2Faltos diff --git a/altosui/AltosIgniteUI.java b/altosui/AltosIgniteUI.java index 14a2b606..9f2f15da 100644 --- a/altosui/AltosIgniteUI.java +++ b/altosui/AltosIgniteUI.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 @@ -24,8 +25,8 @@ import java.io.*; import java.text.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_8.*; -import org.altusmetrum.altosuilib_8.*; +import org.altusmetrum.altoslib_14.*; +import org.altusmetrum.altosuilib_14.*; public class AltosIgniteUI extends AltosUIDialog @@ -48,6 +49,8 @@ public class AltosIgniteUI int time_remaining; boolean timer_running; + int poll_remaining; + LinkedBlockingQueue command_queue; class Igniter { @@ -62,7 +65,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); @@ -124,7 +127,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); @@ -210,6 +213,8 @@ public class AltosIgniteUI fired(); } else if (reply.startsWith("npyro")) { npyro = Integer.parseInt(reply.substring(6)); + if (npyro == AltosLib.MISSING) + npyro = 0; make_ui(); } } @@ -252,17 +257,18 @@ public class AltosIgniteUI boolean getting_status = false; - boolean visible = false; - void set_ignite_status() { getting_status = false; - if (!visible) { - visible = true; + poll_remaining = 2; + if (!isVisible()) setVisible(true); - } } void poll_ignite_status() { + if (poll_remaining > 0) { + --poll_remaining; + return; + } if (!getting_status) { getting_status = true; send_command("get_status"); @@ -382,7 +388,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);