altosui: Delay between polling for igniter status in Fire Igniters
authorKeith Packard <keithp@keithp.com>
Mon, 21 Mar 2016 04:54:08 +0000 (21:54 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 21 Mar 2016 04:54:08 +0000 (21:54 -0700)
This gives a remote like time to report the full status instead of
sending another request before the reply has been processed.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosIgniteUI.java

index 01d58b5eda1e17c6425fc581d7449ac5701ab989..ce714f7baa661cf6cfa16ba3e3b1ac92d6644c6c 100644 (file)
@@ -48,6 +48,8 @@ public class AltosIgniteUI
        int             time_remaining;
        boolean         timer_running;
 
+       int             poll_remaining;
+
        LinkedBlockingQueue<String>     command_queue;
 
        class Igniter {
@@ -256,6 +258,7 @@ public class AltosIgniteUI
 
        void set_ignite_status() {
                getting_status = false;
+               poll_remaining = 2;
                if (!visible) {
                        visible = true;
                        setVisible(true);
@@ -263,6 +266,10 @@ public class AltosIgniteUI
        }
 
        void poll_ignite_status() {
+               if (poll_remaining > 0) {
+                       --poll_remaining;
+                       return;
+               }
                if (!getting_status) {
                        getting_status = true;
                        send_command("get_status");