X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=telegps%2FTeleGPSConfigUI.java;h=1a951309e331cec9644e7cbafd4f9705ead52558;hp=fa74fc19b56debecf3b59dbab98d3389212b00a5;hb=HEAD;hpb=c1708f3fa4ff412da8817ba0fa58d05fe7ef44f5 diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index fa74fc19..a4a60b6f 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -41,6 +41,7 @@ public class TeleGPSConfigUI JLabel radio_enable_label; JLabel radio_10mw_label; JLabel report_feet_label; + JLabel gps_receiver_label; JLabel rate_label; JLabel aprs_interval_label; JLabel aprs_ssid_label; @@ -62,6 +63,7 @@ public class TeleGPSConfigUI JRadioButton radio_enable_value; JRadioButton radio_10mw_value; JComboBox report_feet_value; + JComboBox gps_receiver_value; AltosUIRateList rate_value; JComboBox aprs_interval_value; JComboBox aprs_ssid_value; @@ -200,6 +202,39 @@ public class TeleGPSConfigUI return AltosLib.MISSING; } + void set_gps_receiver_tool_tip() { + if (gps_receiver_value.isVisible()) + gps_receiver_value.setToolTipText("GPS receiver selection"); + else + gps_receiver_value.setToolTipText("Only TeleMega with new firmware supports alternate GPS receivers"); + } + + public void set_gps_receiver(int new_gps_receiver) { + System.out.printf("set_gps_receiver %d\n", new_gps_receiver); + if (new_gps_receiver != AltosLib.MISSING) { + if (new_gps_receiver >= AltosLib.gps_receiver_names.length) + new_gps_receiver = 0; + if (new_gps_receiver < 0) { + gps_receiver_value.setEnabled(false); + new_gps_receiver = 0; + } else { + gps_receiver_value.setEnabled(true); + } + gps_receiver_value.setSelectedIndex(new_gps_receiver); + } + gps_receiver_value.setVisible(new_gps_receiver != AltosLib.MISSING); + gps_receiver_label.setVisible(new_gps_receiver != AltosLib.MISSING); + + set_gps_receiver_tool_tip(); + } + + public int gps_receiver() { + if (gps_receiver_value.isVisible()) + return gps_receiver_value.getSelectedIndex(); + else + return AltosLib.MISSING; + } + void set_rate_tool_tip() { if (rate_value.isVisible()) rate_value.setToolTipText("Select telemetry baud rate"); @@ -248,6 +283,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); @@ -402,6 +439,58 @@ public class TeleGPSConfigUI set_radio_enable_tool_tip(); row++; + /* Report feet */ + c = new GridBagConstraints(); + c.gridx = 0; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + c.ipady = 5; + report_feet_label = new JLabel("Beep max height in:"); + pane.add(report_feet_label, c); + + c = new GridBagConstraints(); + c.gridx = 4; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.anchor = GridBagConstraints.LINE_START; + c.insets = ir; + c.ipady = 5; + report_feet_value = new JComboBox(report_feet_values); + report_feet_value.setEditable(false); + report_feet_value.addItemListener(this); + pane.add(report_feet_value, c); + set_report_feet_tool_tip(); + row++; + + /* GPS Receiver */ + c = new GridBagConstraints(); + c.gridx = 0; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + c.ipady = 5; + gps_receiver_label = new JLabel("GPS Receiver:"); + pane.add(gps_receiver_label, c); + + c = new GridBagConstraints(); + c.gridx = 4; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.anchor = GridBagConstraints.LINE_START; + c.insets = ir; + c.ipady = 5; + gps_receiver_value = new JComboBox(AltosLib.gps_receiver_names); + gps_receiver_value.setEditable(false); + gps_receiver_value.addItemListener(this); + pane.add(gps_receiver_value, c); + set_gps_receiver_tool_tip(); + row++; + /* Radio 10mW limit */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = row;