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;
46 JLabel report_feet_label;
48 JLabel aprs_interval_label;
49 JLabel aprs_ssid_label;
50 JLabel aprs_format_label;
51 JLabel aprs_offset_label;
52 JLabel flight_log_max_label;
53 JLabel ignite_mode_label;
54 JLabel pad_orientation_label;
55 JLabel accel_plus_label;
56 JLabel accel_minus_label;
57 JLabel callsign_label;
59 JLabel tracker_motion_label;
60 JLabel tracker_interval_label;
68 JComboBox<String> main_deploy_value;
69 JComboBox<String> apogee_delay_value;
70 JComboBox<String> apogee_lockout_value;
71 AltosUIFreqList radio_frequency_value;
72 JLabel radio_calibration_value;
73 JRadioButton radio_enable_value;
74 JRadioButton radio_10mw_value;
75 JComboBox<String> report_feet_value;
76 AltosUIRateList rate_value;
77 JComboBox<String> aprs_interval_value;
78 JComboBox<Integer> aprs_ssid_value;
79 JComboBox<String> aprs_format_value;
80 JComboBox<Integer> aprs_offset_value;
81 JComboBox<String> flight_log_max_value;
82 JComboBox<String> ignite_mode_value;
83 JComboBox<String> pad_orientation_value;
84 JTextField accel_plus_value;
85 JTextField accel_minus_value;
86 JTextField callsign_value;
87 JComboBox<String> beep_value;
88 JComboBox<String> tracker_motion_value;
89 JComboBox<String> tracker_interval_value;
100 double pyro_firing_time;
102 ActionListener listener;
104 static final String title = "Configure Flight Computer";
106 static String[] main_deploy_values_m = {
107 "100", "150", "200", "250", "300", "350",
111 static String[] main_deploy_values_ft = {
112 "250", "500", "750", "1000", "1250", "1500",
116 static String[] apogee_delay_values = {
117 "0", "1", "2", "3", "4", "5"
120 static String[] apogee_lockout_values = {
121 "0", "5", "10", "15", "20"
124 static String[] ignite_mode_values = {
128 "Separation & Apogee",
131 static String[] aprs_interval_values = {
138 static Integer[] aprs_ssid_values = {
139 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
142 static Integer[] aprs_offset_values = {
143 0, 2, 4, 6, 8, 10, 12, 14, 16, 18
146 static String[] beep_values = {
155 static String[] pad_orientation_values_radio = {
160 static String[] pad_orientation_values_no_radio = {
165 String[] pad_orientation_values;
167 static String[] tracker_motion_values_m = {
174 static String[] tracker_motion_values_ft = {
181 static String[] tracker_interval_values = {
188 static String[] report_feet_values = {
193 /* A window listener to catch closing events and tell the config code */
194 class ConfigListener extends WindowAdapter {
197 public ConfigListener(AltosConfigFCUI this_ui) {
201 public void windowClosing(WindowEvent e) {
202 ui.actionPerformed(new ActionEvent(e.getSource(),
203 ActionEvent.ACTION_PERFORMED,
208 boolean is_telemini_v1() {
209 String product = product_value.getText();
210 return product != null && product.startsWith("TeleMini-v1");
213 boolean is_telemini() {
214 String product = product_value.getText();
215 return product != null && product.startsWith("TeleMini");
218 boolean is_easymini() {
219 String product = product_value.getText();
220 return product != null && product.startsWith("EasyMini");
223 boolean is_telemetrum() {
224 String product = product_value.getText();
225 return product != null && product.startsWith("TeleMetrum");
228 boolean is_telemega() {
229 String product = product_value.getText();
230 return product != null && product.startsWith("TeleMega");
233 boolean is_easymega() {
234 String product = product_value.getText();
235 return product != null && product.startsWith("EasyMega");
238 boolean is_easytimer() {
239 String product = product_value.getText();
240 return product != null && product.startsWith("EasyTimer");
243 boolean has_radio() {
244 return is_telemega() || is_telemetrum() || is_telemini();
247 void set_radio_enable_tool_tip() {
248 if (radio_enable_value.isVisible())
249 radio_enable_value.setToolTipText("Enable/Disable telemetry and RDF transmissions");
251 radio_enable_value.setToolTipText("Firmware version does not support disabling radio");
254 void set_rate_tool_tip() {
255 if (rate_value.isVisible())
256 rate_value.setToolTipText("Select telemetry baud rate");
258 rate_value.setToolTipText("Firmware version does not support variable telemetry rates");
261 void set_aprs_interval_tool_tip() {
262 if (aprs_interval_value.isVisible())
263 aprs_interval_value.setToolTipText("Enable APRS and set the interval between APRS reports");
265 aprs_interval_value.setToolTipText("Hardware doesn't support APRS");
268 void set_aprs_ssid_tool_tip() {
269 if (aprs_ssid_value.isVisible())
270 aprs_ssid_value.setToolTipText("Set the APRS SSID (secondary station identifier)");
271 else if (aprs_ssid_value.isVisible())
272 aprs_ssid_value.setToolTipText("Software version doesn't support setting the APRS SSID");
274 aprs_ssid_value.setToolTipText("Hardware doesn't support APRS");
277 void set_aprs_format_tool_tip() {
278 if (aprs_format_value.isVisible())
279 aprs_format_value.setToolTipText("Set the APRS format (compressed/uncompressed)");
280 else if (aprs_format_value.isVisible())
281 aprs_format_value.setToolTipText("Software version doesn't support setting the APRS format");
283 aprs_format_value.setToolTipText("Hardware doesn't support APRS");
286 void set_aprs_offset_tool_tip() {
287 if (aprs_offset_value.isVisible())
288 aprs_offset_value.setToolTipText("Set the APRS offset from top of minute");
289 else if (aprs_offset_value.isVisible())
290 aprs_offset_value.setToolTipText("Software version doesn't support setting the APRS offset");
292 aprs_offset_value.setToolTipText("Hardware doesn't support APRS");
295 void set_flight_log_max_tool_tip() {
296 if (flight_log_max_value.isVisible())
297 flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)");
299 if (is_telemini_v1())
300 flight_log_max_value.setToolTipText("TeleMini-v1 stores only one flight");
302 flight_log_max_value.setToolTipText("Cannot set max value with flight logs in memory");
306 void set_ignite_mode_tool_tip() {
307 if (ignite_mode_value.isVisible())
308 ignite_mode_value.setToolTipText("Select when igniters will be fired");
310 ignite_mode_value.setToolTipText("Older firmware could not select ignite mode");
313 void set_pad_orientation_tool_tip() {
314 if (pad_orientation_value.isVisible()) {
315 pad_orientation_value.setToolTipText("How will the computer be mounted in the airframe");
318 pad_orientation_value.setToolTipText("Older TeleMetrum firmware must fly antenna forward");
319 else if (is_telemini() || is_easymini())
320 pad_orientation_value.setToolTipText("TeleMini and EasyMini don't care how they are mounted");
321 else if (is_easytimer())
322 pad_orientation_value.setToolTipText("EasyTimer can be mounted in any of six orientations");
324 pad_orientation_value.setToolTipText("Can't select orientation");
328 void set_pad_orientation_values() {
329 String [] new_values;
331 new_values = pad_orientation_values_radio;
333 new_values = pad_orientation_values_no_radio;
334 if (new_values != pad_orientation_values) {
335 int id = pad_orientation_value.getSelectedIndex();
336 pad_orientation_value.removeAllItems();
337 pad_orientation_values = new_values;
338 for (int i = 0; i < new_values.length; i++)
339 pad_orientation_value.addItem(pad_orientation_values[i]);
340 pad_orientation_value.setSelectedIndex(id);
344 void set_accel_tool_tips() {
345 if (accel_plus_value.isVisible()) {
346 accel_plus_value.setToolTipText("Pad acceleration value in flight orientation");
347 accel_minus_value.setToolTipText("Upside-down acceleration value");
349 accel_plus_value.setToolTipText("No accelerometer");
350 accel_minus_value.setToolTipText("No accelerometer");
354 void set_beep_tool_tip() {
355 if (beep_value.isVisible())
356 beep_value.setToolTipText("What frequency the beeper will sound at");
358 beep_value.setToolTipText("Older firmware could not select beeper frequency");
361 void set_radio_10mw_tool_tip() {
362 if (radio_10mw_value.isVisible())
363 radio_10mw_value.setToolTipText("Should transmitter power be limited to 10mW");
365 radio_10mw_value.setToolTipText("Older firmware could not limit radio power");
368 void set_report_feet_tool_tip() {
369 if (report_feet_value.isVisible())
370 report_feet_value.setToolTipText("Units used after landing to beep max height");
372 report_feet_value.setToolTipText("Older firmware always beeps max height in meters");
375 /* Build the UI using a grid bag */
376 public AltosConfigFCUI(JFrame in_owner, boolean remote) {
377 super (in_owner, title, false);
380 GridBagConstraints c;
383 Insets il = new Insets(4,4,4,4);
384 Insets ir = new Insets(4,4,4,4);
386 pane = getScrollablePane();
388 pane.setLayout(new GridBagLayout());
391 c = new GridBagConstraints();
392 c.gridx = 0; c.gridy = row;
394 c.fill = GridBagConstraints.NONE;
395 c.anchor = GridBagConstraints.LINE_START;
397 product_label = new JLabel("Product:");
398 pane.add(product_label, c);
400 c = new GridBagConstraints();
401 c.gridx = 4; c.gridy = row;
403 c.fill = GridBagConstraints.HORIZONTAL;
405 c.anchor = GridBagConstraints.LINE_START;
407 product_value = new JLabel("");
408 pane.add(product_value, c);
412 c = new GridBagConstraints();
413 c.gridx = 0; c.gridy = row;
415 c.fill = GridBagConstraints.NONE;
416 c.anchor = GridBagConstraints.LINE_START;
419 version_label = new JLabel("Software version:");
420 pane.add(version_label, c);
422 c = new GridBagConstraints();
423 c.gridx = 4; c.gridy = row;
425 c.fill = GridBagConstraints.HORIZONTAL;
427 c.anchor = GridBagConstraints.LINE_START;
430 version_value = new JLabel("");
431 pane.add(version_value, c);
435 c = new GridBagConstraints();
436 c.gridx = 0; c.gridy = row;
438 c.fill = GridBagConstraints.NONE;
439 c.anchor = GridBagConstraints.LINE_START;
442 serial_label = new JLabel("Serial:");
443 pane.add(serial_label, c);
445 c = new GridBagConstraints();
446 c.gridx = 4; c.gridy = row;
448 c.fill = GridBagConstraints.HORIZONTAL;
450 c.anchor = GridBagConstraints.LINE_START;
453 serial_value = new JLabel("");
454 pane.add(serial_value, c);
458 c = new GridBagConstraints();
459 c.gridx = 0; c.gridy = row;
461 c.fill = GridBagConstraints.NONE;
462 c.anchor = GridBagConstraints.LINE_START;
465 main_deploy_label = new JLabel(get_main_deploy_label());
466 pane.add(main_deploy_label, c);
468 c = new GridBagConstraints();
469 c.gridx = 4; c.gridy = row;
471 c.fill = GridBagConstraints.HORIZONTAL;
473 c.anchor = GridBagConstraints.LINE_START;
476 main_deploy_value = new JComboBox<String>(main_deploy_values());
477 main_deploy_value.setEditable(true);
478 main_deploy_value.addItemListener(this);
479 pane.add(main_deploy_value, c);
480 main_deploy_value.setToolTipText("Height above pad altitude to fire main charge");
484 c = new GridBagConstraints();
485 c.gridx = 0; c.gridy = row;
487 c.fill = GridBagConstraints.NONE;
488 c.anchor = GridBagConstraints.LINE_START;
491 apogee_delay_label = new JLabel("Apogee Delay(s):");
492 pane.add(apogee_delay_label, c);
494 c = new GridBagConstraints();
495 c.gridx = 4; c.gridy = row;
497 c.fill = GridBagConstraints.HORIZONTAL;
499 c.anchor = GridBagConstraints.LINE_START;
502 apogee_delay_value = new JComboBox<String>(apogee_delay_values);
503 apogee_delay_value.setEditable(true);
504 apogee_delay_value.addItemListener(this);
505 pane.add(apogee_delay_value, c);
506 apogee_delay_value.setToolTipText("Delay after apogee before charge fires");
510 c = new GridBagConstraints();
511 c.gridx = 0; c.gridy = row;
513 c.fill = GridBagConstraints.NONE;
514 c.anchor = GridBagConstraints.LINE_START;
517 apogee_lockout_label = new JLabel("Apogee Lockout(s):");
518 pane.add(apogee_lockout_label, c);
520 c = new GridBagConstraints();
521 c.gridx = 4; c.gridy = row;
523 c.fill = GridBagConstraints.HORIZONTAL;
525 c.anchor = GridBagConstraints.LINE_START;
528 apogee_lockout_value = new JComboBox<String>(apogee_lockout_values);
529 apogee_lockout_value.setEditable(true);
530 apogee_lockout_value.addItemListener(this);
531 pane.add(apogee_lockout_value, c);
532 apogee_lockout_value.setToolTipText("Time after launch while apogee detection is locked out");
536 c = new GridBagConstraints();
537 c.gridx = 0; c.gridy = row;
539 c.fill = GridBagConstraints.NONE;
540 c.anchor = GridBagConstraints.LINE_START;
543 radio_frequency_label = new JLabel("Frequency:");
544 pane.add(radio_frequency_label, c);
546 c = new GridBagConstraints();
547 c.gridx = 4; c.gridy = row;
549 c.fill = GridBagConstraints.HORIZONTAL;
551 c.anchor = GridBagConstraints.LINE_START;
554 radio_frequency_value = new AltosUIFreqList();
555 radio_frequency_value.addItemListener(this);
556 pane.add(radio_frequency_value, c);
557 radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
560 /* Radio Calibration */
561 c = new GridBagConstraints();
562 c.gridx = 0; c.gridy = row;
564 c.fill = GridBagConstraints.NONE;
565 c.anchor = GridBagConstraints.LINE_START;
568 radio_calibration_label = new JLabel("RF Calibration:");
569 pane.add(radio_calibration_label, c);
571 c = new GridBagConstraints();
572 c.gridx = 4; c.gridy = row;
574 c.fill = GridBagConstraints.HORIZONTAL;
576 c.anchor = GridBagConstraints.LINE_START;
579 radio_calibration_value = new JLabel(String.format("%d", 1186611));
580 pane.add(radio_calibration_value, c);
584 c = new GridBagConstraints();
585 c.gridx = 0; c.gridy = row;
587 c.fill = GridBagConstraints.NONE;
588 c.anchor = GridBagConstraints.LINE_START;
591 radio_enable_label = new JLabel("Telemetry/RDF/APRS Enable:");
592 pane.add(radio_enable_label, c);
594 c = new GridBagConstraints();
595 c.gridx = 4; c.gridy = row;
597 c.fill = GridBagConstraints.HORIZONTAL;
599 c.anchor = GridBagConstraints.LINE_START;
602 radio_enable_value = new JRadioButton("Enabled");
603 radio_enable_value.addItemListener(this);
604 pane.add(radio_enable_value, c);
605 set_radio_enable_tool_tip();
608 /* Radio 10mW limit */
609 c = new GridBagConstraints();
610 c.gridx = 0; c.gridy = row;
612 c.fill = GridBagConstraints.NONE;
613 c.anchor = GridBagConstraints.LINE_START;
616 radio_10mw_label = new JLabel("Limit transmit to 10mW:");
617 pane.add(radio_10mw_label, c);
619 c = new GridBagConstraints();
620 c.gridx = 4; c.gridy = row;
622 c.fill = GridBagConstraints.HORIZONTAL;
624 c.anchor = GridBagConstraints.LINE_START;
627 radio_10mw_value = new JRadioButton("Limited");
628 radio_10mw_value.addItemListener(this);
629 pane.add(radio_10mw_value, c);
630 set_radio_10mw_tool_tip();
634 c = new GridBagConstraints();
635 c.gridx = 0; c.gridy = row;
637 c.fill = GridBagConstraints.NONE;
638 c.anchor = GridBagConstraints.LINE_START;
641 report_feet_label = new JLabel("Beep max height in:");
642 pane.add(report_feet_label, c);
644 c = new GridBagConstraints();
645 c.gridx = 4; c.gridy = row;
647 c.fill = GridBagConstraints.HORIZONTAL;
649 c.anchor = GridBagConstraints.LINE_START;
652 report_feet_value = new JComboBox<String>(report_feet_values);
653 report_feet_value.setEditable(false);
654 report_feet_value.addItemListener(this);
655 pane.add(report_feet_value, c);
656 set_report_feet_tool_tip();
660 c = new GridBagConstraints();
661 c.gridx = 0; c.gridy = row;
663 c.fill = GridBagConstraints.NONE;
664 c.anchor = GridBagConstraints.LINE_START;
667 rate_label = new JLabel("Telemetry baud rate:");
668 pane.add(rate_label, c);
670 c = new GridBagConstraints();
671 c.gridx = 4; c.gridy = row;
673 c.fill = GridBagConstraints.HORIZONTAL;
675 c.anchor = GridBagConstraints.LINE_START;
678 rate_value = new AltosUIRateList();
679 rate_value.addItemListener(this);
680 pane.add(rate_value, c);
685 c = new GridBagConstraints();
686 c.gridx = 0; c.gridy = row;
688 c.fill = GridBagConstraints.NONE;
689 c.anchor = GridBagConstraints.LINE_START;
692 aprs_interval_label = new JLabel("APRS Interval(s):");
693 pane.add(aprs_interval_label, c);
695 c = new GridBagConstraints();
696 c.gridx = 4; c.gridy = row;
698 c.fill = GridBagConstraints.HORIZONTAL;
700 c.anchor = GridBagConstraints.LINE_START;
703 aprs_interval_value = new JComboBox<String>(aprs_interval_values);
704 aprs_interval_value.setEditable(true);
705 aprs_interval_value.addItemListener(this);
706 pane.add(aprs_interval_value, c);
707 set_aprs_interval_tool_tip();
711 c = new GridBagConstraints();
712 c.gridx = 0; c.gridy = row;
714 c.fill = GridBagConstraints.NONE;
715 c.anchor = GridBagConstraints.LINE_START;
718 aprs_ssid_label = new JLabel("APRS SSID:");
719 pane.add(aprs_ssid_label, c);
721 c = new GridBagConstraints();
722 c.gridx = 4; c.gridy = row;
724 c.fill = GridBagConstraints.HORIZONTAL;
726 c.anchor = GridBagConstraints.LINE_START;
729 aprs_ssid_value = new JComboBox<Integer>(aprs_ssid_values);
730 aprs_ssid_value.setEditable(false);
731 aprs_ssid_value.addItemListener(this);
732 aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length);
733 pane.add(aprs_ssid_value, c);
734 set_aprs_ssid_tool_tip();
738 c = new GridBagConstraints();
739 c.gridx = 0; c.gridy = row;
741 c.fill = GridBagConstraints.NONE;
742 c.anchor = GridBagConstraints.LINE_START;
745 aprs_format_label = new JLabel("APRS format:");
746 pane.add(aprs_format_label, c);
748 c = new GridBagConstraints();
749 c.gridx = 4; c.gridy = row;
751 c.fill = GridBagConstraints.HORIZONTAL;
753 c.anchor = GridBagConstraints.LINE_START;
756 aprs_format_value = new JComboBox<String>(AltosLib.ao_aprs_format_name);
757 aprs_format_value.setEditable(false);
758 aprs_format_value.addItemListener(this);
759 aprs_format_value.setMaximumRowCount(AltosLib.ao_aprs_format_name.length);
760 pane.add(aprs_format_value, c);
761 set_aprs_format_tool_tip();
765 c = new GridBagConstraints();
766 c.gridx = 0; c.gridy = row;
768 c.fill = GridBagConstraints.NONE;
769 c.anchor = GridBagConstraints.LINE_START;
772 aprs_offset_label = new JLabel("APRS offset:");
773 pane.add(aprs_offset_label, c);
775 c = new GridBagConstraints();
776 c.gridx = 4; c.gridy = row;
778 c.fill = GridBagConstraints.HORIZONTAL;
780 c.anchor = GridBagConstraints.LINE_START;
783 aprs_offset_value = new JComboBox<Integer>(aprs_offset_values);
784 aprs_offset_value.setEditable(false);
785 aprs_offset_value.addItemListener(this);
786 aprs_offset_value.setMaximumRowCount(aprs_offset_values.length);
787 pane.add(aprs_offset_value, c);
788 set_aprs_offset_tool_tip();
792 c = new GridBagConstraints();
793 c.gridx = 0; c.gridy = row;
795 c.fill = GridBagConstraints.NONE;
796 c.anchor = GridBagConstraints.LINE_START;
799 callsign_label = new JLabel("Callsign:");
800 pane.add(callsign_label, c);
802 c = new GridBagConstraints();
803 c.gridx = 4; c.gridy = row;
805 c.fill = GridBagConstraints.HORIZONTAL;
807 c.anchor = GridBagConstraints.LINE_START;
810 callsign_value = new JTextField(AltosUIPreferences.callsign());
811 callsign_value.getDocument().addDocumentListener(this);
812 pane.add(callsign_value, c);
813 callsign_value.setToolTipText("Callsign reported in telemetry data");
817 c = new GridBagConstraints();
818 c.gridx = 0; c.gridy = row;
820 c.fill = GridBagConstraints.NONE;
821 c.anchor = GridBagConstraints.LINE_START;
824 flight_log_max_label = new JLabel("Maximum Flight Log Size (kB):");
825 pane.add(flight_log_max_label, c);
827 c = new GridBagConstraints();
828 c.gridx = 4; c.gridy = row;
830 c.fill = GridBagConstraints.HORIZONTAL;
832 c.anchor = GridBagConstraints.LINE_START;
835 flight_log_max_value = new JComboBox<String>();
836 flight_log_max_value.setEditable(true);
837 flight_log_max_value.addItemListener(this);
838 pane.add(flight_log_max_value, c);
839 set_flight_log_max_tool_tip();
843 c = new GridBagConstraints();
844 c.gridx = 0; c.gridy = row;
846 c.fill = GridBagConstraints.NONE;
847 c.anchor = GridBagConstraints.LINE_START;
850 ignite_mode_label = new JLabel("Igniter Firing Mode:");
851 pane.add(ignite_mode_label, c);
853 c = new GridBagConstraints();
854 c.gridx = 4; c.gridy = row;
856 c.fill = GridBagConstraints.HORIZONTAL;
858 c.anchor = GridBagConstraints.LINE_START;
861 ignite_mode_value = new JComboBox<String>(ignite_mode_values);
862 ignite_mode_value.setEditable(false);
863 ignite_mode_value.addItemListener(this);
864 pane.add(ignite_mode_value, c);
865 set_ignite_mode_tool_tip();
868 /* Pad orientation */
869 c = new GridBagConstraints();
870 c.gridx = 0; c.gridy = row;
872 c.fill = GridBagConstraints.NONE;
873 c.anchor = GridBagConstraints.LINE_START;
876 pad_orientation_label = new JLabel("Pad Orientation:");
877 pane.add(pad_orientation_label, c);
879 c = new GridBagConstraints();
880 c.gridx = 4; c.gridy = row;
882 c.fill = GridBagConstraints.HORIZONTAL;
884 c.anchor = GridBagConstraints.LINE_START;
887 pad_orientation_values = pad_orientation_values_no_radio;
889 pad_orientation_value = new JComboBox<String>(pad_orientation_values);
890 pad_orientation_value.setEditable(false);
891 pad_orientation_value.addItemListener(this);
892 pane.add(pad_orientation_value, c);
893 set_pad_orientation_tool_tip();
897 c = new GridBagConstraints();
898 c.gridx = 0; c.gridy = row;
900 c.fill = GridBagConstraints.NONE;
901 c.anchor = GridBagConstraints.LINE_START;
904 accel_plus_label = new JLabel("Accel Plus:");
905 pane.add(accel_plus_label, c);
907 c = new GridBagConstraints();
908 c.gridx = 4; c.gridy = row;
910 c.fill = GridBagConstraints.HORIZONTAL;
912 c.anchor = GridBagConstraints.LINE_START;
915 accel_plus_value = new JTextField(10);
916 accel_plus_value.setEditable(true);
917 accel_plus_value.getDocument().addDocumentListener(this);
918 pane.add(accel_plus_value, c);
922 c = new GridBagConstraints();
923 c.gridx = 0; c.gridy = row;
925 c.fill = GridBagConstraints.NONE;
926 c.anchor = GridBagConstraints.LINE_START;
929 accel_minus_label = new JLabel("Accel Minus:");
930 pane.add(accel_minus_label, c);
932 c = new GridBagConstraints();
933 c.gridx = 4; c.gridy = row;
935 c.fill = GridBagConstraints.HORIZONTAL;
937 c.anchor = GridBagConstraints.LINE_START;
940 accel_minus_value = new JTextField(10);
941 accel_minus_value.setEditable(true);
942 accel_minus_value.getDocument().addDocumentListener(this);
943 pane.add(accel_minus_value, c);
945 set_accel_tool_tips();
948 c = new GridBagConstraints();
949 c.gridx = 0; c.gridy = row;
951 c.fill = GridBagConstraints.NONE;
952 c.anchor = GridBagConstraints.LINE_START;
955 beep_label = new JLabel("Beeper Frequency:");
956 pane.add(beep_label, c);
958 c = new GridBagConstraints();
959 c.gridx = 4; c.gridy = row;
961 c.fill = GridBagConstraints.HORIZONTAL;
963 c.anchor = GridBagConstraints.LINE_START;
966 beep_value = new JComboBox<String>(beep_values);
967 beep_value.setEditable(true);
968 beep_value.addItemListener(this);
969 pane.add(beep_value, c);
973 /* Tracker triger horiz distances */
974 c = new GridBagConstraints();
975 c.gridx = 0; c.gridy = row;
977 c.fill = GridBagConstraints.NONE;
978 c.anchor = GridBagConstraints.LINE_START;
981 tracker_motion_label = new JLabel(get_tracker_motion_label());
982 pane.add(tracker_motion_label, c);
984 c = new GridBagConstraints();
985 c.gridx = 4; c.gridy = row;
987 c.fill = GridBagConstraints.HORIZONTAL;
989 c.anchor = GridBagConstraints.LINE_START;
992 tracker_motion_value = new JComboBox<String>(tracker_motion_values());
993 tracker_motion_value.setEditable(true);
994 tracker_motion_value.addItemListener(this);
995 pane.add(tracker_motion_value, c);
998 /* Tracker triger vert distances */
999 c = new GridBagConstraints();
1000 c.gridx = 0; c.gridy = row;
1002 c.fill = GridBagConstraints.NONE;
1003 c.anchor = GridBagConstraints.LINE_START;
1006 tracker_interval_label = new JLabel("Position Reporting Interval(s):");
1007 pane.add(tracker_interval_label, c);
1009 c = new GridBagConstraints();
1010 c.gridx = 4; c.gridy = row;
1012 c.fill = GridBagConstraints.HORIZONTAL;
1014 c.anchor = GridBagConstraints.LINE_START;
1017 tracker_interval_value = new JComboBox<String>(tracker_interval_values);
1018 tracker_interval_value.setEditable(true);
1019 tracker_interval_value.addItemListener(this);
1020 pane.add(tracker_interval_value, c);
1021 set_tracker_tool_tip();
1025 c = new GridBagConstraints();
1026 c.gridx = 4; c.gridy = row;
1028 c.fill = GridBagConstraints.HORIZONTAL;
1029 c.anchor = GridBagConstraints.LINE_START;
1032 pyro = new JButton("Configure Pyro Channels");
1034 pyro.addActionListener(this);
1035 pyro.setActionCommand("Pyro");
1039 c = new GridBagConstraints();
1040 c.gridx = 5; c.gridy = row;
1042 c.fill = GridBagConstraints.HORIZONTAL;
1043 c.anchor = GridBagConstraints.LINE_START;
1046 accel_cal = new JButton("Calibrate Accelerometer");
1047 pane.add(accel_cal, c);
1048 accel_cal.addActionListener(this);
1049 accel_cal.setActionCommand("Accel");
1053 c = new GridBagConstraints();
1054 c.gridx = 0; c.gridy = row;
1056 c.fill = GridBagConstraints.NONE;
1057 c.anchor = GridBagConstraints.LINE_START;
1059 save = new JButton("Save");
1061 save.addActionListener(this);
1062 save.setActionCommand("Save");
1064 c = new GridBagConstraints();
1065 c.gridx = 2; c.gridy = row;
1067 c.fill = GridBagConstraints.NONE;
1068 c.anchor = GridBagConstraints.CENTER;
1070 reset = new JButton("Reset");
1072 reset.addActionListener(this);
1073 reset.setActionCommand("Reset");
1075 c = new GridBagConstraints();
1076 c.gridx = 4; c.gridy = row;
1078 c.fill = GridBagConstraints.NONE;
1079 c.anchor = GridBagConstraints.CENTER;
1081 reboot = new JButton("Reboot");
1082 pane.add(reboot, c);
1083 reboot.addActionListener(this);
1084 reboot.setActionCommand("Reboot");
1086 c = new GridBagConstraints();
1087 c.gridx = 6; c.gridy = row;
1089 c.fill = GridBagConstraints.NONE;
1090 c.anchor = GridBagConstraints.LINE_END;
1092 close = new JButton("Close");
1094 close.addActionListener(this);
1095 close.setActionCommand("Close");
1097 addWindowListener(new ConfigListener(this));
1098 AltosPreferences.register_units_listener(this);
1101 /* Once the initial values are set, the config code will show the dialog */
1102 public void make_visible() {
1104 setLocationRelativeTo(owner);
1108 /* If any values have been changed, confirm before closing */
1109 public boolean check_dirty(String operation) {
1111 Object[] options = { String.format("%s anyway", operation), "Keep editing" };
1113 i = JOptionPane.showOptionDialog(this,
1114 String.format("Configuration modified. %s anyway?", operation),
1115 "Configuration Modified",
1116 JOptionPane.DEFAULT_OPTION,
1117 JOptionPane.WARNING_MESSAGE,
1118 null, options, options[1]);
1125 public void set_dirty() {
1127 setTitle(title + " (modified)");
1128 save.setEnabled(true);
1131 public void set_clean() {
1134 save.setEnabled(false);
1137 AltosConfigPyroUI pyro_ui;
1139 public void dispose() {
1140 if (pyro_ui != null)
1142 AltosPreferences.unregister_units_listener(this);
1146 /* Listen for events from our buttons */
1147 public void actionPerformed(ActionEvent e) {
1148 String cmd = e.getActionCommand();
1150 if (cmd.equals("Pyro")) {
1151 if (pyro_ui == null && pyros != null)
1152 pyro_ui = new AltosConfigPyroUI(this, pyros, pyro_firing_time);
1153 if (pyro_ui != null)
1154 pyro_ui.make_visible();
1158 if (cmd.equals("Close") || cmd.equals("Reboot"))
1159 if (!check_dirty(cmd))
1161 if (cmd.equals("Save"))
1162 save.setEnabled(false);
1163 listener.actionPerformed(e);
1164 if (cmd.equals("Close") || cmd.equals("Reboot")) {
1170 /* ItemListener interface method */
1171 public void itemStateChanged(ItemEvent e) {
1175 /* DocumentListener interface methods */
1176 public void changedUpdate(DocumentEvent e) {
1180 public void insertUpdate(DocumentEvent e) {
1184 public void removeUpdate(DocumentEvent e) {
1188 /* Let the config code hook on a listener */
1189 public void addActionListener(ActionListener l) {
1193 /* set and get all of the dialog values */
1194 public void set_product(String product) {
1195 radio_frequency_value.set_product(product);
1196 product_value.setText(product);
1197 set_pad_orientation_tool_tip();
1198 set_accel_tool_tips();
1199 set_flight_log_max_tool_tip();
1200 set_pad_orientation_values();
1203 public void set_version(String version) {
1204 version_value.setText(version);
1207 public void set_serial(int serial) {
1208 radio_frequency_value.set_serial(serial);
1209 serial_value.setText(String.format("%d", serial));
1212 public void set_altitude_32(int altitude_32) {
1215 public void set_main_deploy(int new_main_deploy) {
1216 if (new_main_deploy != AltosLib.MISSING)
1217 main_deploy_value.setSelectedItem(AltosConvert.height.say(new_main_deploy));
1218 main_deploy_value.setVisible(new_main_deploy != AltosLib.MISSING);
1219 main_deploy_label.setVisible(new_main_deploy != AltosLib.MISSING);
1222 public int main_deploy() throws AltosConfigDataException {
1223 String str = main_deploy_value.getSelectedItem().toString();
1225 return (int) (AltosConvert.height.parse_locale(str) + 0.5);
1226 } catch (ParseException pe) {
1227 throw new AltosConfigDataException("invalid main deploy height %s", str);
1231 String get_main_deploy_label() {
1232 return String.format("Main Deploy Altitude(%s):", AltosConvert.height.parse_units());
1235 String[] main_deploy_values() {
1236 if (AltosConvert.imperial_units)
1237 return main_deploy_values_ft;
1239 return main_deploy_values_m;
1242 void set_main_deploy_values() {
1243 String[] v = main_deploy_values();
1244 while (main_deploy_value.getItemCount() > 0)
1245 main_deploy_value.removeItemAt(0);
1246 for (int i = 0; i < v.length; i++)
1247 main_deploy_value.addItem(v[i]);
1248 main_deploy_value.setMaximumRowCount(v.length);
1251 public void units_changed(boolean imperial_units) {
1252 boolean was_dirty = dirty;
1254 String v = main_deploy_value.getSelectedItem().toString();
1255 main_deploy_label.setText(get_main_deploy_label());
1256 set_main_deploy_values();
1258 int m = (int) (AltosConvert.height.parse_locale(v, !imperial_units) + 0.5);
1260 } catch (ParseException pe) {
1263 if (tracker_motion_value.isVisible()) {
1264 String motion = tracker_motion_value.getSelectedItem().toString();
1265 tracker_motion_label.setText(get_tracker_motion_label());
1266 set_tracker_motion_values();
1268 int m = (int) (AltosConvert.height.parse_locale(motion, !imperial_units) + 0.5);
1269 set_tracker_motion(m);
1270 } catch (ParseException pe) {
1278 public void set_apogee_delay(int new_apogee_delay) {
1279 if (new_apogee_delay != AltosLib.MISSING)
1280 apogee_delay_value.setSelectedItem(Integer.toString(new_apogee_delay));
1281 apogee_delay_value.setVisible(new_apogee_delay != AltosLib.MISSING);
1282 apogee_delay_label.setVisible(new_apogee_delay != AltosLib.MISSING);
1285 private int parse_int(String name, String s, boolean split) throws AltosConfigDataException {
1288 v = s.split("\\s+")[0];
1290 return Integer.parseInt(v);
1291 } catch (NumberFormatException ne) {
1292 throw new AltosConfigDataException("Invalid %s \"%s\"", name, s);
1296 public int apogee_delay() throws AltosConfigDataException {
1297 return parse_int("apogee delay", apogee_delay_value.getSelectedItem().toString(), false);
1300 public void set_apogee_lockout(int new_apogee_lockout) {
1301 if (new_apogee_lockout != AltosLib.MISSING)
1302 apogee_lockout_value.setSelectedItem(Integer.toString(new_apogee_lockout));
1304 apogee_lockout_value.setVisible(new_apogee_lockout != AltosLib.MISSING);
1305 apogee_lockout_label.setVisible(new_apogee_lockout != AltosLib.MISSING);
1308 public int apogee_lockout() throws AltosConfigDataException {
1309 return parse_int("apogee lockout", apogee_lockout_value.getSelectedItem().toString(), false);
1312 public void set_radio_frequency(double new_radio_frequency) {
1313 if (new_radio_frequency != AltosLib.MISSING)
1314 radio_frequency_value.set_frequency(new_radio_frequency);
1315 radio_frequency_label.setVisible(new_radio_frequency != AltosLib.MISSING);
1316 radio_frequency_value.setVisible(new_radio_frequency != AltosLib.MISSING);
1319 public double radio_frequency() {
1320 return radio_frequency_value.frequency();
1323 public void set_radio_calibration(int new_radio_calibration) {
1324 if (new_radio_calibration != AltosLib.MISSING)
1325 radio_calibration_value.setText(String.format("%d", new_radio_calibration));
1326 radio_calibration_value.setVisible(new_radio_calibration != AltosLib.MISSING);
1327 radio_calibration_label.setVisible(new_radio_calibration != AltosLib.MISSING);
1330 public void set_radio_enable(int new_radio_enable) {
1331 if (new_radio_enable != AltosLib.MISSING)
1332 radio_enable_value.setSelected(new_radio_enable != 0);
1333 radio_enable_label.setVisible(new_radio_enable != AltosLib.MISSING);
1334 radio_enable_value.setVisible(new_radio_enable != AltosLib.MISSING);
1335 set_radio_enable_tool_tip();
1338 public int radio_enable() {
1339 if (radio_enable_value.isVisible())
1340 return radio_enable_value.isSelected() ? 1 : 0;
1342 return AltosLib.MISSING;
1345 public void set_telemetry_rate(int new_rate) {
1346 if (new_rate != AltosLib.MISSING)
1347 rate_value.set_rate(new_rate);
1348 rate_label.setVisible(new_rate != AltosLib.MISSING);
1349 rate_value.setVisible(new_rate != AltosLib.MISSING);
1350 set_rate_tool_tip();
1353 public int telemetry_rate() {
1354 return rate_value.rate();
1357 public void set_callsign(String new_callsign) {
1358 if (new_callsign != null)
1359 callsign_value.setText(new_callsign);
1360 callsign_value.setVisible(new_callsign != null);
1361 callsign_label.setVisible(new_callsign != null);
1364 public String callsign() {
1365 if (callsign_value.isVisible())
1366 return callsign_value.getText();
1370 int flight_log_max_limit;
1373 public String flight_log_max_label(int flight_log_max) {
1374 if (flight_log_max_limit != 0) {
1375 int nflight = flight_log_max_limit / flight_log_max;
1376 String plural = nflight > 1 ? "s" : "";
1378 return String.format("%d (%d flight%s)", flight_log_max, nflight, plural);
1380 return String.format("%d", flight_log_max);
1383 public void set_flight_log_max(int new_flight_log_max) {
1384 if (new_flight_log_max != AltosLib.MISSING) {
1385 flight_log_max_value.setSelectedItem(flight_log_max_label(new_flight_log_max));
1386 flight_log_max = new_flight_log_max;
1388 flight_log_max_value.setVisible(new_flight_log_max != AltosLib.MISSING);
1389 flight_log_max_label.setVisible(new_flight_log_max != AltosLib.MISSING);
1390 set_flight_log_max_tool_tip();
1393 public void set_flight_log_max_enabled(boolean enable) {
1394 flight_log_max_value.setEnabled(enable);
1395 set_flight_log_max_tool_tip();
1398 public int flight_log_max() throws AltosConfigDataException {
1399 if (flight_log_max_value.isVisible())
1400 return parse_int("flight log max", flight_log_max_value.getSelectedItem().toString(), true);
1401 return AltosLib.MISSING;
1404 public void set_flight_log_max_limit(int new_flight_log_max_limit, int new_storage_erase_unit) {
1405 flight_log_max_limit = new_flight_log_max_limit;
1406 if (new_flight_log_max_limit != AltosLib.MISSING) {
1407 flight_log_max_value.removeAllItems();
1408 for (int i = 8; i >= 1; i--) {
1409 int size = flight_log_max_limit / i;
1410 if (new_storage_erase_unit != 0)
1411 size &= ~(new_storage_erase_unit - 1);
1412 flight_log_max_value.addItem(String.format("%d (%d flights)", size, i));
1415 if (flight_log_max != 0 && flight_log_max != AltosLib.MISSING)
1416 set_flight_log_max(flight_log_max);
1419 public void set_ignite_mode(int new_ignite_mode) {
1420 if (new_ignite_mode != AltosLib.MISSING) {
1421 if (new_ignite_mode >= ignite_mode_values.length)
1422 new_ignite_mode = 0;
1423 if (new_ignite_mode < 0) {
1424 ignite_mode_value.setEnabled(false);
1425 new_ignite_mode = 0;
1427 ignite_mode_value.setEnabled(true);
1429 ignite_mode_value.setSelectedIndex(new_ignite_mode);
1431 ignite_mode_value.setVisible(new_ignite_mode != AltosLib.MISSING);
1432 ignite_mode_label.setVisible(new_ignite_mode != AltosLib.MISSING);
1434 set_ignite_mode_tool_tip();
1437 public int ignite_mode() {
1438 if (ignite_mode_value.isVisible())
1439 return ignite_mode_value.getSelectedIndex();
1441 return AltosLib.MISSING;
1445 public void set_pad_orientation(int new_pad_orientation) {
1446 if (new_pad_orientation != AltosLib.MISSING) {
1447 if (new_pad_orientation >= pad_orientation_values.length)
1448 new_pad_orientation = 0;
1449 if (new_pad_orientation < 0)
1450 new_pad_orientation = 0;
1451 pad_orientation_value.setSelectedIndex(new_pad_orientation);
1453 pad_orientation_value.setVisible(new_pad_orientation != AltosLib.MISSING);
1454 pad_orientation_label.setVisible(new_pad_orientation != AltosLib.MISSING);
1455 accel_cal.setVisible(new_pad_orientation != AltosLib.MISSING);
1457 set_pad_orientation_tool_tip();
1460 public int pad_orientation() {
1461 if (pad_orientation_value.isVisible())
1462 return pad_orientation_value.getSelectedIndex();
1464 return AltosLib.MISSING;
1467 public void set_accel_cal(int accel_plus, int accel_minus) {
1468 if (accel_plus != AltosLib.MISSING) {
1469 accel_plus_value.setText(String.format("%d", accel_plus));
1470 accel_minus_value.setText(String.format("%d", accel_minus));
1472 accel_plus_value.setVisible(accel_plus != AltosLib.MISSING);
1473 accel_plus_label.setVisible(accel_plus != AltosLib.MISSING);
1474 accel_minus_value.setVisible(accel_minus != AltosLib.MISSING);
1475 accel_minus_label.setVisible(accel_minus != AltosLib.MISSING);
1477 set_accel_tool_tips();
1480 public int accel_cal_plus() {
1481 if (accel_plus_value.isVisible())
1482 return Integer.parseInt(accel_plus_value.getText());
1483 return AltosLib.MISSING;
1486 public int accel_cal_minus() {
1487 if (accel_minus_value.isVisible())
1488 return Integer.parseInt(accel_minus_value.getText());
1489 return AltosLib.MISSING;
1492 public void set_beep(int new_beep) {
1493 if (new_beep != AltosLib.MISSING) {
1494 int new_freq = (int) Math.floor (AltosConvert.beep_value_to_freq(new_beep) + 0.5);
1495 for (int i = 0; i < beep_values.length; i++)
1496 if (new_beep == AltosConvert.beep_freq_to_value(Integer.parseInt(beep_values[i]))) {
1497 beep_value.setSelectedIndex(i);
1498 set_beep_tool_tip();
1501 beep_value.setSelectedItem(String.format("%d", new_freq));
1503 beep_value.setVisible(new_beep != AltosLib.MISSING);
1504 beep_label.setVisible(new_beep != AltosLib.MISSING);
1505 set_beep_tool_tip();
1509 if (beep_value.isVisible())
1510 return AltosConvert.beep_freq_to_value(Integer.parseInt(beep_value.getSelectedItem().toString()));
1512 return AltosLib.MISSING;
1515 public void set_radio_10mw(int new_radio_10mw) {
1516 if (new_radio_10mw != AltosLib.MISSING) {
1517 radio_10mw_value.setSelected(new_radio_10mw != 0);
1519 radio_10mw_value.setVisible(new_radio_10mw != AltosLib.MISSING);
1520 radio_10mw_label.setVisible(new_radio_10mw != AltosLib.MISSING);
1521 set_radio_10mw_tool_tip();
1524 public int radio_10mw() {
1525 if (radio_10mw_value.isVisible())
1526 return radio_10mw_value.isSelected() ? 1 : 0;
1528 return AltosLib.MISSING;
1531 public void set_report_feet(int new_report_feet) {
1532 if (new_report_feet != AltosLib.MISSING) {
1533 if (new_report_feet >= report_feet_values.length)
1534 new_report_feet = 0;
1535 if (new_report_feet < 0) {
1536 report_feet_value.setEnabled(false);
1537 new_report_feet = 0;
1539 report_feet_value.setEnabled(true);
1541 report_feet_value.setSelectedIndex(new_report_feet);
1543 report_feet_value.setVisible(new_report_feet != AltosLib.MISSING);
1544 report_feet_label.setVisible(new_report_feet != AltosLib.MISSING);
1546 set_report_feet_tool_tip();
1549 public int report_feet() {
1550 if (report_feet_value.isVisible())
1551 return report_feet_value.getSelectedIndex();
1553 return AltosLib.MISSING;
1556 String[] tracker_motion_values() {
1557 if (AltosConvert.imperial_units)
1558 return tracker_motion_values_ft;
1560 return tracker_motion_values_m;
1563 void set_tracker_motion_values() {
1564 String[] v = tracker_motion_values();
1565 while (tracker_motion_value.getItemCount() > 0)
1566 tracker_motion_value.removeItemAt(0);
1567 for (int i = 0; i < v.length; i++)
1568 tracker_motion_value.addItem(v[i]);
1569 tracker_motion_value.setMaximumRowCount(v.length);
1572 String get_tracker_motion_label() {
1573 return String.format("Logging Trigger Motion (%s):", AltosConvert.height.parse_units());
1576 void set_tracker_tool_tip() {
1577 if (tracker_motion_value.isVisible())
1578 tracker_motion_value.setToolTipText("How far the device must move before logging");
1580 tracker_motion_value.setToolTipText("This device doesn't disable logging when stationary");
1581 if (tracker_interval_value.isVisible())
1582 tracker_interval_value.setToolTipText("How often to report GPS position");
1584 tracker_interval_value.setToolTipText("This device can't configure interval");
1587 public void set_tracker_motion(int tracker_motion) {
1588 if (tracker_motion != AltosLib.MISSING)
1589 tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion));
1590 tracker_motion_label.setVisible(tracker_motion != AltosLib.MISSING);
1591 tracker_motion_value.setVisible(tracker_motion != AltosLib.MISSING);
1594 public int tracker_motion() throws AltosConfigDataException {
1595 if (tracker_motion_value.isVisible()) {
1596 String str = tracker_motion_value.getSelectedItem().toString();
1598 return (int) (AltosConvert.height.parse_locale(str) + 0.5);
1599 } catch (ParseException pe) {
1600 throw new AltosConfigDataException("invalid tracker motion %s", str);
1603 return AltosLib.MISSING;
1606 public void set_tracker_interval(int tracker_interval) {
1607 if (tracker_interval != AltosLib.MISSING)
1608 tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval));
1609 tracker_interval_label.setVisible(tracker_interval != AltosLib.MISSING);
1610 tracker_interval_value.setVisible(tracker_interval != AltosLib.MISSING);
1613 public int tracker_interval() throws AltosConfigDataException {
1614 if (tracker_interval_value.isVisible())
1615 return parse_int ("tracker interval", tracker_interval_value.getSelectedItem().toString(), false);
1616 return AltosLib.MISSING;
1619 public void set_pyros(AltosPyro[] new_pyros) {
1621 if (pyros != null && pyro_ui != null)
1622 pyro_ui.set_pyros(pyros);
1623 pyro.setVisible(pyros != null);
1626 public AltosPyro[] pyros() throws AltosConfigDataException {
1627 if (pyro_ui != null)
1628 pyros = pyro_ui.get_pyros();
1632 public void set_pyro_firing_time(double new_pyro_firing_time) {
1633 pyro_firing_time = new_pyro_firing_time;
1634 if (pyro_firing_time != AltosLib.MISSING && pyro_ui != null)
1635 pyro_ui.set_pyro_firing_time(pyro_firing_time);
1636 pyro.setVisible(pyro_firing_time != AltosLib.MISSING);
1639 public double pyro_firing_time() throws AltosConfigDataException {
1640 if (pyro_ui != null)
1641 pyro_firing_time = pyro_ui.get_pyro_firing_time();
1642 return pyro_firing_time;
1645 private String aprs_interval_string(int interval) {
1648 return Integer.toString(interval);
1651 private int aprs_interval_value(String interval) throws AltosConfigDataException {
1652 if (interval.equalsIgnoreCase("Disabled"))
1654 return parse_int("aprs interval", interval, false);
1657 public void set_aprs_interval(int new_aprs_interval) {
1658 if (new_aprs_interval != AltosLib.MISSING)
1659 aprs_interval_value.setSelectedItem(aprs_interval_string(new_aprs_interval));
1660 aprs_interval_value.setVisible(new_aprs_interval != AltosLib.MISSING);
1661 aprs_interval_label.setVisible(new_aprs_interval != AltosLib.MISSING);
1662 set_aprs_interval_tool_tip();
1665 public int aprs_interval() throws AltosConfigDataException {
1666 if (aprs_interval_value.isVisible())
1667 return aprs_interval_value(aprs_interval_value.getSelectedItem().toString());
1668 return AltosLib.MISSING;
1671 public void set_aprs_ssid(int new_aprs_ssid) {
1672 if (new_aprs_ssid != AltosLib.MISSING)
1673 aprs_ssid_value.setSelectedItem(new_aprs_ssid);
1674 aprs_ssid_value.setVisible(new_aprs_ssid != AltosLib.MISSING);
1675 aprs_ssid_label.setVisible(new_aprs_ssid != AltosLib.MISSING);
1676 set_aprs_ssid_tool_tip();
1679 public int aprs_ssid() throws AltosConfigDataException {
1680 if (aprs_ssid_value.isVisible()) {
1681 Integer i = (Integer) aprs_ssid_value.getSelectedItem();
1684 return AltosLib.MISSING;
1687 public void set_aprs_format(int new_aprs_format) {
1688 if (new_aprs_format != AltosLib.MISSING)
1689 aprs_format_value.setSelectedIndex(new_aprs_format);
1690 aprs_format_value.setVisible(new_aprs_format != AltosLib.MISSING);
1691 aprs_format_label.setVisible(new_aprs_format != AltosLib.MISSING);
1692 set_aprs_format_tool_tip();
1695 public int aprs_format() throws AltosConfigDataException {
1696 if (aprs_format_value.isVisible())
1697 return aprs_format_value.getSelectedIndex();
1698 return AltosLib.MISSING;
1701 public void set_aprs_offset(int new_aprs_offset) {
1702 if (new_aprs_offset != AltosLib.MISSING)
1703 aprs_offset_value.setSelectedItem(new_aprs_offset);
1704 aprs_offset_value.setVisible(new_aprs_offset != AltosLib.MISSING);
1705 aprs_offset_label.setVisible(new_aprs_offset != AltosLib.MISSING);
1706 set_aprs_offset_tool_tip();
1709 public int aprs_offset() throws AltosConfigDataException {
1710 if (aprs_offset_value.isVisible()) {
1711 Integer i = (Integer) aprs_offset_value.getSelectedItem();
1714 return AltosLib.MISSING;