altosui: Set idle mode frequency before starting link
authorKeith Packard <keithp@keithp.com>
Sun, 9 Feb 2020 07:09:50 +0000 (23:09 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 9 Feb 2020 07:09:50 +0000 (23:09 -0800)
This makes sure the link doesn't try to start at the wrong frequency.

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

index 44202c0c80eb0b6ebe1a53d4d46cadd78d3b7a2d..7886191529a5278c0626dc23e0df54fae98d383c 100644 (file)
@@ -392,7 +392,7 @@ public abstract class AltosLink implements Runnable {
                                        int cal) {
                if (debug)
                        System.out.printf("set_radio_frequency %7.3f (freq %b) (set %b) %d\n", frequency, has_frequency, has_setting, cal);
-               if (frequency == 0)
+               if (frequency == 0 || frequency == AltosLib.MISSING)
                        return;
                if (has_frequency)
                        set_radio_freq((int) Math.floor (frequency * 1000 + 0.5));
@@ -519,7 +519,7 @@ public abstract class AltosLink implements Runnable {
        public String name;
 
        public void start_remote() throws TimeoutException, InterruptedException {
-               if (frequency == 0.0)
+               if (frequency == 0.0 || frequency == AltosLib.MISSING)
                        frequency = AltosPreferences.frequency(serial);
                if (debug)
                        System.out.printf("start remote %7.3f\n", frequency);
index fc76b2b658c87db172a8043bce7e6912679ae7fa..bc3060e0d0dee64298839660e853dc3a3a2a9569 100644 (file)
@@ -297,6 +297,8 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
 
                thread = new AltosIdleMonitor(this, link, (boolean) remote);
 
+               thread.set_frequency(AltosUIPreferences.frequency(serial));
+
                status_update = new AltosFlightStatusUpdate(flightStatus);
 
                new javax.swing.Timer(100, status_update).start();