altosuilib: Reset telemetry state after processing it
authorKeith Packard <keithp@keithp.com>
Sun, 8 Feb 2015 01:09:40 +0000 (17:09 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 8 Feb 2015 01:09:40 +0000 (17:09 -0800)
This avoids re-using stale state after switching telemetry reception
parameters around, which otherwise generates spurious entries for the
wrong frequencies in the scan results list.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosuilib/AltosScanUI.java

index 1b30f99d64a092532e7eb9de702d17d0461b12fa..a20a7e141f501911857373f1cb4109f6685df2a4 100644 (file)
@@ -210,6 +210,8 @@ public class AltosScanUI
                                                                                                             frequencies[frequency_index],
                                                                                                             telemetry,
                                                                                                             rate);
                                                                                                             frequencies[frequency_index],
                                                                                                             telemetry,
                                                                                                             rate);
+                                                       /* Reset the state so we don't get this data for another channel */
+                                                       state.init();
                                                        Runnable r = new Runnable() {
                                                                        public void run() {
                                                                                results.add(result);
                                                        Runnable r = new Runnable() {
                                                                        public void run() {
                                                                                results.add(result);
@@ -254,9 +256,6 @@ public class AltosScanUI
        void next() throws InterruptedException, TimeoutException {
                reader.set_monitor(false);
 
        void next() throws InterruptedException, TimeoutException {
                reader.set_monitor(false);
 
-               /* Let any pending input from the last configuration drain out */
-               Thread.sleep(100);
-
                if (select_rate) {
                        boolean wrapped = false;
                        do {
                if (select_rate) {
                        boolean wrapped = false;
                        do {