+ public void set_beep(int new_beep) {
+ 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_horiz_values() {
+ if (AltosConvert.imperial_units)
+ return tracker_horiz_values_ft;
+ else
+ return tracker_horiz_values_m;
+ }
+
+ void set_tracker_horiz_values() {
+ String[] v = tracker_horiz_values();
+ while (tracker_horiz_value.getItemCount() > 0)
+ tracker_horiz_value.removeItemAt(0);
+ for (int i = 0; i < v.length; i++)
+ tracker_horiz_value.addItem(v[i]);
+ tracker_horiz_value.setMaximumRowCount(v.length);
+ }
+
+ String get_tracker_horiz_label() {
+ return String.format("Logging Trigger Horizontal (%s):", AltosConvert.height.show_units());
+ }
+
+ String[] tracker_vert_values() {
+ if (AltosConvert.imperial_units)
+ return tracker_vert_values_ft;
+ else
+ return tracker_vert_values_m;
+ }
+
+ void set_tracker_vert_values() {
+ String[] v = tracker_vert_values();
+ while (tracker_vert_value.getItemCount() > 0)
+ tracker_vert_value.removeItemAt(0);
+ for (int i = 0; i < v.length; i++)
+ tracker_vert_value.addItem(v[i]);
+ tracker_vert_value.setMaximumRowCount(v.length);
+ }
+
+ void set_tracker_tool_tip() {
+ if (tracker_horiz_value.isEnabled())
+ tracker_horiz_value.setToolTipText("How far the device must move before logging is enabled");
+ else
+ tracker_horiz_value.setToolTipText("This device doesn't disable logging before motion");
+ if (tracker_vert_value.isEnabled())
+ tracker_vert_value.setToolTipText("How far the device must move before logging is enabled");
+ else
+ tracker_vert_value.setToolTipText("This device doesn't disable logging before motion");
+ }
+
+ String get_tracker_vert_label() {
+ return String.format("Logging Trigger Vertical (%s):", AltosConvert.height.show_units());
+ }
+
+ public void set_tracker_distances(int[] tracker_distances) {
+ if (tracker_distances != null) {
+ tracker_horiz_value.setSelectedItem(AltosConvert.height.say(tracker_distances[0]));
+ tracker_vert_value.setSelectedItem(AltosConvert.height.say(tracker_distances[1]));
+ tracker_horiz_value.setEnabled(true);
+ tracker_vert_value.setEnabled(true);
+ } else {
+ tracker_horiz_value.setEnabled(false);
+ tracker_vert_value.setEnabled(false);
+ }
+ }
+
+ public int[] tracker_distances() {
+ if (tracker_horiz_value.isEnabled() && tracker_vert_value.isEnabled()) {
+ int[] t = {
+ (int) (AltosConvert.height.parse(tracker_horiz_value.getSelectedItem().toString()) + 0.5),
+ (int) (AltosConvert.height.parse(tracker_vert_value.getSelectedItem().toString()) + 0.5),
+ };
+ return t;
+ }
+ return null;
+ }
+
+ 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_aprs_interval(int new_aprs_interval) {
+ String s;
+
+ if (new_aprs_interval <= 0)
+ s = "Disabled";
+ else
+ s = Integer.toString(new_aprs_interval);
+ aprs_interval_value.setSelectedItem(s);
+ aprs_interval_value.setVisible(new_aprs_interval >= 0);
+ set_aprs_interval_tool_tip();
+ }
+
+ public int aprs_interval() {
+ String s = aprs_interval_value.getSelectedItem().toString();
+
+ if (s.equals("Disabled"))
+ return 0;
+ return Integer.parseInt(s);