2 * Copyright © 2010 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 import java.awt.event.*;
24 import javax.swing.event.*;
26 import org.altusmetrum.altoslib_14.*;
27 import org.altusmetrum.altosuilib_14.*;
29 public class AltosConfigFCUI
31 implements ActionListener, ItemListener, DocumentListener, AltosConfigValues, AltosUnitsListener
38 JLabel main_deploy_label;
39 JLabel apogee_delay_label;
40 JLabel apogee_lockout_label;
41 JLabel frequency_label;
42 JLabel radio_calibration_label;
43 JLabel radio_frequency_label;
44 JLabel radio_enable_label;
45 JLabel radio_10mw_label;
47 JLabel aprs_interval_label;
48 JLabel aprs_ssid_label;
49 JLabel aprs_format_label;
50 JLabel aprs_offset_label;
51 JLabel flight_log_max_label;
52 JLabel ignite_mode_label;
53 JLabel pad_orientation_label;
54 JLabel accel_plus_label;
55 JLabel accel_minus_label;
56 JLabel callsign_label;
58 JLabel tracker_motion_label;
59 JLabel tracker_interval_label;
67 JComboBox<String> main_deploy_value;
68 JComboBox<String> apogee_delay_value;
69 JComboBox<String> apogee_lockout_value;
70 AltosUIFreqList radio_frequency_value;
71 JLabel radio_calibration_value;
72 JRadioButton radio_enable_value;
73 JRadioButton radio_10mw_value;
74 AltosUIRateList rate_value;
75 JComboBox<String> aprs_interval_value;
76 JComboBox<Integer> aprs_ssid_value;
77 JComboBox<String> aprs_format_value;
78 JComboBox<Integer> aprs_offset_value;
79 JComboBox<String> flight_log_max_value;
80 JComboBox<String> ignite_mode_value;
81 JComboBox<String> pad_orientation_value;
82 JTextField accel_plus_value;
83 JTextField accel_minus_value;
84 JTextField callsign_value;
85 JComboBox<String> beep_value;
86 JComboBox<String> tracker_motion_value;
87 JComboBox<String> tracker_interval_value;
98 double pyro_firing_time;
100 ActionListener listener;
102 static final String title = "Configure Flight Computer";
104 static String[] main_deploy_values_m = {
105 "100", "150", "200", "250", "300", "350",
109 static String[] main_deploy_values_ft = {
110 "250", "500", "750", "1000", "1250", "1500",
114 static String[] apogee_delay_values = {
115 "0", "1", "2", "3", "4", "5"
118 static String[] apogee_lockout_values = {
119 "0", "5", "10", "15", "20"
122 static String[] ignite_mode_values = {
126 "Separation & Apogee",
129 static String[] aprs_interval_values = {
136 static Integer[] aprs_ssid_values = {
137 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
140 static Integer[] aprs_offset_values = {
141 0, 2, 4, 6, 8, 10, 12, 14, 16, 18
144 static String[] beep_values = {
153 static String[] pad_orientation_values_radio = {
158 static String[] pad_orientation_values_no_radio = {
163 String[] pad_orientation_values;
165 static String[] tracker_motion_values_m = {
172 static String[] tracker_motion_values_ft = {
179 static String[] tracker_interval_values = {
186 /* A window listener to catch closing events and tell the config code */
187 class ConfigListener extends WindowAdapter {
190 public ConfigListener(AltosConfigFCUI this_ui) {
194 public void windowClosing(WindowEvent e) {
195 ui.actionPerformed(new ActionEvent(e.getSource(),
196 ActionEvent.ACTION_PERFORMED,
201 boolean is_telemini_v1() {
202 String product = product_value.getText();
203 return product != null && product.startsWith("TeleMini-v1");
206 boolean is_telemini() {
207 String product = product_value.getText();
208 return product != null && product.startsWith("TeleMini");
211 boolean is_easymini() {
212 String product = product_value.getText();
213 return product != null && product.startsWith("EasyMini");
216 boolean is_telemetrum() {
217 String product = product_value.getText();
218 return product != null && product.startsWith("TeleMetrum");
221 boolean is_telemega() {
222 String product = product_value.getText();
223 return product != null && product.startsWith("TeleMega");
226 boolean is_easymega() {
227 String product = product_value.getText();
228 return product != null && product.startsWith("EasyMega");
231 boolean is_easytimer() {
232 String product = product_value.getText();
233 return product != null && product.startsWith("EasyTimer");
236 boolean has_radio() {
237 return is_telemega() || is_telemetrum() || is_telemini();
240 void set_radio_enable_tool_tip() {
241 if (radio_enable_value.isVisible())
242 radio_enable_value.setToolTipText("Enable/Disable telemetry and RDF transmissions");
244 radio_enable_value.setToolTipText("Firmware version does not support disabling radio");
247 void set_rate_tool_tip() {
248 if (rate_value.isVisible())
249 rate_value.setToolTipText("Select telemetry baud rate");
251 rate_value.setToolTipText("Firmware version does not support variable telemetry rates");
254 void set_aprs_interval_tool_tip() {
255 if (aprs_interval_value.isVisible())
256 aprs_interval_value.setToolTipText("Enable APRS and set the interval between APRS reports");
258 aprs_interval_value.setToolTipText("Hardware doesn't support APRS");
261 void set_aprs_ssid_tool_tip() {
262 if (aprs_ssid_value.isVisible())
263 aprs_ssid_value.setToolTipText("Set the APRS SSID (secondary station identifier)");
264 else if (aprs_ssid_value.isVisible())
265 aprs_ssid_value.setToolTipText("Software version doesn't support setting the APRS SSID");
267 aprs_ssid_value.setToolTipText("Hardware doesn't support APRS");
270 void set_aprs_format_tool_tip() {
271 if (aprs_format_value.isVisible())
272 aprs_format_value.setToolTipText("Set the APRS format (compressed/uncompressed)");
273 else if (aprs_format_value.isVisible())
274 aprs_format_value.setToolTipText("Software version doesn't support setting the APRS format");
276 aprs_format_value.setToolTipText("Hardware doesn't support APRS");
279 void set_aprs_offset_tool_tip() {
280 if (aprs_offset_value.isVisible())
281 aprs_offset_value.setToolTipText("Set the APRS offset from top of minute");
282 else if (aprs_offset_value.isVisible())
283 aprs_offset_value.setToolTipText("Software version doesn't support setting the APRS offset");
285 aprs_offset_value.setToolTipText("Hardware doesn't support APRS");
288 void set_flight_log_max_tool_tip() {
289 if (flight_log_max_value.isVisible())
290 flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)");
292 if (is_telemini_v1())
293 flight_log_max_value.setToolTipText("TeleMini-v1 stores only one flight");
295 flight_log_max_value.setToolTipText("Cannot set max value with flight logs in memory");
299 void set_ignite_mode_tool_tip() {
300 if (ignite_mode_value.isVisible())
301 ignite_mode_value.setToolTipText("Select when igniters will be fired");
303 ignite_mode_value.setToolTipText("Older firmware could not select ignite mode");
306 void set_pad_orientation_tool_tip() {
307 if (pad_orientation_value.isVisible()) {
308 pad_orientation_value.setToolTipText("How will the computer be mounted in the airframe");
311 pad_orientation_value.setToolTipText("Older TeleMetrum firmware must fly antenna forward");
312 else if (is_telemini() || is_easymini())
313 pad_orientation_value.setToolTipText("TeleMini and EasyMini don't care how they are mounted");
314 else if (is_easytimer())
315 pad_orientation_value.setToolTipText("EasyTimer can be mounted in any of six orientations");
317 pad_orientation_value.setToolTipText("Can't select orientation");
321 void set_pad_orientation_values() {
322 String [] new_values;
324 new_values = pad_orientation_values_radio;
326 new_values = pad_orientation_values_no_radio;
327 if (new_values != pad_orientation_values) {
328 int id = pad_orientation_value.getSelectedIndex();
329 pad_orientation_value.removeAllItems();
330 pad_orientation_values = new_values;
331 for (int i = 0; i < new_values.length; i++)
332 pad_orientation_value.addItem(pad_orientation_values[i]);
333 pad_orientation_value.setSelectedIndex(id);
337 void set_accel_tool_tips() {
338 if (accel_plus_value.isVisible()) {
339 accel_plus_value.setToolTipText("Pad acceleration value in flight orientation");
340 accel_minus_value.setToolTipText("Upside-down acceleration value");
342 accel_plus_value.setToolTipText("No accelerometer");
343 accel_minus_value.setToolTipText("No accelerometer");
347 void set_beep_tool_tip() {
348 if (beep_value.isVisible())
349 beep_value.setToolTipText("What frequency the beeper will sound at");
351 beep_value.setToolTipText("Older firmware could not select beeper frequency");
354 void set_radio_10mw_tool_tip() {
355 if (radio_10mw_value.isVisible())
356 radio_10mw_value.setToolTipText("Should transmitter power be limited to 10mW");
358 radio_10mw_value.setToolTipText("Older firmware could not limit radio power");
361 /* Build the UI using a grid bag */
362 public AltosConfigFCUI(JFrame in_owner, boolean remote) {
363 super (in_owner, title, false);
366 GridBagConstraints c;
369 Insets il = new Insets(4,4,4,4);
370 Insets ir = new Insets(4,4,4,4);
372 pane = getScrollablePane();
374 pane.setLayout(new GridBagLayout());
377 c = new GridBagConstraints();
378 c.gridx = 0; c.gridy = row;
380 c.fill = GridBagConstraints.NONE;
381 c.anchor = GridBagConstraints.LINE_START;
383 product_label = new JLabel("Product:");
384 pane.add(product_label, c);
386 c = new GridBagConstraints();
387 c.gridx = 4; c.gridy = row;
389 c.fill = GridBagConstraints.HORIZONTAL;
391 c.anchor = GridBagConstraints.LINE_START;
393 product_value = new JLabel("");
394 pane.add(product_value, c);
398 c = new GridBagConstraints();
399 c.gridx = 0; c.gridy = row;
401 c.fill = GridBagConstraints.NONE;
402 c.anchor = GridBagConstraints.LINE_START;
405 version_label = new JLabel("Software version:");
406 pane.add(version_label, c);
408 c = new GridBagConstraints();
409 c.gridx = 4; c.gridy = row;
411 c.fill = GridBagConstraints.HORIZONTAL;
413 c.anchor = GridBagConstraints.LINE_START;
416 version_value = new JLabel("");
417 pane.add(version_value, c);
421 c = new GridBagConstraints();
422 c.gridx = 0; c.gridy = row;
424 c.fill = GridBagConstraints.NONE;
425 c.anchor = GridBagConstraints.LINE_START;
428 serial_label = new JLabel("Serial:");
429 pane.add(serial_label, c);
431 c = new GridBagConstraints();
432 c.gridx = 4; c.gridy = row;
434 c.fill = GridBagConstraints.HORIZONTAL;
436 c.anchor = GridBagConstraints.LINE_START;
439 serial_value = new JLabel("");
440 pane.add(serial_value, c);
444 c = new GridBagConstraints();
445 c.gridx = 0; c.gridy = row;
447 c.fill = GridBagConstraints.NONE;
448 c.anchor = GridBagConstraints.LINE_START;
451 main_deploy_label = new JLabel(get_main_deploy_label());
452 pane.add(main_deploy_label, c);
454 c = new GridBagConstraints();
455 c.gridx = 4; c.gridy = row;
457 c.fill = GridBagConstraints.HORIZONTAL;
459 c.anchor = GridBagConstraints.LINE_START;
462 main_deploy_value = new JComboBox<String>(main_deploy_values());
463 main_deploy_value.setEditable(true);
464 main_deploy_value.addItemListener(this);
465 pane.add(main_deploy_value, c);
466 main_deploy_value.setToolTipText("Height above pad altitude to fire main charge");
470 c = new GridBagConstraints();
471 c.gridx = 0; c.gridy = row;
473 c.fill = GridBagConstraints.NONE;
474 c.anchor = GridBagConstraints.LINE_START;
477 apogee_delay_label = new JLabel("Apogee Delay(s):");
478 pane.add(apogee_delay_label, c);
480 c = new GridBagConstraints();
481 c.gridx = 4; c.gridy = row;
483 c.fill = GridBagConstraints.HORIZONTAL;
485 c.anchor = GridBagConstraints.LINE_START;
488 apogee_delay_value = new JComboBox<String>(apogee_delay_values);
489 apogee_delay_value.setEditable(true);
490 apogee_delay_value.addItemListener(this);
491 pane.add(apogee_delay_value, c);
492 apogee_delay_value.setToolTipText("Delay after apogee before charge fires");
496 c = new GridBagConstraints();
497 c.gridx = 0; c.gridy = row;
499 c.fill = GridBagConstraints.NONE;
500 c.anchor = GridBagConstraints.LINE_START;
503 apogee_lockout_label = new JLabel("Apogee Lockout(s):");
504 pane.add(apogee_lockout_label, c);
506 c = new GridBagConstraints();
507 c.gridx = 4; c.gridy = row;
509 c.fill = GridBagConstraints.HORIZONTAL;
511 c.anchor = GridBagConstraints.LINE_START;
514 apogee_lockout_value = new JComboBox<String>(apogee_lockout_values);
515 apogee_lockout_value.setEditable(true);
516 apogee_lockout_value.addItemListener(this);
517 pane.add(apogee_lockout_value, c);
518 apogee_lockout_value.setToolTipText("Time after launch while apogee detection is locked out");
522 c = new GridBagConstraints();
523 c.gridx = 0; c.gridy = row;
525 c.fill = GridBagConstraints.NONE;
526 c.anchor = GridBagConstraints.LINE_START;
529 radio_frequency_label = new JLabel("Frequency:");
530 pane.add(radio_frequency_label, c);
532 c = new GridBagConstraints();
533 c.gridx = 4; c.gridy = row;
535 c.fill = GridBagConstraints.HORIZONTAL;
537 c.anchor = GridBagConstraints.LINE_START;
540 radio_frequency_value = new AltosUIFreqList();
541 radio_frequency_value.addItemListener(this);
542 pane.add(radio_frequency_value, c);
543 radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
546 /* Radio Calibration */
547 c = new GridBagConstraints();
548 c.gridx = 0; c.gridy = row;
550 c.fill = GridBagConstraints.NONE;
551 c.anchor = GridBagConstraints.LINE_START;
554 radio_calibration_label = new JLabel("RF Calibration:");
555 pane.add(radio_calibration_label, c);
557 c = new GridBagConstraints();
558 c.gridx = 4; c.gridy = row;
560 c.fill = GridBagConstraints.HORIZONTAL;
562 c.anchor = GridBagConstraints.LINE_START;
565 radio_calibration_value = new JLabel(String.format("%d", 1186611));
566 pane.add(radio_calibration_value, c);
570 c = new GridBagConstraints();
571 c.gridx = 0; c.gridy = row;
573 c.fill = GridBagConstraints.NONE;
574 c.anchor = GridBagConstraints.LINE_START;
577 radio_enable_label = new JLabel("Telemetry/RDF/APRS Enable:");
578 pane.add(radio_enable_label, c);
580 c = new GridBagConstraints();
581 c.gridx = 4; c.gridy = row;
583 c.fill = GridBagConstraints.HORIZONTAL;
585 c.anchor = GridBagConstraints.LINE_START;
588 radio_enable_value = new JRadioButton("Enabled");
589 radio_enable_value.addItemListener(this);
590 pane.add(radio_enable_value, c);
591 set_radio_enable_tool_tip();
594 /* Radio 10mW limit */
595 c = new GridBagConstraints();
596 c.gridx = 0; c.gridy = row;
598 c.fill = GridBagConstraints.NONE;
599 c.anchor = GridBagConstraints.LINE_START;
602 radio_10mw_label = new JLabel("Limit transmit to 10mW:");
603 pane.add(radio_10mw_label, c);
605 c = new GridBagConstraints();
606 c.gridx = 4; c.gridy = row;
608 c.fill = GridBagConstraints.HORIZONTAL;
610 c.anchor = GridBagConstraints.LINE_START;
613 radio_10mw_value = new JRadioButton("Limited");
614 radio_10mw_value.addItemListener(this);
615 pane.add(radio_10mw_value, c);
616 set_radio_10mw_tool_tip();
620 c = new GridBagConstraints();
621 c.gridx = 0; c.gridy = row;
623 c.fill = GridBagConstraints.NONE;
624 c.anchor = GridBagConstraints.LINE_START;
627 rate_label = new JLabel("Telemetry baud rate:");
628 pane.add(rate_label, c);
630 c = new GridBagConstraints();
631 c.gridx = 4; c.gridy = row;
633 c.fill = GridBagConstraints.HORIZONTAL;
635 c.anchor = GridBagConstraints.LINE_START;
638 rate_value = new AltosUIRateList();
639 rate_value.addItemListener(this);
640 pane.add(rate_value, c);
645 c = new GridBagConstraints();
646 c.gridx = 0; c.gridy = row;
648 c.fill = GridBagConstraints.NONE;
649 c.anchor = GridBagConstraints.LINE_START;
652 aprs_interval_label = new JLabel("APRS Interval(s):");
653 pane.add(aprs_interval_label, c);
655 c = new GridBagConstraints();
656 c.gridx = 4; c.gridy = row;
658 c.fill = GridBagConstraints.HORIZONTAL;
660 c.anchor = GridBagConstraints.LINE_START;
663 aprs_interval_value = new JComboBox<String>(aprs_interval_values);
664 aprs_interval_value.setEditable(true);
665 aprs_interval_value.addItemListener(this);
666 pane.add(aprs_interval_value, c);
667 set_aprs_interval_tool_tip();
671 c = new GridBagConstraints();
672 c.gridx = 0; c.gridy = row;
674 c.fill = GridBagConstraints.NONE;
675 c.anchor = GridBagConstraints.LINE_START;
678 aprs_ssid_label = new JLabel("APRS SSID:");
679 pane.add(aprs_ssid_label, c);
681 c = new GridBagConstraints();
682 c.gridx = 4; c.gridy = row;
684 c.fill = GridBagConstraints.HORIZONTAL;
686 c.anchor = GridBagConstraints.LINE_START;
689 aprs_ssid_value = new JComboBox<Integer>(aprs_ssid_values);
690 aprs_ssid_value.setEditable(false);
691 aprs_ssid_value.addItemListener(this);
692 aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length);
693 pane.add(aprs_ssid_value, c);
694 set_aprs_ssid_tool_tip();
698 c = new GridBagConstraints();
699 c.gridx = 0; c.gridy = row;
701 c.fill = GridBagConstraints.NONE;
702 c.anchor = GridBagConstraints.LINE_START;
705 aprs_format_label = new JLabel("APRS format:");
706 pane.add(aprs_format_label, c);
708 c = new GridBagConstraints();
709 c.gridx = 4; c.gridy = row;
711 c.fill = GridBagConstraints.HORIZONTAL;
713 c.anchor = GridBagConstraints.LINE_START;
716 aprs_format_value = new JComboBox<String>(AltosLib.ao_aprs_format_name);
717 aprs_format_value.setEditable(false);
718 aprs_format_value.addItemListener(this);
719 aprs_format_value.setMaximumRowCount(AltosLib.ao_aprs_format_name.length);
720 pane.add(aprs_format_value, c);
721 set_aprs_format_tool_tip();
725 c = new GridBagConstraints();
726 c.gridx = 0; c.gridy = row;
728 c.fill = GridBagConstraints.NONE;
729 c.anchor = GridBagConstraints.LINE_START;
732 aprs_offset_label = new JLabel("APRS offset:");
733 pane.add(aprs_offset_label, c);
735 c = new GridBagConstraints();
736 c.gridx = 4; c.gridy = row;
738 c.fill = GridBagConstraints.HORIZONTAL;
740 c.anchor = GridBagConstraints.LINE_START;
743 aprs_offset_value = new JComboBox<Integer>(aprs_offset_values);
744 aprs_offset_value.setEditable(false);
745 aprs_offset_value.addItemListener(this);
746 aprs_offset_value.setMaximumRowCount(aprs_offset_values.length);
747 pane.add(aprs_offset_value, c);
748 set_aprs_offset_tool_tip();
752 c = new GridBagConstraints();
753 c.gridx = 0; c.gridy = row;
755 c.fill = GridBagConstraints.NONE;
756 c.anchor = GridBagConstraints.LINE_START;
759 callsign_label = new JLabel("Callsign:");
760 pane.add(callsign_label, c);
762 c = new GridBagConstraints();
763 c.gridx = 4; c.gridy = row;
765 c.fill = GridBagConstraints.HORIZONTAL;
767 c.anchor = GridBagConstraints.LINE_START;
770 callsign_value = new JTextField(AltosUIPreferences.callsign());
771 callsign_value.getDocument().addDocumentListener(this);
772 pane.add(callsign_value, c);
773 callsign_value.setToolTipText("Callsign reported in telemetry data");
777 c = new GridBagConstraints();
778 c.gridx = 0; c.gridy = row;
780 c.fill = GridBagConstraints.NONE;
781 c.anchor = GridBagConstraints.LINE_START;
784 flight_log_max_label = new JLabel("Maximum Flight Log Size (kB):");
785 pane.add(flight_log_max_label, c);
787 c = new GridBagConstraints();
788 c.gridx = 4; c.gridy = row;
790 c.fill = GridBagConstraints.HORIZONTAL;
792 c.anchor = GridBagConstraints.LINE_START;
795 flight_log_max_value = new JComboBox<String>();
796 flight_log_max_value.setEditable(true);
797 flight_log_max_value.addItemListener(this);
798 pane.add(flight_log_max_value, c);
799 set_flight_log_max_tool_tip();
803 c = new GridBagConstraints();
804 c.gridx = 0; c.gridy = row;
806 c.fill = GridBagConstraints.NONE;
807 c.anchor = GridBagConstraints.LINE_START;
810 ignite_mode_label = new JLabel("Igniter Firing Mode:");
811 pane.add(ignite_mode_label, c);
813 c = new GridBagConstraints();
814 c.gridx = 4; c.gridy = row;
816 c.fill = GridBagConstraints.HORIZONTAL;
818 c.anchor = GridBagConstraints.LINE_START;
821 ignite_mode_value = new JComboBox<String>(ignite_mode_values);
822 ignite_mode_value.setEditable(false);
823 ignite_mode_value.addItemListener(this);
824 pane.add(ignite_mode_value, c);
825 set_ignite_mode_tool_tip();
828 /* Pad orientation */
829 c = new GridBagConstraints();
830 c.gridx = 0; c.gridy = row;
832 c.fill = GridBagConstraints.NONE;
833 c.anchor = GridBagConstraints.LINE_START;
836 pad_orientation_label = new JLabel("Pad Orientation:");
837 pane.add(pad_orientation_label, c);
839 c = new GridBagConstraints();
840 c.gridx = 4; c.gridy = row;
842 c.fill = GridBagConstraints.HORIZONTAL;
844 c.anchor = GridBagConstraints.LINE_START;
847 pad_orientation_values = pad_orientation_values_no_radio;
849 pad_orientation_value = new JComboBox<String>(pad_orientation_values);
850 pad_orientation_value.setEditable(false);
851 pad_orientation_value.addItemListener(this);
852 pane.add(pad_orientation_value, c);
853 set_pad_orientation_tool_tip();
857 c = new GridBagConstraints();
858 c.gridx = 0; c.gridy = row;
860 c.fill = GridBagConstraints.NONE;
861 c.anchor = GridBagConstraints.LINE_START;
864 accel_plus_label = new JLabel("Accel Plus:");
865 pane.add(accel_plus_label, c);
867 c = new GridBagConstraints();
868 c.gridx = 4; c.gridy = row;
870 c.fill = GridBagConstraints.HORIZONTAL;
872 c.anchor = GridBagConstraints.LINE_START;
875 accel_plus_value = new JTextField(10);
876 accel_plus_value.setEditable(true);
877 accel_plus_value.getDocument().addDocumentListener(this);
878 pane.add(accel_plus_value, c);
882 c = new GridBagConstraints();
883 c.gridx = 0; c.gridy = row;
885 c.fill = GridBagConstraints.NONE;
886 c.anchor = GridBagConstraints.LINE_START;
889 accel_minus_label = new JLabel("Accel Minus:");
890 pane.add(accel_minus_label, c);
892 c = new GridBagConstraints();
893 c.gridx = 4; c.gridy = row;
895 c.fill = GridBagConstraints.HORIZONTAL;
897 c.anchor = GridBagConstraints.LINE_START;
900 accel_minus_value = new JTextField(10);
901 accel_minus_value.setEditable(true);
902 accel_minus_value.getDocument().addDocumentListener(this);
903 pane.add(accel_minus_value, c);
905 set_accel_tool_tips();
908 c = new GridBagConstraints();
909 c.gridx = 0; c.gridy = row;
911 c.fill = GridBagConstraints.NONE;
912 c.anchor = GridBagConstraints.LINE_START;
915 beep_label = new JLabel("Beeper Frequency:");
916 pane.add(beep_label, c);
918 c = new GridBagConstraints();
919 c.gridx = 4; c.gridy = row;
921 c.fill = GridBagConstraints.HORIZONTAL;
923 c.anchor = GridBagConstraints.LINE_START;
926 beep_value = new JComboBox<String>(beep_values);
927 beep_value.setEditable(true);
928 beep_value.addItemListener(this);
929 pane.add(beep_value, c);
933 /* Tracker triger horiz distances */
934 c = new GridBagConstraints();
935 c.gridx = 0; c.gridy = row;
937 c.fill = GridBagConstraints.NONE;
938 c.anchor = GridBagConstraints.LINE_START;
941 tracker_motion_label = new JLabel(get_tracker_motion_label());
942 pane.add(tracker_motion_label, c);
944 c = new GridBagConstraints();
945 c.gridx = 4; c.gridy = row;
947 c.fill = GridBagConstraints.HORIZONTAL;
949 c.anchor = GridBagConstraints.LINE_START;
952 tracker_motion_value = new JComboBox<String>(tracker_motion_values());
953 tracker_motion_value.setEditable(true);
954 tracker_motion_value.addItemListener(this);
955 pane.add(tracker_motion_value, c);
958 /* Tracker triger vert distances */
959 c = new GridBagConstraints();
960 c.gridx = 0; c.gridy = row;
962 c.fill = GridBagConstraints.NONE;
963 c.anchor = GridBagConstraints.LINE_START;
966 tracker_interval_label = new JLabel("Position Reporting Interval(s):");
967 pane.add(tracker_interval_label, c);
969 c = new GridBagConstraints();
970 c.gridx = 4; c.gridy = row;
972 c.fill = GridBagConstraints.HORIZONTAL;
974 c.anchor = GridBagConstraints.LINE_START;
977 tracker_interval_value = new JComboBox<String>(tracker_interval_values);
978 tracker_interval_value.setEditable(true);
979 tracker_interval_value.addItemListener(this);
980 pane.add(tracker_interval_value, c);
981 set_tracker_tool_tip();
985 c = new GridBagConstraints();
986 c.gridx = 4; c.gridy = row;
988 c.fill = GridBagConstraints.HORIZONTAL;
989 c.anchor = GridBagConstraints.LINE_START;
992 pyro = new JButton("Configure Pyro Channels");
994 pyro.addActionListener(this);
995 pyro.setActionCommand("Pyro");
999 c = new GridBagConstraints();
1000 c.gridx = 5; c.gridy = row;
1002 c.fill = GridBagConstraints.HORIZONTAL;
1003 c.anchor = GridBagConstraints.LINE_START;
1006 accel_cal = new JButton("Calibrate Accelerometer");
1007 pane.add(accel_cal, c);
1008 accel_cal.addActionListener(this);
1009 accel_cal.setActionCommand("Accel");
1013 c = new GridBagConstraints();
1014 c.gridx = 0; c.gridy = row;
1016 c.fill = GridBagConstraints.NONE;
1017 c.anchor = GridBagConstraints.LINE_START;
1019 save = new JButton("Save");
1021 save.addActionListener(this);
1022 save.setActionCommand("Save");
1024 c = new GridBagConstraints();
1025 c.gridx = 2; c.gridy = row;
1027 c.fill = GridBagConstraints.NONE;
1028 c.anchor = GridBagConstraints.CENTER;
1030 reset = new JButton("Reset");
1032 reset.addActionListener(this);
1033 reset.setActionCommand("Reset");
1035 c = new GridBagConstraints();
1036 c.gridx = 4; c.gridy = row;
1038 c.fill = GridBagConstraints.NONE;
1039 c.anchor = GridBagConstraints.CENTER;
1041 reboot = new JButton("Reboot");
1042 pane.add(reboot, c);
1043 reboot.addActionListener(this);
1044 reboot.setActionCommand("Reboot");
1046 c = new GridBagConstraints();
1047 c.gridx = 6; c.gridy = row;
1049 c.fill = GridBagConstraints.NONE;
1050 c.anchor = GridBagConstraints.LINE_END;
1052 close = new JButton("Close");
1054 close.addActionListener(this);
1055 close.setActionCommand("Close");
1057 addWindowListener(new ConfigListener(this));
1058 AltosPreferences.register_units_listener(this);
1061 /* Once the initial values are set, the config code will show the dialog */
1062 public void make_visible() {
1064 setLocationRelativeTo(owner);
1068 /* If any values have been changed, confirm before closing */
1069 public boolean check_dirty(String operation) {
1071 Object[] options = { String.format("%s anyway", operation), "Keep editing" };
1073 i = JOptionPane.showOptionDialog(this,
1074 String.format("Configuration modified. %s anyway?", operation),
1075 "Configuration Modified",
1076 JOptionPane.DEFAULT_OPTION,
1077 JOptionPane.WARNING_MESSAGE,
1078 null, options, options[1]);
1085 public void set_dirty() {
1087 setTitle(title + " (modified)");
1088 save.setEnabled(true);
1091 public void set_clean() {
1094 save.setEnabled(false);
1097 AltosConfigPyroUI pyro_ui;
1099 public void dispose() {
1100 if (pyro_ui != null)
1102 AltosPreferences.unregister_units_listener(this);
1106 /* Listen for events from our buttons */
1107 public void actionPerformed(ActionEvent e) {
1108 String cmd = e.getActionCommand();
1110 if (cmd.equals("Pyro")) {
1111 if (pyro_ui == null && pyros != null)
1112 pyro_ui = new AltosConfigPyroUI(this, pyros, pyro_firing_time);
1113 if (pyro_ui != null)
1114 pyro_ui.make_visible();
1118 if (cmd.equals("Close") || cmd.equals("Reboot"))
1119 if (!check_dirty(cmd))
1121 if (cmd.equals("Save"))
1122 save.setEnabled(false);
1123 listener.actionPerformed(e);
1124 if (cmd.equals("Close") || cmd.equals("Reboot")) {
1130 /* ItemListener interface method */
1131 public void itemStateChanged(ItemEvent e) {
1135 /* DocumentListener interface methods */
1136 public void changedUpdate(DocumentEvent e) {
1140 public void insertUpdate(DocumentEvent e) {
1144 public void removeUpdate(DocumentEvent e) {
1148 /* Let the config code hook on a listener */
1149 public void addActionListener(ActionListener l) {
1153 /* set and get all of the dialog values */
1154 public void set_product(String product) {
1155 radio_frequency_value.set_product(product);
1156 product_value.setText(product);
1157 set_pad_orientation_tool_tip();
1158 set_accel_tool_tips();
1159 set_flight_log_max_tool_tip();
1160 set_pad_orientation_values();
1163 public void set_version(String version) {
1164 version_value.setText(version);
1167 public void set_serial(int serial) {
1168 radio_frequency_value.set_serial(serial);
1169 serial_value.setText(String.format("%d", serial));
1172 public void set_altitude_32(int altitude_32) {
1175 public void set_main_deploy(int new_main_deploy) {
1176 if (new_main_deploy != AltosLib.MISSING)
1177 main_deploy_value.setSelectedItem(AltosConvert.height.say(new_main_deploy));
1178 main_deploy_value.setVisible(new_main_deploy != AltosLib.MISSING);
1179 main_deploy_label.setVisible(new_main_deploy != AltosLib.MISSING);
1182 public int main_deploy() throws AltosConfigDataException {
1183 String str = main_deploy_value.getSelectedItem().toString();
1185 return (int) (AltosConvert.height.parse_locale(str) + 0.5);
1186 } catch (ParseException pe) {
1187 throw new AltosConfigDataException("invalid main deploy height %s", str);
1191 String get_main_deploy_label() {
1192 return String.format("Main Deploy Altitude(%s):", AltosConvert.height.parse_units());
1195 String[] main_deploy_values() {
1196 if (AltosConvert.imperial_units)
1197 return main_deploy_values_ft;
1199 return main_deploy_values_m;
1202 void set_main_deploy_values() {
1203 String[] v = main_deploy_values();
1204 while (main_deploy_value.getItemCount() > 0)
1205 main_deploy_value.removeItemAt(0);
1206 for (int i = 0; i < v.length; i++)
1207 main_deploy_value.addItem(v[i]);
1208 main_deploy_value.setMaximumRowCount(v.length);
1211 public void units_changed(boolean imperial_units) {
1212 boolean was_dirty = dirty;
1214 String v = main_deploy_value.getSelectedItem().toString();
1215 main_deploy_label.setText(get_main_deploy_label());
1216 set_main_deploy_values();
1218 int m = (int) (AltosConvert.height.parse_locale(v, !imperial_units) + 0.5);
1220 } catch (ParseException pe) {
1223 if (tracker_motion_value.isVisible()) {
1224 String motion = tracker_motion_value.getSelectedItem().toString();
1225 tracker_motion_label.setText(get_tracker_motion_label());
1226 set_tracker_motion_values();
1228 int m = (int) (AltosConvert.height.parse_locale(motion, !imperial_units) + 0.5);
1229 set_tracker_motion(m);
1230 } catch (ParseException pe) {
1238 public void set_apogee_delay(int new_apogee_delay) {
1239 if (new_apogee_delay != AltosLib.MISSING)
1240 apogee_delay_value.setSelectedItem(Integer.toString(new_apogee_delay));
1241 apogee_delay_value.setVisible(new_apogee_delay != AltosLib.MISSING);
1242 apogee_delay_label.setVisible(new_apogee_delay != AltosLib.MISSING);
1245 private int parse_int(String name, String s, boolean split) throws AltosConfigDataException {
1248 v = s.split("\\s+")[0];
1250 return Integer.parseInt(v);
1251 } catch (NumberFormatException ne) {
1252 throw new AltosConfigDataException("Invalid %s \"%s\"", name, s);
1256 public int apogee_delay() throws AltosConfigDataException {
1257 return parse_int("apogee delay", apogee_delay_value.getSelectedItem().toString(), false);
1260 public void set_apogee_lockout(int new_apogee_lockout) {
1261 if (new_apogee_lockout != AltosLib.MISSING)
1262 apogee_lockout_value.setSelectedItem(Integer.toString(new_apogee_lockout));
1264 apogee_lockout_value.setVisible(new_apogee_lockout != AltosLib.MISSING);
1265 apogee_lockout_label.setVisible(new_apogee_lockout != AltosLib.MISSING);
1268 public int apogee_lockout() throws AltosConfigDataException {
1269 return parse_int("apogee lockout", apogee_lockout_value.getSelectedItem().toString(), false);
1272 public void set_radio_frequency(double new_radio_frequency) {
1273 if (new_radio_frequency != AltosLib.MISSING)
1274 radio_frequency_value.set_frequency(new_radio_frequency);
1275 radio_frequency_label.setVisible(new_radio_frequency != AltosLib.MISSING);
1276 radio_frequency_value.setVisible(new_radio_frequency != AltosLib.MISSING);
1279 public double radio_frequency() {
1280 return radio_frequency_value.frequency();
1283 public void set_radio_calibration(int new_radio_calibration) {
1284 if (new_radio_calibration != AltosLib.MISSING)
1285 radio_calibration_value.setText(String.format("%d", new_radio_calibration));
1286 radio_calibration_value.setVisible(new_radio_calibration != AltosLib.MISSING);
1287 radio_calibration_label.setVisible(new_radio_calibration != AltosLib.MISSING);
1290 public void set_radio_enable(int new_radio_enable) {
1291 if (new_radio_enable != AltosLib.MISSING)
1292 radio_enable_value.setSelected(new_radio_enable != 0);
1293 radio_enable_label.setVisible(new_radio_enable != AltosLib.MISSING);
1294 radio_enable_value.setVisible(new_radio_enable != AltosLib.MISSING);
1295 set_radio_enable_tool_tip();
1298 public int radio_enable() {
1299 if (radio_enable_value.isVisible())
1300 return radio_enable_value.isSelected() ? 1 : 0;
1302 return AltosLib.MISSING;
1305 public void set_telemetry_rate(int new_rate) {
1306 if (new_rate != AltosLib.MISSING)
1307 rate_value.set_rate(new_rate);
1308 rate_label.setVisible(new_rate != AltosLib.MISSING);
1309 rate_value.setVisible(new_rate != AltosLib.MISSING);
1310 set_rate_tool_tip();
1313 public int telemetry_rate() {
1314 return rate_value.rate();
1317 public void set_callsign(String new_callsign) {
1318 if (new_callsign != null)
1319 callsign_value.setText(new_callsign);
1320 callsign_value.setVisible(new_callsign != null);
1321 callsign_label.setVisible(new_callsign != null);
1324 public String callsign() {
1325 if (callsign_value.isVisible())
1326 return callsign_value.getText();
1330 int flight_log_max_limit;
1333 public String flight_log_max_label(int flight_log_max) {
1334 if (flight_log_max_limit != 0) {
1335 int nflight = flight_log_max_limit / flight_log_max;
1336 String plural = nflight > 1 ? "s" : "";
1338 return String.format("%d (%d flight%s)", flight_log_max, nflight, plural);
1340 return String.format("%d", flight_log_max);
1343 public void set_flight_log_max(int new_flight_log_max) {
1344 if (new_flight_log_max != AltosLib.MISSING) {
1345 flight_log_max_value.setSelectedItem(flight_log_max_label(new_flight_log_max));
1346 flight_log_max = new_flight_log_max;
1348 flight_log_max_value.setVisible(new_flight_log_max != AltosLib.MISSING);
1349 flight_log_max_label.setVisible(new_flight_log_max != AltosLib.MISSING);
1350 set_flight_log_max_tool_tip();
1353 public void set_flight_log_max_enabled(boolean enable) {
1354 flight_log_max_value.setEnabled(enable);
1355 set_flight_log_max_tool_tip();
1358 public int flight_log_max() throws AltosConfigDataException {
1359 if (flight_log_max_value.isVisible())
1360 return parse_int("flight log max", flight_log_max_value.getSelectedItem().toString(), true);
1361 return AltosLib.MISSING;
1364 public void set_flight_log_max_limit(int new_flight_log_max_limit, int new_storage_erase_unit) {
1365 flight_log_max_limit = new_flight_log_max_limit;
1366 if (new_flight_log_max_limit != AltosLib.MISSING) {
1367 flight_log_max_value.removeAllItems();
1368 for (int i = 8; i >= 1; i--) {
1369 int size = flight_log_max_limit / i;
1370 if (new_storage_erase_unit != 0)
1371 size &= ~(new_storage_erase_unit - 1);
1372 flight_log_max_value.addItem(String.format("%d (%d flights)", size, i));
1375 if (flight_log_max != 0 && flight_log_max != AltosLib.MISSING)
1376 set_flight_log_max(flight_log_max);
1379 public void set_ignite_mode(int new_ignite_mode) {
1380 if (new_ignite_mode != AltosLib.MISSING) {
1381 if (new_ignite_mode >= ignite_mode_values.length)
1382 new_ignite_mode = 0;
1383 if (new_ignite_mode < 0) {
1384 ignite_mode_value.setEnabled(false);
1385 new_ignite_mode = 0;
1387 ignite_mode_value.setEnabled(true);
1389 ignite_mode_value.setSelectedIndex(new_ignite_mode);
1391 ignite_mode_value.setVisible(new_ignite_mode != AltosLib.MISSING);
1392 ignite_mode_label.setVisible(new_ignite_mode != AltosLib.MISSING);
1394 set_ignite_mode_tool_tip();
1397 public int ignite_mode() {
1398 if (ignite_mode_value.isVisible())
1399 return ignite_mode_value.getSelectedIndex();
1401 return AltosLib.MISSING;
1405 public void set_pad_orientation(int new_pad_orientation) {
1406 if (new_pad_orientation != AltosLib.MISSING) {
1407 if (new_pad_orientation >= pad_orientation_values.length)
1408 new_pad_orientation = 0;
1409 if (new_pad_orientation < 0)
1410 new_pad_orientation = 0;
1411 pad_orientation_value.setSelectedIndex(new_pad_orientation);
1413 pad_orientation_value.setVisible(new_pad_orientation != AltosLib.MISSING);
1414 pad_orientation_label.setVisible(new_pad_orientation != AltosLib.MISSING);
1415 accel_cal.setVisible(new_pad_orientation != AltosLib.MISSING);
1417 set_pad_orientation_tool_tip();
1420 public int pad_orientation() {
1421 if (pad_orientation_value.isVisible())
1422 return pad_orientation_value.getSelectedIndex();
1424 return AltosLib.MISSING;
1427 public void set_accel_cal(int accel_plus, int accel_minus) {
1428 if (accel_plus != AltosLib.MISSING) {
1429 accel_plus_value.setText(String.format("%d", accel_plus));
1430 accel_minus_value.setText(String.format("%d", accel_minus));
1432 accel_plus_value.setVisible(accel_plus != AltosLib.MISSING);
1433 accel_plus_label.setVisible(accel_plus != AltosLib.MISSING);
1434 accel_minus_value.setVisible(accel_minus != AltosLib.MISSING);
1435 accel_minus_label.setVisible(accel_minus != AltosLib.MISSING);
1437 set_accel_tool_tips();
1440 public int accel_cal_plus() {
1441 if (accel_plus_value.isVisible())
1442 return Integer.parseInt(accel_plus_value.getText());
1443 return AltosLib.MISSING;
1446 public int accel_cal_minus() {
1447 if (accel_minus_value.isVisible())
1448 return Integer.parseInt(accel_minus_value.getText());
1449 return AltosLib.MISSING;
1452 public void set_beep(int new_beep) {
1453 if (new_beep != AltosLib.MISSING) {
1454 int new_freq = (int) Math.floor (AltosConvert.beep_value_to_freq(new_beep) + 0.5);
1455 for (int i = 0; i < beep_values.length; i++)
1456 if (new_beep == AltosConvert.beep_freq_to_value(Integer.parseInt(beep_values[i]))) {
1457 beep_value.setSelectedIndex(i);
1458 set_beep_tool_tip();
1461 beep_value.setSelectedItem(String.format("%d", new_freq));
1463 beep_value.setVisible(new_beep != AltosLib.MISSING);
1464 beep_label.setVisible(new_beep != AltosLib.MISSING);
1465 set_beep_tool_tip();
1469 if (beep_value.isVisible())
1470 return AltosConvert.beep_freq_to_value(Integer.parseInt(beep_value.getSelectedItem().toString()));
1472 return AltosLib.MISSING;
1475 public void set_radio_10mw(int new_radio_10mw) {
1476 if (new_radio_10mw != AltosLib.MISSING) {
1477 radio_10mw_value.setSelected(new_radio_10mw != 0);
1479 radio_10mw_value.setVisible(new_radio_10mw != AltosLib.MISSING);
1480 radio_10mw_label.setVisible(new_radio_10mw != AltosLib.MISSING);
1481 set_radio_10mw_tool_tip();
1484 public int radio_10mw() {
1485 if (radio_10mw_value.isVisible())
1486 return radio_10mw_value.isSelected() ? 1 : 0;
1488 return AltosLib.MISSING;
1491 String[] tracker_motion_values() {
1492 if (AltosConvert.imperial_units)
1493 return tracker_motion_values_ft;
1495 return tracker_motion_values_m;
1498 void set_tracker_motion_values() {
1499 String[] v = tracker_motion_values();
1500 while (tracker_motion_value.getItemCount() > 0)
1501 tracker_motion_value.removeItemAt(0);
1502 for (int i = 0; i < v.length; i++)
1503 tracker_motion_value.addItem(v[i]);
1504 tracker_motion_value.setMaximumRowCount(v.length);
1507 String get_tracker_motion_label() {
1508 return String.format("Logging Trigger Motion (%s):", AltosConvert.height.parse_units());
1511 void set_tracker_tool_tip() {
1512 if (tracker_motion_value.isVisible())
1513 tracker_motion_value.setToolTipText("How far the device must move before logging");
1515 tracker_motion_value.setToolTipText("This device doesn't disable logging when stationary");
1516 if (tracker_interval_value.isVisible())
1517 tracker_interval_value.setToolTipText("How often to report GPS position");
1519 tracker_interval_value.setToolTipText("This device can't configure interval");
1522 public void set_tracker_motion(int tracker_motion) {
1523 if (tracker_motion != AltosLib.MISSING)
1524 tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion));
1525 tracker_motion_label.setVisible(tracker_motion != AltosLib.MISSING);
1526 tracker_motion_value.setVisible(tracker_motion != AltosLib.MISSING);
1529 public int tracker_motion() throws AltosConfigDataException {
1530 if (tracker_motion_value.isVisible()) {
1531 String str = tracker_motion_value.getSelectedItem().toString();
1533 return (int) (AltosConvert.height.parse_locale(str) + 0.5);
1534 } catch (ParseException pe) {
1535 throw new AltosConfigDataException("invalid tracker motion %s", str);
1538 return AltosLib.MISSING;
1541 public void set_tracker_interval(int tracker_interval) {
1542 if (tracker_interval != AltosLib.MISSING)
1543 tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval));
1544 tracker_interval_label.setVisible(tracker_interval != AltosLib.MISSING);
1545 tracker_interval_value.setVisible(tracker_interval != AltosLib.MISSING);
1548 public int tracker_interval() throws AltosConfigDataException {
1549 if (tracker_interval_value.isVisible())
1550 return parse_int ("tracker interval", tracker_interval_value.getSelectedItem().toString(), false);
1551 return AltosLib.MISSING;
1554 public void set_pyros(AltosPyro[] new_pyros) {
1556 if (pyros != null && pyro_ui != null)
1557 pyro_ui.set_pyros(pyros);
1558 pyro.setVisible(pyros != null);
1561 public AltosPyro[] pyros() throws AltosConfigDataException {
1562 if (pyro_ui != null)
1563 pyros = pyro_ui.get_pyros();
1567 public void set_pyro_firing_time(double new_pyro_firing_time) {
1568 pyro_firing_time = new_pyro_firing_time;
1569 if (pyro_firing_time != AltosLib.MISSING && pyro_ui != null)
1570 pyro_ui.set_pyro_firing_time(pyro_firing_time);
1571 pyro.setVisible(pyro_firing_time != AltosLib.MISSING);
1574 public double pyro_firing_time() throws AltosConfigDataException {
1575 if (pyro_ui != null)
1576 pyro_firing_time = pyro_ui.get_pyro_firing_time();
1577 return pyro_firing_time;
1580 private String aprs_interval_string(int interval) {
1583 return Integer.toString(interval);
1586 private int aprs_interval_value(String interval) throws AltosConfigDataException {
1587 if (interval.equalsIgnoreCase("Disabled"))
1589 return parse_int("aprs interval", interval, false);
1592 public void set_aprs_interval(int new_aprs_interval) {
1593 if (new_aprs_interval != AltosLib.MISSING)
1594 aprs_interval_value.setSelectedItem(aprs_interval_string(new_aprs_interval));
1595 aprs_interval_value.setVisible(new_aprs_interval != AltosLib.MISSING);
1596 aprs_interval_label.setVisible(new_aprs_interval != AltosLib.MISSING);
1597 set_aprs_interval_tool_tip();
1600 public int aprs_interval() throws AltosConfigDataException {
1601 if (aprs_interval_value.isVisible())
1602 return aprs_interval_value(aprs_interval_value.getSelectedItem().toString());
1603 return AltosLib.MISSING;
1606 public void set_aprs_ssid(int new_aprs_ssid) {
1607 if (new_aprs_ssid != AltosLib.MISSING)
1608 aprs_ssid_value.setSelectedItem(new_aprs_ssid);
1609 aprs_ssid_value.setVisible(new_aprs_ssid != AltosLib.MISSING);
1610 aprs_ssid_label.setVisible(new_aprs_ssid != AltosLib.MISSING);
1611 set_aprs_ssid_tool_tip();
1614 public int aprs_ssid() throws AltosConfigDataException {
1615 if (aprs_ssid_value.isVisible()) {
1616 Integer i = (Integer) aprs_ssid_value.getSelectedItem();
1619 return AltosLib.MISSING;
1622 public void set_aprs_format(int new_aprs_format) {
1623 if (new_aprs_format != AltosLib.MISSING)
1624 aprs_format_value.setSelectedIndex(new_aprs_format);
1625 aprs_format_value.setVisible(new_aprs_format != AltosLib.MISSING);
1626 aprs_format_label.setVisible(new_aprs_format != AltosLib.MISSING);
1627 set_aprs_format_tool_tip();
1630 public int aprs_format() throws AltosConfigDataException {
1631 if (aprs_format_value.isVisible())
1632 return aprs_format_value.getSelectedIndex();
1633 return AltosLib.MISSING;
1636 public void set_aprs_offset(int new_aprs_offset) {
1637 if (new_aprs_offset != AltosLib.MISSING)
1638 aprs_offset_value.setSelectedItem(new_aprs_offset);
1639 aprs_offset_value.setVisible(new_aprs_offset != AltosLib.MISSING);
1640 aprs_offset_label.setVisible(new_aprs_offset != AltosLib.MISSING);
1641 set_aprs_offset_tool_tip();
1644 public int aprs_offset() throws AltosConfigDataException {
1645 if (aprs_offset_value.isVisible()) {
1646 Integer i = (Integer) aprs_offset_value.getSelectedItem();
1649 return AltosLib.MISSING;