altosui: Make accel cal dialog say 'beeper' instead of 'antenna'
authorKeith Packard <keithp@keithp.com>
Thu, 1 Feb 2024 06:05:13 +0000 (22:05 -0800)
committerKeith Packard <keithp@keithp.com>
Thu, 1 Feb 2024 06:05:13 +0000 (22:05 -0800)
Quite the plumbing required, but it'll do.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosConfigValues.java
altosui/AltosConfigFCUI.java
altosuilib/AltosUIAccelCal.java
telegps/TeleGPSConfigUI.java

index 8fb302779d188892d541c211ddaca607754fa685..6823e0f99c9b1dc24f122dacd695af99aa60a68e 100644 (file)
@@ -124,6 +124,8 @@ public interface AltosConfigValues {
 
        public abstract void set_radio_10mw(int radio_10mw);
 
+       public abstract boolean has_radio();
+
        public abstract int report_feet() throws AltosConfigDataException;
 
        public abstract void set_report_feet(int radio_10mw);
index 88f8b0808a92a59c68aab2cf982d43bac124949d..bc082a4ee6fbda228ccf58de5fc124e3f5ba5f66 100644 (file)
@@ -240,7 +240,7 @@ public class AltosConfigFCUI
                return product != null && product.startsWith("EasyTimer");
        }
 
-       boolean has_radio() {
+       public boolean has_radio() {
                return is_telemega() || is_telemetrum() || is_telemini();
        }
 
index 94d80193c2d1b5dbbcc6cffb0cbd7b4aed677729..ae8d6246b04f58115e43a088c40c41b4db2e3ee1 100644 (file)
@@ -81,14 +81,14 @@ public class AltosUIAccelCal
                                public void run() {
                                        switch (phase) {
                                        case AltosAccelCal.phase_antenna_up:
-                                               message.setText("Orient antenna upwards and click on Antenna Up");
+                                               message.setText(String.format ("Orient antenna upwards and click on %s", up_msg()));
                                                antenna_up.setEnabled(true);
                                                setDefaultButton(antenna_up);
                                                antenna_down.setEnabled(false);
                                                ok.setEnabled(false);
                                                break;
                                        case AltosAccelCal.phase_antenna_down:
-                                               message.setText("Orient antenna downwards and click on Antenna Down");
+                                               message.setText(String.format("Orient antenna downwards and click on %s", down_msg()));
                                                antenna_up.setEnabled(false);
                                                antenna_down.setEnabled(true);
                                                setDefaultButton(antenna_down);
@@ -157,6 +157,10 @@ public class AltosUIAccelCal
                        }
                }
        }
+
+       public String up_msg() { return config_values.has_radio() ? "Antenna Up" : "Beeper Up"; }
+       public String down_msg() { return config_values.has_radio() ? "Antenna Down" : "Beeper Down"; }
+
        public AltosUIAccelCal(Frame owner, AltosLink link, AltosConfigValues config_values) {
                super(owner, "Calibrate Accelerometer", true);
 
@@ -193,7 +197,7 @@ public class AltosUIAccelCal
                c.gridheight = 1;
                c.weightx = 0;
                c.weighty = 0;
-               antenna_up = new JButton("Antenna Up");
+               antenna_up = new JButton(up_msg());
                antenna_up.setActionCommand("up");
                antenna_up.setEnabled(false);
                antenna_up.addActionListener(this);
@@ -208,7 +212,7 @@ public class AltosUIAccelCal
                c.gridheight = 1;
                c.weightx = 0;
                c.weighty = 0;
-               antenna_down = new JButton("Antenna Down");
+               antenna_down = new JButton(down_msg());
                antenna_down.setActionCommand("down");
                antenna_down.setEnabled(false);
                antenna_down.addActionListener(this);
index b5d267b75d2e0c73916e13d9b6bb9dfe22a838c4..b348f702ca707ddee5de949b6bc812152715b008 100644 (file)
@@ -248,6 +248,8 @@ public class TeleGPSConfigUI
                        flight_log_max_value.setToolTipText("Cannot set max value with flight logs in memory");
        }
 
+       public boolean has_radio() { return true; }
+
        /* Build the UI using a grid bag */
        public TeleGPSConfigUI(JFrame in_owner) {
                super (in_owner, "Configure Device", false);