+ public void set_beep(int new_beep) {
+ beep_value.setVisible(new_beep >= 0);
+ beep_label.setVisible(new_beep >= 0);
+
+ int new_freq = (int) Math.floor (AltosConvert.beep_value_to_freq(new_beep) + 0.5);
+ for (int i = 0; i < beep_values.length; i++)
+ if (new_beep == AltosConvert.beep_freq_to_value(Integer.parseInt(beep_values[i]))) {
+ beep_value.setSelectedIndex(i);
+ set_beep_tool_tip();
+ return;
+ }
+ beep_value.setSelectedItem(String.format("%d", new_freq));
+ beep_value.setEnabled(new_beep >= 0);
+ set_beep_tool_tip();
+ }
+
+ public int beep() {
+ if (beep_value.isEnabled())
+ return AltosConvert.beep_freq_to_value(Integer.parseInt(beep_value.getSelectedItem().toString()));
+ else
+ return -1;
+ }
+
+ String[] tracker_motion_values() {
+ if (AltosConvert.imperial_units)
+ return tracker_motion_values_ft;
+ else
+ return tracker_motion_values_m;
+ }
+
+ void set_tracker_motion_values() {
+ String[] v = tracker_motion_values();
+ while (tracker_motion_value.getItemCount() > 0)
+ tracker_motion_value.removeItemAt(0);
+ for (int i = 0; i < v.length; i++)
+ tracker_motion_value.addItem(v[i]);
+ tracker_motion_value.setMaximumRowCount(v.length);
+ }
+
+ String get_tracker_motion_label() {
+ return String.format("Logging Trigger Motion (%s):", AltosConvert.height.show_units());
+ }
+
+ void set_tracker_tool_tip() {
+ if (tracker_motion_value.isEnabled())
+ tracker_motion_value.setToolTipText("How far the device must move before logging");
+ else
+ tracker_motion_value.setToolTipText("This device doesn't disable logging when stationary");
+ if (tracker_interval_value.isEnabled())
+ tracker_interval_value.setToolTipText("How often to report GPS position");
+ else
+ tracker_interval_value.setToolTipText("This device can't configure interval");
+ }
+
+ public void set_tracker_motion(int tracker_motion) {
+ tracker_motion_label.setVisible(tracker_motion >= 0);
+ tracker_motion_value.setVisible(tracker_motion >= 0);
+
+ if (tracker_motion < 0) {
+ tracker_motion_value.setEnabled(false);
+ } else {
+ tracker_motion_value.setEnabled(true);
+ tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion));
+ }
+ }
+
+ public int tracker_motion() throws AltosConfigDataException {
+ return (int) AltosConvert.height.parse(tracker_motion_value.getSelectedItem().toString());
+ }
+
+ public void set_tracker_interval(int tracker_interval) {
+ tracker_interval_label.setVisible(tracker_interval >= 0);
+ tracker_interval_value.setVisible(tracker_interval >= 0);
+
+ if (tracker_interval< 0) {
+ tracker_interval_value.setEnabled(false);
+ } else {
+ tracker_interval_value.setEnabled(true);
+ tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval));
+ }
+ }
+
+ public int tracker_interval() throws AltosConfigDataException {
+ return parse_int ("tracker interval", tracker_interval_value.getSelectedItem().toString(), false);
+ }
+
+ public void set_pyros(AltosPyro[] new_pyros) {
+ pyros = new_pyros;
+ pyro.setVisible(pyros != null);
+ if (pyros != null && pyro_ui != null)
+ pyro_ui.set_pyros(pyros);
+ }
+
+ public AltosPyro[] pyros() throws AltosConfigDataException {
+ if (pyro_ui != null)
+ pyros = pyro_ui.get_pyros();
+ return pyros;
+ }
+
+ public void set_pyro_firing_time(double new_pyro_firing_time) {
+ pyro_firing_time = new_pyro_firing_time;
+ pyro.setVisible(pyro_firing_time >= 0);
+ if (pyro_firing_time >= 0 && pyro_ui != null)
+ pyro_ui.set_pyro_firing_time(pyro_firing_time);
+ }
+
+ public double pyro_firing_time() throws AltosConfigDataException {
+ if (pyro_ui != null)
+ pyro_firing_time = pyro_ui.get_pyro_firing_time();
+ return pyro_firing_time;
+ }
+
+ public void set_aprs_interval(int new_aprs_interval) {
+ aprs_interval_value.setVisible(new_aprs_interval >= 0);
+ aprs_interval_label.setVisible(new_aprs_interval >= 0);
+
+ String s;
+
+ if (new_aprs_interval <= 0)
+ s = "Disabled";
+ else
+ s = Integer.toString(new_aprs_interval);
+ aprs_interval_value.setSelectedItem(s);
+ set_aprs_interval_tool_tip();
+ }
+
+ public int aprs_interval() throws AltosConfigDataException {
+ String s = aprs_interval_value.getSelectedItem().toString();
+
+ if (s.equals("Disabled"))
+ return 0;
+ return parse_int("aprs interval", s, false);
+ }
+
+ public void set_aprs_ssid(int new_aprs_ssid) {
+ aprs_ssid_value.setVisible(new_aprs_ssid >= 0);
+ aprs_ssid_label.setVisible(new_aprs_ssid >= 0);
+
+ aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid));
+ set_aprs_ssid_tool_tip();
+ }
+
+ public int aprs_ssid() throws AltosConfigDataException {
+ Integer i = (Integer) aprs_ssid_value.getSelectedItem();
+ return i;