altos/stmf0: Remove remaining stm32l bits from stm32f0 code
[fw/altos] / altosui / AltosConfigUI.java
1 /*
2  * Copyright © 2010 Keith Packard <keithp@keithp.com>
3  *
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; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 package altosui;
19
20 import java.awt.*;
21 import java.awt.event.*;
22 import javax.swing.*;
23 import javax.swing.event.*;
24 import org.altusmetrum.altoslib_5.*;
25 import org.altusmetrum.altosuilib_3.*;
26
27 public class AltosConfigUI
28         extends AltosUIDialog
29         implements ActionListener, ItemListener, DocumentListener, AltosConfigValues, AltosUnitsListener
30 {
31
32         Container               pane;
33         JLabel                  product_label;
34         JLabel                  version_label;
35         JLabel                  serial_label;
36         JLabel                  main_deploy_label;
37         JLabel                  apogee_delay_label;
38         JLabel                  apogee_lockout_label;
39         JLabel                  frequency_label;
40         JLabel                  radio_calibration_label;
41         JLabel                  radio_frequency_label;
42         JLabel                  radio_enable_label;
43         JLabel                  rate_label;
44         JLabel                  aprs_interval_label;
45         JLabel                  aprs_ssid_label;
46         JLabel                  flight_log_max_label;
47         JLabel                  ignite_mode_label;
48         JLabel                  pad_orientation_label;
49         JLabel                  callsign_label;
50         JLabel                  beep_label;
51         JLabel                  tracker_motion_label;
52         JLabel                  tracker_interval_label;
53
54         public boolean          dirty;
55
56         JFrame                  owner;
57         JLabel                  product_value;
58         JLabel                  version_value;
59         JLabel                  serial_value;
60         JComboBox<String>       main_deploy_value;
61         JComboBox<String>       apogee_delay_value;
62         JComboBox<String>       apogee_lockout_value;
63         AltosUIFreqList         radio_frequency_value;
64         JTextField              radio_calibration_value;
65         JRadioButton            radio_enable_value;
66         AltosUIRateList         rate_value;
67         JComboBox<String>       aprs_interval_value;
68         JComboBox<Integer>      aprs_ssid_value;
69         JComboBox<String>       flight_log_max_value;
70         JComboBox<String>       ignite_mode_value;
71         JComboBox<String>       pad_orientation_value;
72         JTextField              callsign_value;
73         JComboBox<String>       beep_value;
74         JComboBox<String>       tracker_motion_value;
75         JComboBox<String>       tracker_interval_value;
76
77         JButton                 pyro;
78
79         JButton                 save;
80         JButton                 reset;
81         JButton                 reboot;
82         JButton                 close;
83
84         AltosPyro[]             pyros;
85         double                  pyro_firing_time;
86
87         ActionListener          listener;
88
89         static String[]         main_deploy_values_m = {
90                 "100", "150", "200", "250", "300", "350",
91                 "400", "450", "500"
92         };
93
94         static String[]         main_deploy_values_ft = {
95                 "250", "500", "750", "1000", "1250", "1500",
96                 "1750", "2000"
97         };
98
99         static String[]         apogee_delay_values = {
100                 "0", "1", "2", "3", "4", "5"
101         };
102
103         static String[]         apogee_lockout_values = {
104                 "0", "5", "10", "15", "20"
105         };
106
107         static String[]         ignite_mode_values = {
108                 "Dual Deploy",
109                 "Redundant Apogee",
110                 "Redundant Main",
111         };
112
113         static String[]         aprs_interval_values = {
114                 "Disabled",
115                 "2",
116                 "5",
117                 "10"
118         };
119
120         static Integer[]        aprs_ssid_values = {
121                 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
122         };
123
124         static String[]         beep_values = {
125                 "3750",
126                 "4000",
127                 "4250",
128         };
129
130         static String[]         pad_orientation_values = {
131                 "Antenna Up",
132                 "Antenna Down",
133         };
134
135         static String[]         tracker_motion_values_m = {
136                 "2",
137                 "5",
138                 "10",
139                 "25",
140         };
141
142         static String[]         tracker_motion_values_ft = {
143                 "5",
144                 "20",
145                 "50",
146                 "100"
147         };
148
149         static String[]         tracker_interval_values = {
150                 "1",
151                 "2",
152                 "5",
153                 "10"
154         };
155
156         /* A window listener to catch closing events and tell the config code */
157         class ConfigListener extends WindowAdapter {
158                 AltosConfigUI   ui;
159
160                 public ConfigListener(AltosConfigUI this_ui) {
161                         ui = this_ui;
162                 }
163
164                 public void windowClosing(WindowEvent e) {
165                         ui.actionPerformed(new ActionEvent(e.getSource(),
166                                                            ActionEvent.ACTION_PERFORMED,
167                                                            "Close"));
168                 }
169         }
170
171         boolean is_telemini_v1() {
172                 String  product = product_value.getText();
173                 return product != null && product.startsWith("TeleMini-v1");
174         }
175
176         boolean is_telemini() {
177                 String  product = product_value.getText();
178                 return product != null && product.startsWith("TeleMini");
179         }
180
181         boolean is_easymini() {
182                 String  product = product_value.getText();
183                 return product != null && product.startsWith("EasyMini");
184         }
185
186         boolean is_telemetrum() {
187                 String  product = product_value.getText();
188                 return product != null && product.startsWith("TeleMetrum");
189         }
190
191         void set_radio_calibration_tool_tip() {
192                 if (radio_calibration_value.isEnabled())
193                         radio_calibration_value.setToolTipText("Tune radio output to match desired frequency");
194                 else
195                         radio_calibration_value.setToolTipText("Cannot tune radio while connected over packet mode");
196         }
197
198         void set_radio_enable_tool_tip() {
199                 if (radio_enable_value.isEnabled())
200                         radio_enable_value.setToolTipText("Enable/Disable telemetry and RDF transmissions");
201                 else
202                         radio_enable_value.setToolTipText("Firmware version does not support disabling radio");
203         }
204
205         void set_rate_tool_tip() {
206                 if (rate_value.isEnabled())
207                         rate_value.setToolTipText("Select telemetry baud rate");
208                 else
209                         rate_value.setToolTipText("Firmware version does not support variable telemetry rates");
210         }
211
212         void set_aprs_interval_tool_tip() {
213                 if (aprs_interval_value.isEnabled())
214                         aprs_interval_value.setToolTipText("Enable APRS and set the interval between APRS reports");
215                 else
216                         aprs_interval_value.setToolTipText("Hardware doesn't support APRS");
217         }
218
219         void set_aprs_ssid_tool_tip() {
220                 if (aprs_ssid_value.isEnabled())
221                         aprs_interval_value.setToolTipText("Set the APRS SSID (secondary station identifier)");
222                 else if (aprs_interval_value.isEnabled())
223                         aprs_interval_value.setToolTipText("Software version doesn't support setting the APRS SSID");
224                 else
225                         aprs_interval_value.setToolTipText("Hardware doesn't support APRS");
226         }
227
228         void set_flight_log_max_tool_tip() {
229                 if (flight_log_max_value.isEnabled())
230                         flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)");
231                 else {
232                         if (is_telemini_v1())
233                                 flight_log_max_value.setToolTipText("TeleMini-v1 stores only one flight");
234                         else
235                                 flight_log_max_value.setToolTipText("Cannot set max value with flight logs in memory");
236                 }
237         }
238
239         void set_ignite_mode_tool_tip() {
240                 if (ignite_mode_value.isEnabled())
241                         ignite_mode_value.setToolTipText("Select when igniters will be fired");
242                 else
243                         ignite_mode_value.setToolTipText("Older firmware could not select ignite mode");
244         }
245
246         void set_pad_orientation_tool_tip() {
247                 if (pad_orientation_value.isEnabled())
248                         pad_orientation_value.setToolTipText("How will the computer be mounted in the airframe");
249                 else {
250                         if (is_telemetrum())
251                                 pad_orientation_value.setToolTipText("Older TeleMetrum firmware must fly antenna forward");
252                         else if (is_telemini() || is_easymini())
253                                 pad_orientation_value.setToolTipText("TeleMini and EasyMini don't care how they are mounted");
254                         else
255                                 pad_orientation_value.setToolTipText("Can't select orientation");
256                 }
257         }
258
259         void set_beep_tool_tip() {
260                 if (beep_value.isEnabled())
261                         beep_value.setToolTipText("What frequency the beeper will sound at");
262                 else
263                         beep_value.setToolTipText("Older firmware could not select beeper frequency");
264         }
265
266         /* Build the UI using a grid bag */
267         public AltosConfigUI(JFrame in_owner, boolean remote) {
268                 super (in_owner, "Configure Flight Computer", false);
269
270                 owner = in_owner;
271                 GridBagConstraints c;
272                 int row = 0;
273
274                 Insets il = new Insets(4,4,4,4);
275                 Insets ir = new Insets(4,4,4,4);
276
277                 pane = getContentPane();
278                 pane.setLayout(new GridBagLayout());
279
280                 /* Product */
281                 c = new GridBagConstraints();
282                 c.gridx = 0; c.gridy = row;
283                 c.gridwidth = 4;
284                 c.fill = GridBagConstraints.NONE;
285                 c.anchor = GridBagConstraints.LINE_START;
286                 c.insets = il;
287                 product_label = new JLabel("Product:");
288                 pane.add(product_label, c);
289
290                 c = new GridBagConstraints();
291                 c.gridx = 4; c.gridy = row;
292                 c.gridwidth = 4;
293                 c.fill = GridBagConstraints.HORIZONTAL;
294                 c.weightx = 1;
295                 c.anchor = GridBagConstraints.LINE_START;
296                 c.insets = ir;
297                 product_value = new JLabel("");
298                 pane.add(product_value, c);
299                 row++;
300
301                 /* Version */
302                 c = new GridBagConstraints();
303                 c.gridx = 0; c.gridy = row;
304                 c.gridwidth = 4;
305                 c.fill = GridBagConstraints.NONE;
306                 c.anchor = GridBagConstraints.LINE_START;
307                 c.insets = il;
308                 c.ipady = 5;
309                 version_label = new JLabel("Software version:");
310                 pane.add(version_label, c);
311
312                 c = new GridBagConstraints();
313                 c.gridx = 4; c.gridy = row;
314                 c.gridwidth = 4;
315                 c.fill = GridBagConstraints.HORIZONTAL;
316                 c.weightx = 1;
317                 c.anchor = GridBagConstraints.LINE_START;
318                 c.insets = ir;
319                 c.ipady = 5;
320                 version_value = new JLabel("");
321                 pane.add(version_value, c);
322                 row++;
323
324                 /* Serial */
325                 c = new GridBagConstraints();
326                 c.gridx = 0; c.gridy = row;
327                 c.gridwidth = 4;
328                 c.fill = GridBagConstraints.NONE;
329                 c.anchor = GridBagConstraints.LINE_START;
330                 c.insets = il;
331                 c.ipady = 5;
332                 serial_label = new JLabel("Serial:");
333                 pane.add(serial_label, c);
334
335                 c = new GridBagConstraints();
336                 c.gridx = 4; c.gridy = row;
337                 c.gridwidth = 4;
338                 c.fill = GridBagConstraints.HORIZONTAL;
339                 c.weightx = 1;
340                 c.anchor = GridBagConstraints.LINE_START;
341                 c.insets = ir;
342                 c.ipady = 5;
343                 serial_value = new JLabel("");
344                 pane.add(serial_value, c);
345                 row++;
346
347                 /* Main deploy */
348                 c = new GridBagConstraints();
349                 c.gridx = 0; c.gridy = row;
350                 c.gridwidth = 4;
351                 c.fill = GridBagConstraints.NONE;
352                 c.anchor = GridBagConstraints.LINE_START;
353                 c.insets = il;
354                 c.ipady = 5;
355                 main_deploy_label = new JLabel(get_main_deploy_label());
356                 pane.add(main_deploy_label, c);
357
358                 c = new GridBagConstraints();
359                 c.gridx = 4; c.gridy = row;
360                 c.gridwidth = 4;
361                 c.fill = GridBagConstraints.HORIZONTAL;
362                 c.weightx = 1;
363                 c.anchor = GridBagConstraints.LINE_START;
364                 c.insets = ir;
365                 c.ipady = 5;
366                 main_deploy_value = new JComboBox<String>(main_deploy_values());
367                 main_deploy_value.setEditable(true);
368                 main_deploy_value.addItemListener(this);
369                 pane.add(main_deploy_value, c);
370                 main_deploy_value.setToolTipText("Height above pad altitude to fire main charge");
371                 row++;
372
373                 /* Apogee delay */
374                 c = new GridBagConstraints();
375                 c.gridx = 0; c.gridy = row;
376                 c.gridwidth = 4;
377                 c.fill = GridBagConstraints.NONE;
378                 c.anchor = GridBagConstraints.LINE_START;
379                 c.insets = il;
380                 c.ipady = 5;
381                 apogee_delay_label = new JLabel("Apogee Delay(s):");
382                 pane.add(apogee_delay_label, c);
383
384                 c = new GridBagConstraints();
385                 c.gridx = 4; c.gridy = row;
386                 c.gridwidth = 4;
387                 c.fill = GridBagConstraints.HORIZONTAL;
388                 c.weightx = 1;
389                 c.anchor = GridBagConstraints.LINE_START;
390                 c.insets = ir;
391                 c.ipady = 5;
392                 apogee_delay_value = new JComboBox<String>(apogee_delay_values);
393                 apogee_delay_value.setEditable(true);
394                 apogee_delay_value.addItemListener(this);
395                 pane.add(apogee_delay_value, c);
396                 apogee_delay_value.setToolTipText("Delay after apogee before charge fires");
397                 row++;
398
399                 /* Apogee lockout */
400                 c = new GridBagConstraints();
401                 c.gridx = 0; c.gridy = row;
402                 c.gridwidth = 4;
403                 c.fill = GridBagConstraints.NONE;
404                 c.anchor = GridBagConstraints.LINE_START;
405                 c.insets = il;
406                 c.ipady = 5;
407                 apogee_lockout_label = new JLabel("Apogee Lockout(s):");
408                 pane.add(apogee_lockout_label, c);
409
410                 c = new GridBagConstraints();
411                 c.gridx = 4; c.gridy = row;
412                 c.gridwidth = 4;
413                 c.fill = GridBagConstraints.HORIZONTAL;
414                 c.weightx = 1;
415                 c.anchor = GridBagConstraints.LINE_START;
416                 c.insets = ir;
417                 c.ipady = 5;
418                 apogee_lockout_value = new JComboBox<String>(apogee_lockout_values);
419                 apogee_lockout_value.setEditable(true);
420                 apogee_lockout_value.addItemListener(this);
421                 pane.add(apogee_lockout_value, c);
422                 apogee_lockout_value.setToolTipText("Time after boost while apogee detection is locked out");
423                 row++;
424
425                 /* Frequency */
426                 c = new GridBagConstraints();
427                 c.gridx = 0; c.gridy = row;
428                 c.gridwidth = 4;
429                 c.fill = GridBagConstraints.NONE;
430                 c.anchor = GridBagConstraints.LINE_START;
431                 c.insets = il;
432                 c.ipady = 5;
433                 radio_frequency_label = new JLabel("Frequency:");
434                 pane.add(radio_frequency_label, c);
435
436                 c = new GridBagConstraints();
437                 c.gridx = 4; c.gridy = row;
438                 c.gridwidth = 4;
439                 c.fill = GridBagConstraints.HORIZONTAL;
440                 c.weightx = 1;
441                 c.anchor = GridBagConstraints.LINE_START;
442                 c.insets = ir;
443                 c.ipady = 5;
444                 radio_frequency_value = new AltosUIFreqList();
445                 radio_frequency_value.addItemListener(this);
446                 pane.add(radio_frequency_value, c);
447                 radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
448                 row++;
449
450                 /* Radio Calibration */
451                 c = new GridBagConstraints();
452                 c.gridx = 0; c.gridy = row;
453                 c.gridwidth = 4;
454                 c.fill = GridBagConstraints.NONE;
455                 c.anchor = GridBagConstraints.LINE_START;
456                 c.insets = il;
457                 c.ipady = 5;
458                 radio_calibration_label = new JLabel("RF Calibration:");
459                 pane.add(radio_calibration_label, c);
460
461                 c = new GridBagConstraints();
462                 c.gridx = 4; c.gridy = row;
463                 c.gridwidth = 4;
464                 c.fill = GridBagConstraints.HORIZONTAL;
465                 c.weightx = 1;
466                 c.anchor = GridBagConstraints.LINE_START;
467                 c.insets = ir;
468                 c.ipady = 5;
469                 radio_calibration_value = new JTextField(String.format("%d", 1186611));
470                 radio_calibration_value.getDocument().addDocumentListener(this);
471                 if (remote)
472                         radio_calibration_value.setEnabled(false);
473                 pane.add(radio_calibration_value, c);
474                 set_radio_calibration_tool_tip();
475                 row++;
476
477                 /* Radio Enable */
478                 c = new GridBagConstraints();
479                 c.gridx = 0; c.gridy = row;
480                 c.gridwidth = 4;
481                 c.fill = GridBagConstraints.NONE;
482                 c.anchor = GridBagConstraints.LINE_START;
483                 c.insets = il;
484                 c.ipady = 5;
485                 radio_enable_label = new JLabel("Telemetry/RDF/APRS Enable:");
486                 pane.add(radio_enable_label, c);
487
488                 c = new GridBagConstraints();
489                 c.gridx = 4; c.gridy = row;
490                 c.gridwidth = 4;
491                 c.fill = GridBagConstraints.HORIZONTAL;
492                 c.weightx = 1;
493                 c.anchor = GridBagConstraints.LINE_START;
494                 c.insets = ir;
495                 c.ipady = 5;
496                 radio_enable_value = new JRadioButton("Enabled");
497                 radio_enable_value.addItemListener(this);
498                 pane.add(radio_enable_value, c);
499                 set_radio_enable_tool_tip();
500                 row++;
501
502                 /* Telemetry Rate */
503                 c = new GridBagConstraints();
504                 c.gridx = 0; c.gridy = row;
505                 c.gridwidth = 4;
506                 c.fill = GridBagConstraints.NONE;
507                 c.anchor = GridBagConstraints.LINE_START;
508                 c.insets = il;
509                 c.ipady = 5;
510                 rate_label = new JLabel("Telemetry baud rate:");
511                 pane.add(rate_label, c);
512
513                 c = new GridBagConstraints();
514                 c.gridx = 4; c.gridy = row;
515                 c.gridwidth = 4;
516                 c.fill = GridBagConstraints.HORIZONTAL;
517                 c.weightx = 1;
518                 c.anchor = GridBagConstraints.LINE_START;
519                 c.insets = ir;
520                 c.ipady = 5;
521                 rate_value = new AltosUIRateList();
522                 rate_value.addItemListener(this);
523                 pane.add(rate_value, c);
524                 set_rate_tool_tip();
525                 row++;
526
527                 /* APRS interval */
528                 c = new GridBagConstraints();
529                 c.gridx = 0; c.gridy = row;
530                 c.gridwidth = 4;
531                 c.fill = GridBagConstraints.NONE;
532                 c.anchor = GridBagConstraints.LINE_START;
533                 c.insets = il;
534                 c.ipady = 5;
535                 aprs_interval_label = new JLabel("APRS Interval(s):");
536                 pane.add(aprs_interval_label, c);
537
538                 c = new GridBagConstraints();
539                 c.gridx = 4; c.gridy = row;
540                 c.gridwidth = 4;
541                 c.fill = GridBagConstraints.HORIZONTAL;
542                 c.weightx = 1;
543                 c.anchor = GridBagConstraints.LINE_START;
544                 c.insets = ir;
545                 c.ipady = 5;
546                 aprs_interval_value = new JComboBox<String>(aprs_interval_values);
547                 aprs_interval_value.setEditable(true);
548                 aprs_interval_value.addItemListener(this);
549                 pane.add(aprs_interval_value, c);
550                 set_aprs_interval_tool_tip();
551                 row++;
552
553                 /* APRS SSID */
554                 c = new GridBagConstraints();
555                 c.gridx = 0; c.gridy = row;
556                 c.gridwidth = 4;
557                 c.fill = GridBagConstraints.NONE;
558                 c.anchor = GridBagConstraints.LINE_START;
559                 c.insets = il;
560                 c.ipady = 5;
561                 aprs_ssid_label = new JLabel("APRS SSID:");
562                 pane.add(aprs_ssid_label, c);
563
564                 c = new GridBagConstraints();
565                 c.gridx = 4; c.gridy = row;
566                 c.gridwidth = 4;
567                 c.fill = GridBagConstraints.HORIZONTAL;
568                 c.weightx = 1;
569                 c.anchor = GridBagConstraints.LINE_START;
570                 c.insets = ir;
571                 c.ipady = 5;
572                 aprs_ssid_value = new JComboBox<Integer>(aprs_ssid_values);
573                 aprs_ssid_value.setEditable(false);
574                 aprs_ssid_value.addItemListener(this);
575                 aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length);
576                 pane.add(aprs_ssid_value, c);
577                 set_aprs_ssid_tool_tip();
578                 row++;
579
580                 /* Callsign */
581                 c = new GridBagConstraints();
582                 c.gridx = 0; c.gridy = row;
583                 c.gridwidth = 4;
584                 c.fill = GridBagConstraints.NONE;
585                 c.anchor = GridBagConstraints.LINE_START;
586                 c.insets = il;
587                 c.ipady = 5;
588                 callsign_label = new JLabel("Callsign:");
589                 pane.add(callsign_label, c);
590
591                 c = new GridBagConstraints();
592                 c.gridx = 4; c.gridy = row;
593                 c.gridwidth = 4;
594                 c.fill = GridBagConstraints.HORIZONTAL;
595                 c.weightx = 1;
596                 c.anchor = GridBagConstraints.LINE_START;
597                 c.insets = ir;
598                 c.ipady = 5;
599                 callsign_value = new JTextField(AltosUIPreferences.callsign());
600                 callsign_value.getDocument().addDocumentListener(this);
601                 pane.add(callsign_value, c);
602                 callsign_value.setToolTipText("Callsign reported in telemetry data");
603                 row++;
604
605                 /* Flight log max */
606                 c = new GridBagConstraints();
607                 c.gridx = 0; c.gridy = row;
608                 c.gridwidth = 4;
609                 c.fill = GridBagConstraints.NONE;
610                 c.anchor = GridBagConstraints.LINE_START;
611                 c.insets = il;
612                 c.ipady = 5;
613                 flight_log_max_label = new JLabel("Maximum Flight Log Size (kB):");
614                 pane.add(flight_log_max_label, c);
615
616                 c = new GridBagConstraints();
617                 c.gridx = 4; c.gridy = row;
618                 c.gridwidth = 4;
619                 c.fill = GridBagConstraints.HORIZONTAL;
620                 c.weightx = 1;
621                 c.anchor = GridBagConstraints.LINE_START;
622                 c.insets = ir;
623                 c.ipady = 5;
624                 flight_log_max_value = new JComboBox<String>();
625                 flight_log_max_value.setEditable(true);
626                 flight_log_max_value.addItemListener(this);
627                 pane.add(flight_log_max_value, c);
628                 set_flight_log_max_tool_tip();
629                 row++;
630
631                 /* Ignite mode */
632                 c = new GridBagConstraints();
633                 c.gridx = 0; c.gridy = row;
634                 c.gridwidth = 4;
635                 c.fill = GridBagConstraints.NONE;
636                 c.anchor = GridBagConstraints.LINE_START;
637                 c.insets = il;
638                 c.ipady = 5;
639                 ignite_mode_label = new JLabel("Igniter Firing Mode:");
640                 pane.add(ignite_mode_label, c);
641
642                 c = new GridBagConstraints();
643                 c.gridx = 4; c.gridy = row;
644                 c.gridwidth = 4;
645                 c.fill = GridBagConstraints.HORIZONTAL;
646                 c.weightx = 1;
647                 c.anchor = GridBagConstraints.LINE_START;
648                 c.insets = ir;
649                 c.ipady = 5;
650                 ignite_mode_value = new JComboBox<String>(ignite_mode_values);
651                 ignite_mode_value.setEditable(false);
652                 ignite_mode_value.addItemListener(this);
653                 pane.add(ignite_mode_value, c);
654                 set_ignite_mode_tool_tip();
655                 row++;
656
657                 /* Pad orientation */
658                 c = new GridBagConstraints();
659                 c.gridx = 0; c.gridy = row;
660                 c.gridwidth = 4;
661                 c.fill = GridBagConstraints.NONE;
662                 c.anchor = GridBagConstraints.LINE_START;
663                 c.insets = il;
664                 c.ipady = 5;
665                 pad_orientation_label = new JLabel("Pad Orientation:");
666                 pane.add(pad_orientation_label, c);
667
668                 c = new GridBagConstraints();
669                 c.gridx = 4; c.gridy = row;
670                 c.gridwidth = 4;
671                 c.fill = GridBagConstraints.HORIZONTAL;
672                 c.weightx = 1;
673                 c.anchor = GridBagConstraints.LINE_START;
674                 c.insets = ir;
675                 c.ipady = 5;
676                 pad_orientation_value = new JComboBox<String>(pad_orientation_values);
677                 pad_orientation_value.setEditable(false);
678                 pad_orientation_value.addItemListener(this);
679                 pane.add(pad_orientation_value, c);
680                 set_pad_orientation_tool_tip();
681                 row++;
682
683                 /* Beeper */
684                 c = new GridBagConstraints();
685                 c.gridx = 0; c.gridy = row;
686                 c.gridwidth = 4;
687                 c.fill = GridBagConstraints.NONE;
688                 c.anchor = GridBagConstraints.LINE_START;
689                 c.insets = il;
690                 c.ipady = 5;
691                 beep_label = new JLabel("Beeper Frequency:");
692                 pane.add(beep_label, c);
693
694                 c = new GridBagConstraints();
695                 c.gridx = 4; c.gridy = row;
696                 c.gridwidth = 4;
697                 c.fill = GridBagConstraints.HORIZONTAL;
698                 c.weightx = 1;
699                 c.anchor = GridBagConstraints.LINE_START;
700                 c.insets = ir;
701                 c.ipady = 5;
702                 beep_value = new JComboBox<String>(beep_values);
703                 beep_value.setEditable(true);
704                 beep_value.addItemListener(this);
705                 pane.add(beep_value, c);
706                 set_beep_tool_tip();
707                 row++;
708
709                 /* Tracker triger horiz distances */
710                 c = new GridBagConstraints();
711                 c.gridx = 0; c.gridy = row;
712                 c.gridwidth = 4;
713                 c.fill = GridBagConstraints.NONE;
714                 c.anchor = GridBagConstraints.LINE_START;
715                 c.insets = il;
716                 c.ipady = 5;
717                 tracker_motion_label = new JLabel(get_tracker_motion_label());
718                 pane.add(tracker_motion_label, c);
719
720                 c = new GridBagConstraints();
721                 c.gridx = 4; c.gridy = row;
722                 c.gridwidth = 4;
723                 c.fill = GridBagConstraints.HORIZONTAL;
724                 c.weightx = 1;
725                 c.anchor = GridBagConstraints.LINE_START;
726                 c.insets = ir;
727                 c.ipady = 5;
728                 tracker_motion_value = new JComboBox<String>(tracker_motion_values());
729                 tracker_motion_value.setEditable(true);
730                 tracker_motion_value.addItemListener(this);
731                 pane.add(tracker_motion_value, c);
732                 row++;
733
734                 /* Tracker triger vert distances */
735                 c = new GridBagConstraints();
736                 c.gridx = 0; c.gridy = row;
737                 c.gridwidth = 4;
738                 c.fill = GridBagConstraints.NONE;
739                 c.anchor = GridBagConstraints.LINE_START;
740                 c.insets = il;
741                 c.ipady = 5;
742                 tracker_interval_label = new JLabel("Position Reporting Interval(s):");
743                 pane.add(tracker_interval_label, c);
744
745                 c = new GridBagConstraints();
746                 c.gridx = 4; c.gridy = row;
747                 c.gridwidth = 4;
748                 c.fill = GridBagConstraints.HORIZONTAL;
749                 c.weightx = 1;
750                 c.anchor = GridBagConstraints.LINE_START;
751                 c.insets = ir;
752                 c.ipady = 5;
753                 tracker_interval_value = new JComboBox<String>(tracker_interval_values);
754                 tracker_interval_value.setEditable(true);
755                 tracker_interval_value.addItemListener(this);
756                 pane.add(tracker_interval_value, c);
757                 set_tracker_tool_tip();
758                 row++;
759
760                 /* Pyro channels */
761                 c = new GridBagConstraints();
762                 c.gridx = 4; c.gridy = row;
763                 c.gridwidth = 4;
764                 c.fill = GridBagConstraints.HORIZONTAL;
765                 c.anchor = GridBagConstraints.LINE_START;
766                 c.insets = il;
767                 c.ipady = 5;
768                 pyro = new JButton("Configure Pyro Channels");
769                 pane.add(pyro, c);
770                 pyro.addActionListener(this);
771                 pyro.setActionCommand("Pyro");
772                 row++;
773
774                 /* Buttons */
775                 c = new GridBagConstraints();
776                 c.gridx = 0; c.gridy = row;
777                 c.gridwidth = 2;
778                 c.fill = GridBagConstraints.NONE;
779                 c.anchor = GridBagConstraints.LINE_START;
780                 c.insets = il;
781                 save = new JButton("Save");
782                 pane.add(save, c);
783                 save.addActionListener(this);
784                 save.setActionCommand("Save");
785
786                 c = new GridBagConstraints();
787                 c.gridx = 2; c.gridy = row;
788                 c.gridwidth = 2;
789                 c.fill = GridBagConstraints.NONE;
790                 c.anchor = GridBagConstraints.CENTER;
791                 c.insets = il;
792                 reset = new JButton("Reset");
793                 pane.add(reset, c);
794                 reset.addActionListener(this);
795                 reset.setActionCommand("Reset");
796
797                 c = new GridBagConstraints();
798                 c.gridx = 4; c.gridy = row;
799                 c.gridwidth = 2;
800                 c.fill = GridBagConstraints.NONE;
801                 c.anchor = GridBagConstraints.CENTER;
802                 c.insets = il;
803                 reboot = new JButton("Reboot");
804                 pane.add(reboot, c);
805                 reboot.addActionListener(this);
806                 reboot.setActionCommand("Reboot");
807
808                 c = new GridBagConstraints();
809                 c.gridx = 6; c.gridy = row;
810                 c.gridwidth = 2;
811                 c.fill = GridBagConstraints.NONE;
812                 c.anchor = GridBagConstraints.LINE_END;
813                 c.insets = il;
814                 close = new JButton("Close");
815                 pane.add(close, c);
816                 close.addActionListener(this);
817                 close.setActionCommand("Close");
818
819                 addWindowListener(new ConfigListener(this));
820                 AltosPreferences.register_units_listener(this);
821         }
822
823         /* Once the initial values are set, the config code will show the dialog */
824         public void make_visible() {
825                 pack();
826                 setLocationRelativeTo(owner);
827                 setVisible(true);
828         }
829
830         /* If any values have been changed, confirm before closing */
831         public boolean check_dirty(String operation) {
832                 if (dirty) {
833                         Object[] options = { String.format("%s anyway", operation), "Keep editing" };
834                         int i;
835                         i = JOptionPane.showOptionDialog(this,
836                                                          String.format("Configuration modified. %s anyway?", operation),
837                                                          "Configuration Modified",
838                                                          JOptionPane.DEFAULT_OPTION,
839                                                          JOptionPane.WARNING_MESSAGE,
840                                                          null, options, options[1]);
841                         if (i != 0)
842                                 return false;
843                 }
844                 return true;
845         }
846
847         void set_dirty() {
848                 dirty = true;
849                 save.setEnabled(true);
850         }
851
852         public void set_clean() {
853                 dirty = false;
854                 save.setEnabled(false);
855         }
856
857         AltosConfigPyroUI       pyro_ui;
858
859         public void dispose() {
860                 if (pyro_ui != null)
861                         pyro_ui.dispose();
862                 AltosPreferences.unregister_units_listener(this);
863                 super.dispose();
864         }
865
866         /* Listen for events from our buttons */
867         public void actionPerformed(ActionEvent e) {
868                 String  cmd = e.getActionCommand();
869
870                 if (cmd.equals("Pyro")) {
871                         if (pyro_ui == null && pyros != null)
872                                 pyro_ui = new AltosConfigPyroUI(this, pyros, pyro_firing_time);
873                         if (pyro_ui != null)
874                                 pyro_ui.make_visible();
875                         return;
876                 }
877
878                 if (cmd.equals("Close") || cmd.equals("Reboot"))
879                         if (!check_dirty(cmd))
880                                 return;
881                 listener.actionPerformed(e);
882                 if (cmd.equals("Close") || cmd.equals("Reboot")) {
883                         setVisible(false);
884                         dispose();
885                 }
886                 set_clean();
887         }
888
889         /* ItemListener interface method */
890         public void itemStateChanged(ItemEvent e) {
891                 set_dirty();
892         }
893
894         /* DocumentListener interface methods */
895         public void changedUpdate(DocumentEvent e) {
896                 set_dirty();
897         }
898
899         public void insertUpdate(DocumentEvent e) {
900                 set_dirty();
901         }
902
903         public void removeUpdate(DocumentEvent e) {
904                 set_dirty();
905         }
906
907         /* Let the config code hook on a listener */
908         public void addActionListener(ActionListener l) {
909                 listener = l;
910         }
911
912         /* set and get all of the dialog values */
913         public void set_product(String product) {
914                 radio_frequency_value.set_product(product);
915                 product_value.setText(product);
916                 set_pad_orientation_tool_tip();
917                 set_flight_log_max_tool_tip();
918         }
919
920         public void set_version(String version) {
921                 version_value.setText(version);
922         }
923
924         public void set_serial(int serial) {
925                 radio_frequency_value.set_serial(serial);
926                 serial_value.setText(String.format("%d", serial));
927         }
928
929         public void set_altitude_32(int altitude_32) {
930         }
931
932         public void set_main_deploy(int new_main_deploy) {
933                 main_deploy_value.setSelectedItem(AltosConvert.height.say(new_main_deploy));
934                 main_deploy_value.setEnabled(new_main_deploy >= 0);
935
936                 main_deploy_value.setVisible(new_main_deploy >= 0);
937                 main_deploy_label.setVisible(new_main_deploy >= 0);
938
939         }
940
941         public int main_deploy() {
942                 return (int) (AltosConvert.height.parse(main_deploy_value.getSelectedItem().toString()) + 0.5);
943         }
944
945         String get_main_deploy_label() {
946                 return String.format("Main Deploy Altitude(%s):", AltosConvert.height.show_units());
947         }
948
949         String[] main_deploy_values() {
950                 if (AltosConvert.imperial_units)
951                         return main_deploy_values_ft;
952                 else
953                         return main_deploy_values_m;
954         }
955
956         void set_main_deploy_values() {
957                 String[]        v = main_deploy_values();
958                 while (main_deploy_value.getItemCount() > 0)
959                         main_deploy_value.removeItemAt(0);
960                 for (int i = 0; i < v.length; i++)
961                         main_deploy_value.addItem(v[i]);
962                 main_deploy_value.setMaximumRowCount(v.length);
963         }
964
965         public void units_changed(boolean imperial_units) {
966                 boolean was_dirty = dirty;
967
968                 String v = main_deploy_value.getSelectedItem().toString();
969                 main_deploy_label.setText(get_main_deploy_label());
970                 set_main_deploy_values();
971                 int m = (int) (AltosConvert.height.parse(v, !imperial_units) + 0.5);
972                 set_main_deploy(m);
973
974                 if (tracker_motion_value.isEnabled()) {
975                         String motion = tracker_motion_value.getSelectedItem().toString();
976                         tracker_motion_label.setText(get_tracker_motion_label());
977                         set_tracker_motion_values();
978                         set_tracker_motion((int) (AltosConvert.height.parse(motion, !imperial_units) + 0.5));
979                 }
980
981                 if (!was_dirty)
982                         set_clean();
983         }
984
985         public void set_apogee_delay(int new_apogee_delay) {
986                 apogee_delay_value.setVisible(new_apogee_delay >= 0);
987                 apogee_delay_label.setVisible(new_apogee_delay >= 0);
988
989                 apogee_delay_value.setSelectedItem(Integer.toString(new_apogee_delay));
990                 apogee_delay_value.setEnabled(new_apogee_delay >= 0);
991         }
992
993         private int parse_int(String name, String s, boolean split) throws AltosConfigDataException {
994                 String v = s;
995                 if (split)
996                         v = s.split("\\s+")[0];
997                 try {
998                         return Integer.parseInt(v);
999                 } catch (NumberFormatException ne) {
1000                         throw new AltosConfigDataException("Invalid %s \"%s\"", name, s);
1001                 }
1002         }
1003
1004         public int apogee_delay() throws AltosConfigDataException {
1005                 return parse_int("apogee delay", apogee_delay_value.getSelectedItem().toString(), false);
1006         }
1007
1008         public void set_apogee_lockout(int new_apogee_lockout) {
1009                 apogee_lockout_value.setSelectedItem(Integer.toString(new_apogee_lockout));
1010                 apogee_lockout_value.setEnabled(new_apogee_lockout >= 0);
1011
1012                 apogee_lockout_value.setVisible(new_apogee_lockout >= 0);
1013                 apogee_lockout_label.setVisible(new_apogee_lockout >= 0);
1014         }
1015
1016         public int apogee_lockout() throws AltosConfigDataException {
1017                 return parse_int("apogee lockout", apogee_lockout_value.getSelectedItem().toString(), false);
1018         }
1019
1020         public void set_radio_frequency(double new_radio_frequency) {
1021                 radio_frequency_label.setVisible(new_radio_frequency >= 0);
1022                 radio_frequency_value.set_frequency(new_radio_frequency);
1023         }
1024
1025         public double radio_frequency() {
1026                 return radio_frequency_value.frequency();
1027         }
1028
1029         public void set_radio_calibration(int new_radio_calibration) {
1030                 radio_calibration_value.setVisible(new_radio_calibration >= 0);
1031                 radio_calibration_label.setVisible(new_radio_calibration >= 0);
1032
1033                 if (new_radio_calibration < 0)
1034                         radio_calibration_value.setText("Disabled");
1035                 else
1036                         radio_calibration_value.setText(String.format("%d", new_radio_calibration));
1037         }
1038
1039         public int radio_calibration() throws AltosConfigDataException {
1040                 return parse_int("radio calibration", radio_calibration_value.getText(), false);
1041         }
1042
1043         public void set_radio_enable(int new_radio_enable) {
1044                 radio_enable_label.setVisible(new_radio_enable >= 0);
1045                 radio_enable_value.setVisible(new_radio_enable >= 0);
1046
1047                 if (new_radio_enable >= 0) {
1048                         radio_enable_value.setSelected(new_radio_enable > 0);
1049                         radio_enable_value.setEnabled(true);
1050                 } else {
1051                         radio_enable_value.setSelected(true);
1052                         radio_enable_value.setEnabled(false);
1053                 }
1054                 set_radio_enable_tool_tip();
1055         }
1056
1057         public int radio_enable() {
1058                 if (radio_enable_value.isEnabled())
1059                         return radio_enable_value.isSelected() ? 1 : 0;
1060                 else
1061                         return -1;
1062         }
1063
1064         public void set_telemetry_rate(int new_rate) {
1065                 rate_label.setVisible(new_rate >= 0);
1066
1067                 rate_value.set_rate(new_rate);
1068         }
1069
1070         public int telemetry_rate() {
1071                 return rate_value.rate();
1072         }
1073
1074         public void set_callsign(String new_callsign) {
1075                 callsign_value.setVisible(new_callsign != null);
1076                 callsign_label.setVisible(new_callsign != null);
1077
1078                 callsign_value.setText(new_callsign);
1079         }
1080
1081         public String callsign() {
1082                 return callsign_value.getText();
1083         }
1084
1085         int     flight_log_max_limit;
1086         int     flight_log_max;
1087
1088         public String flight_log_max_label(int flight_log_max) {
1089                 if (flight_log_max_limit != 0) {
1090                         int     nflight = flight_log_max_limit / flight_log_max;
1091                         String  plural = nflight > 1 ? "s" : "";
1092
1093                         return String.format("%d (%d flight%s)", flight_log_max, nflight, plural);
1094                 }
1095                 return String.format("%d", flight_log_max);
1096         }
1097
1098         public void set_flight_log_max(int new_flight_log_max) {
1099                 flight_log_max_value.setVisible(new_flight_log_max >= 0);
1100                 flight_log_max_label.setVisible(new_flight_log_max >= 0);
1101
1102                 flight_log_max_value.setSelectedItem(flight_log_max_label(new_flight_log_max));
1103                 flight_log_max = new_flight_log_max;
1104                 set_flight_log_max_tool_tip();
1105         }
1106
1107         public void set_flight_log_max_enabled(boolean enable) {
1108                 flight_log_max_value.setEnabled(enable);
1109                 set_flight_log_max_tool_tip();
1110         }
1111
1112         public int flight_log_max() throws AltosConfigDataException {
1113                 return parse_int("flight log max", flight_log_max_value.getSelectedItem().toString(), true);
1114         }
1115
1116         public void set_flight_log_max_limit(int new_flight_log_max_limit) {
1117                 flight_log_max_limit = new_flight_log_max_limit;
1118                 flight_log_max_value.removeAllItems();
1119                 for (int i = 8; i >= 1; i--) {
1120                         int     size = flight_log_max_limit / i;
1121                         flight_log_max_value.addItem(String.format("%d (%d flights)", size, i));
1122                 }
1123                 if (flight_log_max != 0)
1124                         set_flight_log_max(flight_log_max);
1125         }
1126
1127         public void set_ignite_mode(int new_ignite_mode) {
1128                 ignite_mode_value.setVisible(new_ignite_mode >= 0);
1129                 ignite_mode_label.setVisible(new_ignite_mode >= 0);
1130
1131                 if (new_ignite_mode >= ignite_mode_values.length)
1132                         new_ignite_mode = 0;
1133                 if (new_ignite_mode < 0) {
1134                         ignite_mode_value.setEnabled(false);
1135                         new_ignite_mode = 0;
1136                 } else {
1137                         ignite_mode_value.setEnabled(true);
1138                 }
1139                 ignite_mode_value.setSelectedIndex(new_ignite_mode);
1140                 set_ignite_mode_tool_tip();
1141         }
1142
1143         public int ignite_mode() {
1144                 if (ignite_mode_value.isEnabled())
1145                         return ignite_mode_value.getSelectedIndex();
1146                 else
1147                         return -1;
1148         }
1149
1150
1151         public void set_pad_orientation(int new_pad_orientation) {
1152                 pad_orientation_value.setVisible(new_pad_orientation >= 0);
1153                 pad_orientation_label.setVisible(new_pad_orientation >= 0);
1154
1155                 if (new_pad_orientation >= pad_orientation_values.length)
1156                         new_pad_orientation = 0;
1157                 if (new_pad_orientation < 0)
1158                         new_pad_orientation = 0;
1159                 pad_orientation_value.setSelectedIndex(new_pad_orientation);
1160                 set_pad_orientation_tool_tip();
1161         }
1162
1163         public int pad_orientation() {
1164                 if (pad_orientation_value.isEnabled())
1165                         return pad_orientation_value.getSelectedIndex();
1166                 else
1167                         return -1;
1168         }
1169
1170         public void set_beep(int new_beep) {
1171                 beep_value.setVisible(new_beep >= 0);
1172                 beep_label.setVisible(new_beep >= 0);
1173
1174                 int new_freq = (int) Math.floor (AltosConvert.beep_value_to_freq(new_beep) + 0.5);
1175                 for (int i = 0; i < beep_values.length; i++)
1176                         if (new_beep == AltosConvert.beep_freq_to_value(Integer.parseInt(beep_values[i]))) {
1177                                 beep_value.setSelectedIndex(i);
1178                                 set_beep_tool_tip();
1179                                 return;
1180                         }
1181                 beep_value.setSelectedItem(String.format("%d", new_freq));
1182                 beep_value.setEnabled(new_beep >= 0);
1183                 set_beep_tool_tip();
1184         }
1185
1186         public int beep() {
1187                 if (beep_value.isEnabled())
1188                         return AltosConvert.beep_freq_to_value(Integer.parseInt(beep_value.getSelectedItem().toString()));
1189                 else
1190                         return -1;
1191         }
1192
1193         String[] tracker_motion_values() {
1194                 if (AltosConvert.imperial_units)
1195                         return tracker_motion_values_ft;
1196                 else
1197                         return tracker_motion_values_m;
1198         }
1199
1200         void set_tracker_motion_values() {
1201                 String[]        v = tracker_motion_values();
1202                 while (tracker_motion_value.getItemCount() > 0)
1203                         tracker_motion_value.removeItemAt(0);
1204                 for (int i = 0; i < v.length; i++)
1205                         tracker_motion_value.addItem(v[i]);
1206                 tracker_motion_value.setMaximumRowCount(v.length);
1207         }
1208
1209         String get_tracker_motion_label() {
1210                 return String.format("Logging Trigger Motion (%s):", AltosConvert.height.show_units());
1211         }
1212
1213         void set_tracker_tool_tip() {
1214                 if (tracker_motion_value.isEnabled())
1215                         tracker_motion_value.setToolTipText("How far the device must move before logging");
1216                 else
1217                         tracker_motion_value.setToolTipText("This device doesn't disable logging when stationary");
1218                 if (tracker_interval_value.isEnabled())
1219                         tracker_interval_value.setToolTipText("How often to report GPS position");
1220                 else
1221                         tracker_interval_value.setToolTipText("This device can't configure interval");
1222         }
1223
1224         public void set_tracker_motion(int tracker_motion) {
1225                 tracker_motion_label.setVisible(tracker_motion >= 0);
1226                 tracker_motion_value.setVisible(tracker_motion >= 0);
1227
1228                 if (tracker_motion < 0) {
1229                         tracker_motion_value.setEnabled(false);
1230                 } else {
1231                         tracker_motion_value.setEnabled(true);
1232                         tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion));
1233                 }
1234         }
1235
1236         public int tracker_motion() throws AltosConfigDataException {
1237                 return (int) AltosConvert.height.parse(tracker_motion_value.getSelectedItem().toString());
1238         }
1239
1240         public void set_tracker_interval(int tracker_interval) {
1241                 tracker_interval_label.setVisible(tracker_interval >= 0);
1242                 tracker_interval_value.setVisible(tracker_interval >= 0);
1243
1244                 if (tracker_interval< 0) {
1245                         tracker_interval_value.setEnabled(false);
1246                 } else {
1247                         tracker_interval_value.setEnabled(true);
1248                         tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval));
1249                 }
1250         }
1251
1252         public int tracker_interval() throws AltosConfigDataException {
1253                 return parse_int ("tracker interval", tracker_interval_value.getSelectedItem().toString(), false);
1254         }
1255
1256         public void set_pyros(AltosPyro[] new_pyros) {
1257                 pyros = new_pyros;
1258                 pyro.setVisible(pyros != null);
1259                 if (pyros != null && pyro_ui != null)
1260                         pyro_ui.set_pyros(pyros);
1261         }
1262
1263         public AltosPyro[] pyros() throws AltosConfigDataException {
1264                 if (pyro_ui != null)
1265                         pyros = pyro_ui.get_pyros();
1266                 return pyros;
1267         }
1268
1269         public void set_pyro_firing_time(double new_pyro_firing_time) {
1270                 pyro_firing_time = new_pyro_firing_time;
1271                 pyro.setVisible(pyro_firing_time >= 0);
1272                 if (pyro_firing_time >= 0 && pyro_ui != null)
1273                         pyro_ui.set_pyro_firing_time(pyro_firing_time);
1274         }
1275
1276         public double pyro_firing_time() throws AltosConfigDataException {
1277                 if (pyro_ui != null)
1278                         pyro_firing_time = pyro_ui.get_pyro_firing_time();
1279                 return pyro_firing_time;
1280         }
1281
1282         public void set_aprs_interval(int new_aprs_interval) {
1283                 aprs_interval_value.setVisible(new_aprs_interval >= 0);
1284                 aprs_interval_label.setVisible(new_aprs_interval >= 0);
1285
1286                 String  s;
1287
1288                 if (new_aprs_interval <= 0)
1289                         s = "Disabled";
1290                 else
1291                         s = Integer.toString(new_aprs_interval);
1292                 aprs_interval_value.setSelectedItem(s);
1293                 set_aprs_interval_tool_tip();
1294         }
1295
1296         public int aprs_interval() throws AltosConfigDataException {
1297                 String  s = aprs_interval_value.getSelectedItem().toString();
1298
1299                 if (s.equals("Disabled"))
1300                         return 0;
1301                 return parse_int("aprs interval", s, false);
1302         }
1303
1304         public void set_aprs_ssid(int new_aprs_ssid) {
1305                 aprs_ssid_value.setVisible(new_aprs_ssid >= 0);
1306                 aprs_ssid_label.setVisible(new_aprs_ssid >= 0);
1307
1308                 aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid));
1309                 set_aprs_ssid_tool_tip();
1310         }
1311
1312         public int aprs_ssid() throws AltosConfigDataException {
1313                 Integer i = (Integer) aprs_ssid_value.getSelectedItem();
1314                 return i;
1315         }
1316 }