X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosConfigFCUI.java;h=278d3fea167f076bf0dac50f886f5b94d2040dfd;hb=1fa1ba86f6e6e4ff469f0680cdbc39bc806474a4;hp=b7dc70bf4cb9d1aa6d0fbca9456b63e08e885932;hpb=e142c4bd6f2fbab74fb7b7cea7e9a19234ed0123;p=fw%2Faltos diff --git a/altosui/AltosConfigFCUI.java b/altosui/AltosConfigFCUI.java index b7dc70bf..278d3fea 100644 --- a/altosui/AltosConfigFCUI.java +++ b/altosui/AltosConfigFCUI.java @@ -97,6 +97,8 @@ public class AltosConfigFCUI ActionListener listener; + static final String title = "Configure Flight Computer"; + static String[] main_deploy_values_m = { "100", "150", "200", "250", "300", "350", "400", "450", "500" @@ -119,6 +121,7 @@ public class AltosConfigFCUI "Dual Deploy", "Redundant Apogee", "Redundant Main", + "Separation & Apogee", }; static String[] aprs_interval_values = { @@ -142,11 +145,18 @@ public class AltosConfigFCUI "4250", }; - static String[] pad_orientation_values = { + static String[] pad_orientation_values_radio = { "Antenna Up", "Antenna Down", }; + static String[] pad_orientation_values_no_radio = { + "Beeper Up", + "Beeper Down", + }; + + String[] pad_orientation_values; + static String[] tracker_motion_values_m = { "2", "5", @@ -203,6 +213,25 @@ public class AltosConfigFCUI return product != null && product.startsWith("TeleMetrum"); } + boolean is_telemega() { + String product = product_value.getText(); + return product != null && product.startsWith("TeleMega"); + } + + boolean is_easymega() { + String product = product_value.getText(); + return product != null && product.startsWith("EasyMega"); + } + + boolean is_easytimer() { + String product = product_value.getText(); + return product != null && product.startsWith("EasyTimer"); + } + + boolean has_radio() { + return is_telemega() || is_telemetrum() || is_telemini(); + } + void set_radio_enable_tool_tip() { if (radio_enable_value.isVisible()) radio_enable_value.setToolTipText("Enable/Disable telemetry and RDF transmissions"); @@ -277,11 +306,29 @@ public class AltosConfigFCUI pad_orientation_value.setToolTipText("Older TeleMetrum firmware must fly antenna forward"); else if (is_telemini() || is_easymini()) pad_orientation_value.setToolTipText("TeleMini and EasyMini don't care how they are mounted"); + else if (is_easytimer()) + pad_orientation_value.setToolTipText("EasyTimer can be mounted in any of six orientations"); else pad_orientation_value.setToolTipText("Can't select orientation"); } } + void set_pad_orientation_values() { + String [] new_values; + if (has_radio()) + new_values = pad_orientation_values_radio; + else + new_values = pad_orientation_values_no_radio; + if (new_values != pad_orientation_values) { + int id = pad_orientation_value.getSelectedIndex(); + pad_orientation_value.removeAllItems(); + pad_orientation_values = new_values; + for (int i = 0; i < new_values.length; i++) + pad_orientation_value.addItem(pad_orientation_values[i]); + pad_orientation_value.setSelectedIndex(id); + } + } + void set_accel_tool_tips() { if (accel_plus_value.isVisible()) { accel_plus_value.setToolTipText("Pad acceleration value in flight orientation"); @@ -301,7 +348,7 @@ public class AltosConfigFCUI /* Build the UI using a grid bag */ public AltosConfigFCUI(JFrame in_owner, boolean remote) { - super (in_owner, "Configure Flight Computer", false); + super (in_owner, title, false); owner = in_owner; GridBagConstraints c; @@ -310,7 +357,8 @@ public class AltosConfigFCUI Insets il = new Insets(4,4,4,4); Insets ir = new Insets(4,4,4,4); - pane = getContentPane(); + pane = getScrollablePane(); + pane.setLayout(new GridBagLayout()); /* Product */ @@ -759,6 +807,8 @@ public class AltosConfigFCUI c.anchor = GridBagConstraints.LINE_START; c.insets = ir; c.ipady = 5; + pad_orientation_values = pad_orientation_values_no_radio; + pad_orientation_value = new JComboBox(pad_orientation_values); pad_orientation_value.setEditable(false); pad_orientation_value.addItemListener(this); @@ -997,11 +1047,13 @@ public class AltosConfigFCUI public void set_dirty() { dirty = true; + setTitle(title + " (modified)"); save.setEnabled(true); } public void set_clean() { dirty = false; + setTitle(title); save.setEnabled(false); } @@ -1029,13 +1081,13 @@ public class AltosConfigFCUI if (cmd.equals("Close") || cmd.equals("Reboot")) if (!check_dirty(cmd)) return; + if (cmd.equals("Save")) + save.setEnabled(false); listener.actionPerformed(e); if (cmd.equals("Close") || cmd.equals("Reboot")) { setVisible(false); dispose(); } - if (cmd.equals("Save") || cmd.equals("Reset")) - set_clean(); } /* ItemListener interface method */ @@ -1068,6 +1120,7 @@ public class AltosConfigFCUI set_pad_orientation_tool_tip(); set_accel_tool_tips(); set_flight_log_max_tool_tip(); + set_pad_orientation_values(); } public void set_version(String version) {