From c8078d352a7f54a4a97d25af080155d3f875536a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 16 Jun 2014 22:49:34 -0700 Subject: java: Bump java library versions for next release Prepare for future release by bumping java versions now Signed-off-by: Keith Packard --- altosui/AltosConfigUI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'altosui/AltosConfigUI.java') diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 1b5ff988..4a33b64f 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -21,8 +21,8 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosConfigUI extends AltosUIDialog -- cgit v1.2.3 From 3016ee5f21ec66bf9230b90ab1420b8fad628f8d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 20 Jun 2014 00:40:10 -0700 Subject: altosuilib: Wrap radio frequency menu in JMenuBar when used in config The device config dialogs place the radio frequency menu inside a dialog box; it needs to be inside a MenuBar to work properly, so create one to hold it. Signed-off-by: Keith Packard --- altosui/AltosConfigUI.java | 5 ++++- telegps/TeleGPSConfigUI.java | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'altosui/AltosConfigUI.java') diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 4a33b64f..a4e7aca6 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -419,7 +419,10 @@ public class AltosConfigUI c.ipady = 5; radio_frequency_value = new AltosFreqList(); radio_frequency_value.addItemListener(this); - pane.add(radio_frequency_value, c); + + JMenuBar menu_bar = new JMenuBar(); + menu_bar.add(radio_frequency_value); + pane.add(menu_bar, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); row++; diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index 7d28b371..dfbff12d 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -257,7 +257,11 @@ public class TeleGPSConfigUI c.ipady = 5; radio_frequency_value = new AltosFreqList(); radio_frequency_value.addItemListener(this); - pane.add(radio_frequency_value, c); + + JMenuBar menu_bar = new JMenuBar(); + menu_bar.add(radio_frequency_value); + + pane.add(menu_bar, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); row++; -- cgit v1.2.3 From 6cc2d671c0e335fbedb0e97699f8f273502c6807 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 22 Jun 2014 21:06:24 -0700 Subject: altosui/telegps: Expose configurable APRS SSID Signed-off-by: Keith Packard --- altoslib/AltosConfigData.java | 8 +++++++ altoslib/AltosConfigValues.java | 4 ++++ altosui/AltosConfigUI.java | 53 +++++++++++++++++++++++++++++++++++++++++ telegps/TeleGPSConfigUI.java | 53 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+) (limited to 'altosui/AltosConfigUI.java') diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index d8b0b081..3bf8ea43 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -71,6 +71,7 @@ public class AltosConfigData implements Iterable { /* HAS_APRS */ public int aprs_interval; + public int aprs_ssid; /* HAS_BEEP */ public int beep; @@ -250,6 +251,7 @@ public class AltosConfigData implements Iterable { pyro_firing_time = -1; aprs_interval = -1; + aprs_ssid = -1; beep = -1; @@ -333,6 +335,7 @@ public class AltosConfigData implements Iterable { /* HAS_APRS */ try { aprs_interval = get_int(line, "APRS interval:"); } catch (Exception e) {} + try { aprs_ssid = get_int(line, "APRS SSID:"); } catch (Exception e) {} /* HAS_BEEP */ try { beep = get_int(line, "Beeper setting:"); } catch (Exception e) {} @@ -459,6 +462,8 @@ public class AltosConfigData implements Iterable { /* HAS_APRS */ if (aprs_interval >= 0) aprs_interval = source.aprs_interval(); + if (aprs_ssid >= 0) + aprs_ssid = source.aprs_ssid(); /* HAS_BEEP */ if (beep >= 0) @@ -507,6 +512,7 @@ public class AltosConfigData implements Iterable { dest.set_pyros(null); dest.set_pyro_firing_time(pyro_firing_time); dest.set_aprs_interval(aprs_interval); + dest.set_aprs_ssid(aprs_ssid); dest.set_beep(beep); dest.set_tracker_motion(tracker_motion); dest.set_tracker_interval(tracker_interval); @@ -577,6 +583,8 @@ public class AltosConfigData implements Iterable { /* HAS_APRS */ if (aprs_interval >= 0) link.printf("c A %d\n", aprs_interval); + if (aprs_ssid >= 0) + link.printf("c S %d\n", aprs_ssid); /* HAS_BEEP */ if (beep >= 0) diff --git a/altoslib/AltosConfigValues.java b/altoslib/AltosConfigValues.java index dcb4d48f..b0c49e98 100644 --- a/altoslib/AltosConfigValues.java +++ b/altoslib/AltosConfigValues.java @@ -81,6 +81,10 @@ public interface AltosConfigValues { public abstract void set_aprs_interval(int new_aprs_interval); + public abstract int aprs_ssid() throws AltosConfigDataException; + + public abstract void set_aprs_ssid(int new_aprs_ssid); + public abstract int beep() throws AltosConfigDataException; public abstract void set_beep(int new_beep); diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index a4e7aca6..6e1b47c2 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -41,6 +41,7 @@ public class AltosConfigUI JLabel radio_frequency_label; JLabel radio_enable_label; JLabel aprs_interval_label; + JLabel aprs_ssid_label; JLabel flight_log_max_label; JLabel ignite_mode_label; JLabel pad_orientation_label; @@ -62,6 +63,7 @@ public class AltosConfigUI JTextField radio_calibration_value; JRadioButton radio_enable_value; JComboBox aprs_interval_value; + JComboBox aprs_ssid_value; JComboBox flight_log_max_value; JComboBox ignite_mode_value; JComboBox pad_orientation_value; @@ -113,6 +115,10 @@ public class AltosConfigUI "10" }; + static Integer[] aprs_ssid_values = { + 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 + }; + static String[] beep_values = { "3750", "4000", @@ -201,6 +207,15 @@ public class AltosConfigUI aprs_interval_value.setToolTipText("Hardware doesn't support APRS"); } + void set_aprs_ssid_tool_tip() { + if (aprs_ssid_value.isEnabled()) + aprs_interval_value.setToolTipText("Set the APRS SSID (secondary station identifier)"); + else if (aprs_interval_value.isEnabled()) + aprs_interval_value.setToolTipText("Software version doesn't support setting the APRS SSID"); + else + aprs_interval_value.setToolTipText("Hardware doesn't support APRS"); + } + void set_flight_log_max_tool_tip() { if (flight_log_max_value.isEnabled()) flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)"); @@ -504,6 +519,33 @@ public class AltosConfigUI set_aprs_interval_tool_tip(); row++; + /* APRS SSID */ + c = new GridBagConstraints(); + c.gridx = 0; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + c.ipady = 5; + aprs_ssid_label = new JLabel("APRS SSID:"); + pane.add(aprs_ssid_label, c); + + c = new GridBagConstraints(); + c.gridx = 4; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.anchor = GridBagConstraints.LINE_START; + c.insets = ir; + c.ipady = 5; + aprs_ssid_value = new JComboBox(aprs_ssid_values); + aprs_ssid_value.setEditable(false); + aprs_ssid_value.addItemListener(this); + aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length); + pane.add(aprs_ssid_value, c); + set_aprs_ssid_tool_tip(); + row++; + /* Callsign */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = row; @@ -1180,4 +1222,15 @@ public class AltosConfigUI return 0; return parse_int("aprs interval", s, false); } + + public void set_aprs_ssid(int new_aprs_ssid) { + aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid)); + aprs_ssid_value.setVisible(new_aprs_ssid >= 0); + set_aprs_ssid_tool_tip(); + } + + public int aprs_ssid() throws AltosConfigDataException { + Integer i = (Integer) aprs_ssid_value.getSelectedItem(); + return i; + } } diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index dfbff12d..1fdfd70c 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -38,6 +38,7 @@ public class TeleGPSConfigUI JLabel radio_frequency_label; JLabel radio_enable_label; JLabel aprs_interval_label; + JLabel aprs_ssid_label; JLabel flight_log_max_label; JLabel callsign_label; JLabel tracker_motion_label; @@ -53,6 +54,7 @@ public class TeleGPSConfigUI JTextField radio_calibration_value; JRadioButton radio_enable_value; JComboBox aprs_interval_value; + JComboBox aprs_ssid_value; JComboBox flight_log_max_value; JTextField callsign_value; JComboBox tracker_motion_value; @@ -72,6 +74,10 @@ public class TeleGPSConfigUI "10" }; + static Integer[] aprs_ssid_values = { + 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 + }; + static String[] tracker_motion_values_m = { "2", "5", @@ -148,6 +154,15 @@ public class TeleGPSConfigUI aprs_interval_value.setToolTipText("Hardware doesn't support APRS"); } + void set_aprs_ssid_tool_tip() { + if (aprs_ssid_value.isEnabled()) + aprs_interval_value.setToolTipText("Set the APRS SSID (secondary station identifier)"); + else if (aprs_interval_value.isEnabled()) + aprs_interval_value.setToolTipText("Software version doesn't support setting the APRS SSID"); + else + aprs_interval_value.setToolTipText("Hardware doesn't support APRS"); + } + void set_flight_log_max_tool_tip() { if (flight_log_max_value.isEnabled()) flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)"); @@ -341,6 +356,33 @@ public class TeleGPSConfigUI set_aprs_interval_tool_tip(); row++; + /* APRS SSID */ + c = new GridBagConstraints(); + c.gridx = 0; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + c.ipady = 5; + aprs_ssid_label = new JLabel("APRS SSID:"); + pane.add(aprs_ssid_label, c); + + c = new GridBagConstraints(); + c.gridx = 4; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.anchor = GridBagConstraints.LINE_START; + c.insets = ir; + c.ipady = 5; + aprs_ssid_value = new JComboBox(aprs_ssid_values); + aprs_ssid_value.setEditable(false); + aprs_ssid_value.addItemListener(this); + aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length); + pane.add(aprs_ssid_value, c); + set_aprs_ssid_tool_tip(); + row++; + /* Callsign */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = row; @@ -786,4 +828,15 @@ public class TeleGPSConfigUI return 0; return parse_int("aprs interval", s, false); } + + public void set_aprs_ssid(int new_aprs_ssid) { + aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid)); + aprs_ssid_value.setVisible(new_aprs_ssid >= 0); + set_aprs_ssid_tool_tip(); + } + + public int aprs_ssid() throws AltosConfigDataException { + Integer i = (Integer) aprs_ssid_value.getSelectedItem(); + return i; + } } -- cgit v1.2.3 From 7427f8bac7b3743ce0ab990612bf7168b95e22f9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 20:52:34 -0700 Subject: altosui: Don't show the tracker motion value when switching units The tracker value was left enabled when hidden; the logic for deciding whether to update it with new information used only the enabled state, not the visible state. Set both states when hiding it to keep things more consistent Signed-off-by: Keith Packard --- altosui/AltosConfigUI.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'altosui/AltosConfigUI.java') diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 6e1b47c2..de1b582e 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -925,6 +925,8 @@ public class AltosConfigUI } public void units_changed(boolean imperial_units) { + boolean was_dirty = dirty; + String v = main_deploy_value.getSelectedItem().toString(); main_deploy_label.setText(get_main_deploy_label()); set_main_deploy_values(); @@ -937,6 +939,9 @@ public class AltosConfigUI set_tracker_motion_values(); set_tracker_motion((int) (AltosConvert.height.parse(motion, !imperial_units) + 0.5)); } + + if (!was_dirty) + set_clean(); } public void set_apogee_delay(int new_apogee_delay) { @@ -1151,9 +1156,11 @@ public class AltosConfigUI if (tracker_motion < 0) { tracker_motion_label.setVisible(false); tracker_motion_value.setVisible(false); + tracker_motion_value.setEnabled(false); } else { tracker_motion_label.setVisible(true); tracker_motion_value.setVisible(true); + tracker_motion_value.setEnabled(true); tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion)); } } @@ -1166,9 +1173,11 @@ public class AltosConfigUI if (tracker_interval< 0) { tracker_interval_label.setVisible(false); tracker_interval_value.setVisible(false); + tracker_interval_value.setEnabled(false); } else { tracker_interval_label.setVisible(true); tracker_interval_value.setVisible(true); + tracker_interval_value.setEnabled(true); tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval)); } } -- cgit v1.2.3 From 98c3c3f7edd58358939f7dacf5b8f4c336712f5b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 4 Jul 2014 23:38:53 -0700 Subject: altosui/telegps: Undo the frequency/telemetry menu changes Using menus for these items isn't what we want; we want to show the current value on the screen, which is what a combo box is for. Switch back to those and remove the frequency and telemetry config from the TeleGPS menu bar so that Mac OS X is happy. Signed-off-by: Keith Packard --- altosui/AltosConfigTDUI.java | 33 ++++-- altosui/AltosConfigUI.java | 9 +- altosui/AltosFlightUI.java | 65 +++++++---- altosui/AltosIdleMonitorUI.java | 4 +- altosuilib/AltosFreqList.java | 206 ----------------------------------- altosuilib/AltosUIFreqList.java | 85 +++++++++++++++ altosuilib/AltosUITelemetryList.java | 47 ++++++++ altosuilib/AltosUITelemetryMenu.java | 88 --------------- altosuilib/Makefile.am | 4 +- telegps/TeleGPS.java | 28 +++-- telegps/TeleGPSConfigUI.java | 10 +- 11 files changed, 229 insertions(+), 350 deletions(-) delete mode 100644 altosuilib/AltosFreqList.java create mode 100644 altosuilib/AltosUIFreqList.java create mode 100644 altosuilib/AltosUITelemetryList.java delete mode 100644 altosuilib/AltosUITelemetryMenu.java (limited to 'altosui/AltosConfigUI.java') diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java index ca365718..947d78ee 100644 --- a/altosui/AltosConfigTDUI.java +++ b/altosui/AltosConfigTDUI.java @@ -44,8 +44,7 @@ public class AltosConfigTDUI JLabel product_value; JLabel version_value; JLabel serial_value; - JMenuBar radio_frequency_menu_bar; - AltosFreqList radio_frequency_value; + AltosUIFreqList radio_frequency_value; JLabel radio_calibration_value; JButton save; @@ -55,7 +54,6 @@ public class AltosConfigTDUI ActionListener listener; - /* A window listener to catch closing events and tell the config code */ class ConfigListener extends WindowAdapter { AltosConfigTDUI ui; @@ -167,11 +165,9 @@ public class AltosConfigTDUI c.anchor = GridBagConstraints.LINE_START; c.insets = ir; c.ipady = 5; - radio_frequency_value = new AltosFreqList(false); + radio_frequency_value = new AltosUIFreqList(); radio_frequency_value.addItemListener(this); - radio_frequency_menu_bar = new JMenuBar(); - radio_frequency_menu_bar.add(radio_frequency_value); - pane.add(radio_frequency_menu_bar, c); + pane.add(radio_frequency_value, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); /* Radio Calibration */ @@ -311,7 +307,28 @@ public class AltosConfigTDUI } public void set_radio_frequency(double new_radio_frequency) { - radio_frequency_value.set_frequency(new_radio_frequency); + int i; + for (i = 0; i < radio_frequency_value.getItemCount(); i++) { + AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i); + + if (f.close(new_radio_frequency)) { + radio_frequency_value.setSelectedIndex(i); + return; + } + } + for (i = 0; i < radio_frequency_value.getItemCount(); i++) { + AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i); + + if (new_radio_frequency < f.frequency) + break; + } + String description = String.format("%s serial %s", + product_value.getText(), + serial_value.getText()); + AltosFrequency new_frequency = new AltosFrequency(new_radio_frequency, description); + AltosPreferences.add_common_frequency(new_frequency); + radio_frequency_value.insertItemAt(new_frequency, i); + radio_frequency_value.setSelectedIndex(i); } public double radio_frequency() { diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index de1b582e..91c37fd5 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -59,7 +59,7 @@ public class AltosConfigUI JComboBox main_deploy_value; JComboBox apogee_delay_value; JComboBox apogee_lockout_value; - AltosFreqList radio_frequency_value; + AltosUIFreqList radio_frequency_value; JTextField radio_calibration_value; JRadioButton radio_enable_value; JComboBox aprs_interval_value; @@ -432,12 +432,9 @@ public class AltosConfigUI c.anchor = GridBagConstraints.LINE_START; c.insets = ir; c.ipady = 5; - radio_frequency_value = new AltosFreqList(); + radio_frequency_value = new AltosUIFreqList(); radio_frequency_value.addItemListener(this); - - JMenuBar menu_bar = new JMenuBar(); - menu_bar.add(radio_frequency_value); - pane.add(menu_bar, c); + pane.add(radio_frequency_value, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); row++; diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index 5aff1817..5db0ee92 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -169,18 +169,14 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { exit_on_close = true; } - Container bag; - - JMenuBar menu_bar; - AltosFreqList frequencies; - AltosUITelemetryMenu telemetries; + Container bag; + AltosUIFreqList frequencies; + AltosUITelemetryList telemetries; JLabel telemetry; ActionListener show_timer; public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) { - super(); - AltosUIPreferences.set_component(this); displays = new LinkedList(); @@ -197,12 +193,8 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { /* Stick channel selector at top of table for telemetry monitoring */ if (serial >= 0) { - - menu_bar = new JMenuBar(); - setJMenuBar(menu_bar); - - // Channel menu - frequencies = new AltosFreqList(AltosUIPreferences.frequency(serial)); + // Frequency menu + frequencies = new AltosUIFreqList(AltosUIPreferences.frequency(serial)); frequencies.set_product("Monitor"); frequencies.set_serial(serial); frequencies.addActionListener(new ActionListener() { @@ -216,19 +208,43 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { reader.save_frequency(); } }); - menu_bar.add (frequencies); - - // Telemetry format menu - if (reader.supports_telemetry(AltosLib.ao_telemetry_standard)) { - telemetries = new AltosUITelemetryMenu(serial); + c.gridx = 0; + c.gridy = 0; + c.weightx = 0; + c.weighty = 0; + c.insets = new Insets(3, 3, 3, 3); + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + bag.add (frequencies, c); + + // Telemetry format list + if (reader.supports_telemetry(Altos.ao_telemetry_standard)) { + telemetries = new JComboBox(); + for (int i = 1; i <= Altos.ao_telemetry_max; i++) + telemetries.addItem(Altos.telemetry_name(i)); + int telemetry = AltosPreferences.telemetry(serial); + if (telemetry <= Altos.ao_telemetry_off || + telemetry > Altos.ao_telemetry_max) + telemetry = Altos.ao_telemetry_standard; + telemetries.setSelectedIndex(telemetry - 1); + telemetries.setMaximumRowCount(Altos.ao_telemetry_max); + telemetries.setPreferredSize(null); + telemetries.revalidate(); telemetries.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - int telemetry = telemetries.get_selected(); + int telemetry = telemetries.getSelectedIndex() + 1; reader.set_telemetry(telemetry); reader.save_telemetry(); } }); - menu_bar.add(telemetries); + c.gridx = 1; + c.gridy = 0; + c.weightx = 0; + c.weighty = 0; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + bag.add (telemetries, c); + c.insets = new Insets(0, 0, 0, 0); } else { String version; @@ -240,7 +256,14 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { version = "Telemetry: None"; telemetry = new JLabel(version); - menu_bar.add(telemetry); + c.gridx = 1; + c.gridy = 0; + c.weightx = 0; + c.weighty = 0; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + bag.add (telemetry, c); + c.insets = new Insets(0, 0, 0, 0); } } diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java index 63d86291..67b7a989 100644 --- a/altosui/AltosIdleMonitorUI.java +++ b/altosui/AltosIdleMonitorUI.java @@ -103,7 +103,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl } Container bag; - AltosFreqList frequencies; + AltosUIFreqList frequencies; JTextField callsign_value; /* DocumentListener interface methods */ @@ -200,7 +200,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl /* Stick frequency selector at top of table for telemetry monitoring */ if (remote && serial >= 0) { // Frequency menu - frequencies = new AltosFreqList(AltosUIPreferences.frequency(serial)); + frequencies = new AltosUIFreqList(AltosUIPreferences.frequency(serial)); frequencies.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { double frequency = frequencies.frequency(); diff --git a/altosuilib/AltosFreqList.java b/altosuilib/AltosFreqList.java deleted file mode 100644 index 293ce032..00000000 --- a/altosuilib/AltosFreqList.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -package org.altusmetrum.altosuilib_3; - -import java.util.*; -import javax.swing.*; -import java.awt.event.*; -import org.altusmetrum.altoslib_5.*; - -class FreqEntry extends JMenuItem { - AltosFrequency frequency; - - public FreqEntry(AltosFrequency frequency) { - super(frequency.toShortString()); - this.frequency = frequency; - } -} - -public class AltosFreqList extends JMenu implements ActionListener { - - String product; - int serial; - int calibrate; - - AltosFrequency[] frequencies = new AltosFrequency[0]; - - int selected = -1; - - LinkedList action_listeners = new LinkedList(); - - public void addActionListener(ActionListener listener) { - action_listeners.add(listener); - } - - public void removeActionListener(ActionListener listener) { - action_listeners.remove(listener); - } - - public void actionPerformed(ActionEvent ev) { - FreqEntry e = (FreqEntry) ev.getSource(); - set_selected(e.frequency); - ActionEvent event = new ActionEvent(e.frequency, 0, "selected"); - for (ActionListener l : action_listeners) - l.actionPerformed(event); - } - - boolean label = true; - - public void set_label(boolean label) { - this.label = label; - set_label(); - } - - private void set_label() { - String new_text = ""; - if (0 <= selected && selected < frequencies.length) { - AltosFrequency frequency = frequencies[selected]; - new_text = String.format("%s%7.3f MHz (%s) ▾", - label ? "Frequency: " : "", - frequency.frequency, - frequency.description); - } - setText(new_text); - } - - private void set_selected(AltosFrequency frequency) { - for (int i = 0; i < frequencies.length; i++) { - if (frequencies[i].frequency == frequency.frequency) { - selected = i; - set_label(); - } - } - } - - private AltosFrequency get_selected() { - if (0 <= selected && selected < frequencies.length) - return frequencies[selected]; - return null; - } - - private void add(AltosFrequency add) { - int insert; - - for (insert = 0; insert < frequencies.length; insert++) { - if (frequencies[insert].frequency == add.frequency) - return; - if (add.frequency < frequencies[insert].frequency) - break; - } - - AltosFrequency[] new_frequencies = new AltosFrequency[frequencies.length + 1]; - - for (int before = 0; before < insert; before++) - new_frequencies[before] = frequencies[before]; - new_frequencies[insert] = add; - - for (int after = insert; after < frequencies.length; after++) - new_frequencies[after+1] = frequencies[after]; - - frequencies = new_frequencies; - - FreqEntry e = new FreqEntry(add); - add(e, insert); - e.addActionListener(this); - } - - private void remove(AltosFrequency remove) { - int delete; - for (delete = 0; delete < frequencies.length; delete++) { - if (frequencies[delete].frequency == remove.frequency) - break; - if (remove.frequency < frequencies[delete].frequency) - return; - } - - remove(delete); - - AltosFrequency[] new_frequencies = new AltosFrequency[frequencies.length - 1]; - - for (int before = 0; before < delete; before++) - new_frequencies[before] = frequencies[before]; - - for (int after = delete + 1; after < frequencies.length; after++) - new_frequencies[after-1] = frequencies[after]; - frequencies = new_frequencies; - } - - public void set_frequency(double new_frequency) { - int i; - - if (new_frequency < 0) { - setVisible(false); - return; - } - - for (i = 0; i < frequencies.length; i++) { - AltosFrequency f = frequencies[i]; - - if (f.close(new_frequency)) { - set_selected(f); - return; - } - } - - String description = String.format("%s serial %d", product, serial); - AltosFrequency frequency = new AltosFrequency(new_frequency, description); - AltosUIPreferences.add_common_frequency(frequency); - - add(frequency); - set_selected(frequency); - } - - public void set_product(String new_product) { - product = new_product; - } - - public void set_serial(int new_serial) { - serial = new_serial; - } - - public double frequency() { - AltosFrequency f = get_selected(); - if (f != null) - return f.frequency; - return 434.550; - } - - public AltosFreqList(double in_frequency, boolean label) { - super(); - this.label = label; - - for (AltosFrequency frequency: AltosUIPreferences.common_frequencies()) - add(frequency); - product = "Unknown"; - serial = 0; - - if (in_frequency != 0) - set_frequency(in_frequency); - } - public AltosFreqList(double in_frequency) { - this(in_frequency, true); - } - - public AltosFreqList (boolean label) { - this(0, label); - } - - public AltosFreqList () { - this(0, true); - } -} diff --git a/altosuilib/AltosUIFreqList.java b/altosuilib/AltosUIFreqList.java new file mode 100644 index 00000000..f1f83dd5 --- /dev/null +++ b/altosuilib/AltosUIFreqList.java @@ -0,0 +1,85 @@ +/* + * Copyright © 2011 Keith Packard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib_3; + +import javax.swing.*; +import org.altusmetrum.altoslib_5.*; + +public class AltosUIFreqList extends JComboBox { + + String product; + int serial; + int calibrate; + + public void set_frequency(double new_frequency) { + int i; + + if (new_frequency < 0) { + setVisible(false); + return; + } + + for (i = 0; i < getItemCount(); i++) { + AltosFrequency f = (AltosFrequency) getItemAt(i); + + if (f.close(new_frequency)) { + setSelectedIndex(i); + return; + } + } + for (i = 0; i < getItemCount(); i++) { + AltosFrequency f = (AltosFrequency) getItemAt(i); + + if (new_frequency < f.frequency) + break; + } + String description = String.format("%s serial %d", product, serial); + AltosFrequency frequency = new AltosFrequency(new_frequency, description); + AltosUIPreferences.add_common_frequency(frequency); + insertItemAt(frequency, i); + setMaximumRowCount(getItemCount()); + } + + public void set_product(String new_product) { + product = new_product; + } + + public void set_serial(int new_serial) { + serial = new_serial; + } + + public double frequency() { + AltosFrequency f = (AltosFrequency) getSelectedItem(); + if (f != null) + return f.frequency; + return 434.550; + } + + public AltosUIFreqList () { + super(AltosUIPreferences.common_frequencies()); + setMaximumRowCount(getItemCount()); + setEditable(false); + product = "Unknown"; + serial = 0; + } + + public AltosUIFreqList(double in_frequency) { + this(); + set_frequency(in_frequency); + } +} diff --git a/altosuilib/AltosUITelemetryList.java b/altosuilib/AltosUITelemetryList.java new file mode 100644 index 00000000..facfdcde --- /dev/null +++ b/altosuilib/AltosUITelemetryList.java @@ -0,0 +1,47 @@ +/* + * Copyright © 2014 Keith Packard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib_3; + +import java.util.*; +import javax.swing.*; +import org.altusmetrum.altoslib_5.*; + + +public class AltosUITelemetryList extends JComboBox { + public int get_selected() { + return getSelectedIndex() + 1; + } + + public void set_selected(int telemetry) { + setSelectedIndex(telemetry-1); + } + + public AltosUITelemetryList(int serial) { + super(); + for (int i = AltosLib.ao_telemetry_min; i <= AltosLib.ao_telemetry_max; i++) + addItem(AltosLib.telemetry_name(i)); + + int telemetry = AltosPreferences.telemetry(serial); + if (telemetry < AltosLib.ao_telemetry_min || AltosLib.ao_telemetry_max < telemetry) + telemetry = AltosLib.ao_telemetry_standard; + setMaximumRowCount(AltosLib.ao_telemetry_max); + set_selected(telemetry); + revalidate(); + } +} + diff --git a/altosuilib/AltosUITelemetryMenu.java b/altosuilib/AltosUITelemetryMenu.java deleted file mode 100644 index 893c3c44..00000000 --- a/altosuilib/AltosUITelemetryMenu.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright © 2014 Keith Packard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -package org.altusmetrum.altosuilib_3; - -import java.util.*; -import javax.swing.*; -import java.awt.event.*; -import org.altusmetrum.altoslib_5.*; - -class TelemetryMenuItem extends JMenuItem { - public int telemetry; - - public TelemetryMenuItem (int telemetry) { - super(AltosLib.telemetry_name(telemetry)); - this.telemetry = telemetry; - } -} - -public class AltosUITelemetryMenu extends JMenu implements ActionListener { - TelemetryMenuItem selected = null; - - public int get_selected() { - if (selected == null) - return AltosLib.ao_telemetry_off; - return selected.telemetry; - } - - public void set_selected(int telemetry) { - for (int i = 0; i < getItemCount(); i++) { - TelemetryMenuItem item = (TelemetryMenuItem) getItem(i); - if (item.telemetry == telemetry) { - selected = item; - String new_text = String.format("Format: %s ▾", AltosLib.telemetry_name(telemetry)); - setText(new_text); - break; - } - } - } - - private LinkedList action_listeners = new LinkedList(); - - public void addActionListener(ActionListener l) { - action_listeners.add(l); - } - - public void removeActionListener(ActionListener l) { - action_listeners.remove(l); - } - - public void actionPerformed(ActionEvent e) { - TelemetryMenuItem item = (TelemetryMenuItem) e.getSource(); - set_selected(item.telemetry); - ActionEvent my_e = new ActionEvent(selected, 0, "selected"); - for (ActionListener l : action_listeners) - l.actionPerformed(my_e); - } - - public AltosUITelemetryMenu(int serial) { - super(); - for (int i = AltosLib.ao_telemetry_min; i <= AltosLib.ao_telemetry_max; i++) { - TelemetryMenuItem item = new TelemetryMenuItem(i); - - item.addActionListener(this); - add(item); - } - - int telemetry = AltosPreferences.telemetry(serial); - if (telemetry < AltosLib.ao_telemetry_min || AltosLib.ao_telemetry_max < telemetry) - telemetry = AltosLib.ao_telemetry_standard; - set_selected(telemetry); - } -} - diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am index 56b01ec5..40e6dda5 100644 --- a/altosuilib/Makefile.am +++ b/altosuilib/Makefile.am @@ -36,7 +36,6 @@ altosuilib_JAVA = \ AltosVoice.java \ AltosDisplayThread.java \ AltosDeviceUIDialog.java \ - AltosFreqList.java \ AltosSerial.java \ AltosSerialInUseException.java \ AltosConfigFreqUI.java \ @@ -82,7 +81,8 @@ altosuilib_JAVA = \ AltosUIIndicator.java \ AltosUIUnitsIndicator.java \ AltosUIVoltageIndicator.java \ - AltosUITelemetryMenu.java \ + AltosUIFreqList.java \ + AltosUITelemetryList.java \ OSXAdapter.java JAR=altosuilib_$(ALTOSUILIB_VERSION).jar diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index e78c2124..7e5ff42a 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -58,7 +58,7 @@ public class TeleGPS JMenu file_menu; JMenu monitor_menu; JMenu device_menu; - AltosFreqList frequencies; + AltosUIFreqList frequencies; ActionListener frequency_listener; Container bag; @@ -351,18 +351,17 @@ public class TeleGPS frequencies.set_product("Monitor"); frequencies.set_serial(serial); frequencies.set_frequency(AltosUIPreferences.frequency(serial)); + frequencies.setEnabled(true); - menu_bar.add(frequencies); - menu_bar.repaint(); } void disable_frequency_menu() { - if (frequency_listener == null) - return; - frequencies.removeActionListener(frequency_listener); - menu_bar.remove(frequencies); - menu_bar.repaint(); - frequency_listener = null; + if (frequency_listener != null) { + frequencies.removeActionListener(frequency_listener); + frequencies.setEnabled(false); + frequency_listener = null; + } + } public void set_reader(AltosFlightReader reader, AltosDevice device) { @@ -457,7 +456,16 @@ public class TeleGPS file_menu = make_menu("File", file_menu_entries); monitor_menu = make_menu("Monitor", monitor_menu_entries); device_menu = make_menu("Device", device_menu_entries); - frequencies = new AltosFreqList(); + + frequencies = new AltosUIFreqList(); + frequencies.setEnabled(false); + c.gridx = 0; + c.gridy = 0; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + c.weightx = 0; + c.gridwidth = 1; + bag.add(frequencies, c); displays = new LinkedList(); diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index ee2fbd2d..e5ac6d7e 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -50,7 +50,7 @@ public class TeleGPSConfigUI JLabel product_value; JLabel version_value; JLabel serial_value; - AltosFreqList radio_frequency_value; + AltosUIFreqList radio_frequency_value; JTextField radio_calibration_value; JRadioButton radio_enable_value; JComboBox aprs_interval_value; @@ -270,13 +270,9 @@ public class TeleGPSConfigUI c.anchor = GridBagConstraints.LINE_START; c.insets = ir; c.ipady = 5; - radio_frequency_value = new AltosFreqList(); + radio_frequency_value = new AltosUIFreqList(); radio_frequency_value.addItemListener(this); - - JMenuBar menu_bar = new JMenuBar(); - menu_bar.add(radio_frequency_value); - - pane.add(menu_bar, c); + pane.add(radio_frequency_value, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); row++; -- cgit v1.2.3 From efb86669b5a74f244e2218f3385db633c36208af Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 4 Jul 2014 23:41:16 -0700 Subject: altosui: Support telemetry data rates Add combo box to flight UI and flight hardware configuration UIs Add telemetry rate to the TD/TBT config dialog Signed-off-by: Keith Packard --- altosui/AltosConfigTD.java | 25 +++++++++++++++- altosui/AltosConfigTDUI.java | 32 ++++++++++++++++++++ altosui/AltosConfigUI.java | 42 ++++++++++++++++++++++++++ altosui/AltosFlightUI.java | 46 ++++++++++++++++++----------- altosuilib/AltosUIRateList.java | 65 +++++++++++++++++++++++++++++++++++++++++ altosuilib/Makefile.am | 1 + 6 files changed, 193 insertions(+), 18 deletions(-) create mode 100644 altosuilib/AltosUIRateList.java (limited to 'altosui/AltosConfigUI.java') diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java index 2976657c..397ed3db 100644 --- a/altosui/AltosConfigTD.java +++ b/altosui/AltosConfigTD.java @@ -62,6 +62,7 @@ public class AltosConfigTD implements ActionListener { int_ref radio_calibration; int_ref radio_setting; int_ref radio_frequency; + int_ref telemetry_rate; string_ref config_version; string_ref version; string_ref product; @@ -105,6 +106,7 @@ public class AltosConfigTD implements ActionListener { config_ui.set_version(version.get()); config_ui.set_radio_frequency(frequency()); config_ui.set_radio_calibration(radio_calibration.get()); + config_ui.set_telemetry_rate(telemetry_rate.get()); config_ui.set_clean(); if (!made_visible) { made_visible = true; @@ -140,6 +142,7 @@ public class AltosConfigTD implements ActionListener { get_int(line, "Radio cal:", radio_calibration); get_int(line, "Frequency:", radio_frequency); get_int(line, "Radio setting:", radio_setting); + get_int(line, "Telemetry rate:", telemetry_rate); get_string(line,"software-version", version); get_string(line,"product", product); } @@ -151,6 +154,7 @@ public class AltosConfigTD implements ActionListener { radio_setting.set(0); radio_frequency.set(0); radio_calibration.set(1186611); + telemetry_rate.set(Altos.ao_telemetry_rate_38400); config_version.set("0.0"); version.set("unknown"); product.set("unknown"); @@ -178,6 +182,19 @@ public class AltosConfigTD implements ActionListener { } } + synchronized int telemetry_rate() { + System.out.printf("telemetry_rate: %d\n", telemetry_rate.get()); + return telemetry_rate.get(); + } + + synchronized void set_telemetry_rate(int new_telemetry_rate){ + int rate = telemetry_rate.get(); + + System.out.printf("set_telemetry_rate %d\n", new_telemetry_rate); + if (rate >= 0) + telemetry_rate.set(new_telemetry_rate); + } + final static int serial_mode_read = 0; final static int serial_mode_save = 1; final static int serial_mode_reboot = 2; @@ -218,6 +235,7 @@ public class AltosConfigTD implements ActionListener { * available firmware version might place on the actual frequency */ config.set_frequency(AltosPreferences.frequency(serial.get())); + config.set_telemetry_rate(AltosPreferences.telemetry_rate(serial.get())); config.process_line("all finished"); } @@ -226,6 +244,8 @@ public class AltosConfigTD implements ActionListener { if (frequency != 0) AltosPreferences.set_frequency(serial.get(), frequency); + AltosPreferences.set_telemetry_rate(serial.get(), + telemetry_rate()); } public void run () { @@ -279,6 +299,8 @@ public class AltosConfigTD implements ActionListener { void save_data() { double freq = config_ui.radio_frequency(); set_frequency(freq); + int telemetry_rate = config_ui.telemetry_rate(); + set_telemetry_rate(telemetry_rate); run_serial_thread(serial_mode_save); } @@ -311,6 +333,7 @@ public class AltosConfigTD implements ActionListener { radio_setting = new int_ref(0); radio_frequency = new int_ref(0); radio_calibration = new int_ref(1186611); + telemetry_rate = new int_ref(AltosLib.ao_telemetry_rate_38400); config_version = new string_ref("0.0"); version = new string_ref("unknown"); product = new string_ref("unknown"); @@ -340,4 +363,4 @@ public class AltosConfigTD implements ActionListener { } } } -} \ No newline at end of file +} diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java index 947d78ee..b677ad23 100644 --- a/altosui/AltosConfigTDUI.java +++ b/altosui/AltosConfigTDUI.java @@ -37,6 +37,7 @@ public class AltosConfigTDUI JLabel frequency_label; JLabel radio_calibration_label; JLabel radio_frequency_label; + JLabel rate_label; public boolean dirty; @@ -46,6 +47,7 @@ public class AltosConfigTDUI JLabel serial_value; AltosUIFreqList radio_frequency_value; JLabel radio_calibration_value; + AltosUIRateList rate_value; JButton save; JButton reset; @@ -192,6 +194,28 @@ public class AltosConfigTDUI radio_calibration_value = new JLabel(String.format("%d", 1186611)); pane.add(radio_calibration_value, c); + /* Telemetry Rate */ + c = new GridBagConstraints(); + c.gridx = 0; c.gridy = 7; + c.gridwidth = 4; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + c.ipady = 5; + rate_label = new JLabel("Telemetry Rate:"); + pane.add(rate_label, c); + + c = new GridBagConstraints(); + c.gridx = 4; c.gridy = 7; + c.gridwidth = 4; + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.anchor = GridBagConstraints.LINE_START; + c.insets = ir; + c.ipady = 5; + rate_value = new AltosUIRateList(); + pane.add(rate_value, c); + /* Buttons */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = 12; @@ -339,6 +363,14 @@ public class AltosConfigTDUI radio_calibration_value.setText(String.format("%d", calibration)); } + public int telemetry_rate() { + return rate_value.getSelectedIndex(); + } + + public void set_telemetry_rate(int rate) { + rate_value.setSelectedIndex(rate); + } + public void set_clean() { dirty = false; } diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 91c37fd5..e3a1a24f 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -40,6 +40,7 @@ public class AltosConfigUI JLabel radio_calibration_label; JLabel radio_frequency_label; JLabel radio_enable_label; + JLabel rate_label; JLabel aprs_interval_label; JLabel aprs_ssid_label; JLabel flight_log_max_label; @@ -62,6 +63,7 @@ public class AltosConfigUI AltosUIFreqList radio_frequency_value; JTextField radio_calibration_value; JRadioButton radio_enable_value; + AltosUIRateList rate_value; JComboBox aprs_interval_value; JComboBox aprs_ssid_value; JComboBox flight_log_max_value; @@ -200,6 +202,13 @@ public class AltosConfigUI radio_enable_value.setToolTipText("Firmware version does not support disabling radio"); } + void set_rate_tool_tip() { + if (rate_value.isEnabled()) + rate_value.setToolTipText("Select telemetry baud rate"); + else + rate_value.setToolTipText("Firmware version does not support variable telemetry rates"); + } + void set_aprs_interval_tool_tip() { if (aprs_interval_value.isEnabled()) aprs_interval_value.setToolTipText("Enable APRS and set the interval between APRS reports"); @@ -490,6 +499,31 @@ public class AltosConfigUI set_radio_enable_tool_tip(); row++; + /* Telemetry Rate */ + c = new GridBagConstraints(); + c.gridx = 0; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + c.ipady = 5; + rate_label = new JLabel("Telemetry baud rate:"); + pane.add(radio_enable_label, c); + + c = new GridBagConstraints(); + c.gridx = 4; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.anchor = GridBagConstraints.LINE_START; + c.insets = ir; + c.ipady = 5; + rate_value = new AltosUIRateList(); + rate_value.addItemListener(this); + pane.add(rate_value, c); + set_rate_tool_tip(); + row++; + /* APRS interval */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = row; @@ -1009,6 +1043,14 @@ public class AltosConfigUI return -1; } + public void set_telemetry_rate(int new_rate) { + rate_value.set_rate(new_rate); + } + + public int telemetry_rate() { + return rate_value.rate(); + } + public void set_callsign(String new_callsign) { callsign_value.setVisible(new_callsign != null); callsign_value.setText(new_callsign); diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index 5db0ee92..6af345ea 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -171,6 +171,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { Container bag; AltosUIFreqList frequencies; + AltosUIRateList rates; AltosUITelemetryList telemetries; JLabel telemetry; @@ -217,27 +218,40 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { c.anchor = GridBagConstraints.WEST; bag.add (frequencies, c); + // Telemetry rate list + rates = new AltosUIRateList(AltosUIPreferences.telemetry_rate(serial)); + rates.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + int rate = rates.rate(); + try { + reader.set_telemetry_rate(rate); + } catch (TimeoutException te) { + } catch (InterruptedException ie) { + } + reader.save_telemetry_rate(); + } + }); + rates.setEnabled(reader.supports_telemetry_rate(AltosLib.ao_telemetry_rate_2400)); + c.gridx = 1; + c.gridy = 0; + c.weightx = 0; + c.weighty = 0; + c.insets = new Insets(3, 3, 3, 3); + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + bag.add (rates, c); + // Telemetry format list if (reader.supports_telemetry(Altos.ao_telemetry_standard)) { - telemetries = new JComboBox(); - for (int i = 1; i <= Altos.ao_telemetry_max; i++) - telemetries.addItem(Altos.telemetry_name(i)); - int telemetry = AltosPreferences.telemetry(serial); - if (telemetry <= Altos.ao_telemetry_off || - telemetry > Altos.ao_telemetry_max) - telemetry = Altos.ao_telemetry_standard; - telemetries.setSelectedIndex(telemetry - 1); - telemetries.setMaximumRowCount(Altos.ao_telemetry_max); - telemetries.setPreferredSize(null); - telemetries.revalidate(); + telemetries = new AltosUITelemetryList(serial); telemetries.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - int telemetry = telemetries.getSelectedIndex() + 1; + int telemetry = telemetries.get_selected(); reader.set_telemetry(telemetry); reader.save_telemetry(); } }); - c.gridx = 1; + c.gridx = 2; c.gridy = 0; c.weightx = 0; c.weighty = 0; @@ -256,7 +270,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { version = "Telemetry: None"; telemetry = new JLabel(version); - c.gridx = 1; + c.gridx = 2; c.gridy = 0; c.weightx = 0; c.weighty = 0; @@ -274,9 +288,8 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { c.gridy = 1; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; - c.gridwidth = 2; + c.gridwidth = 3; bag.add(flightStatus, c); - c.gridwidth = 1; /* The rest of the window uses a tabbed pane to * show one of the alternate data views @@ -315,7 +328,6 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; - c.gridwidth = 2; bag.add(pane, c); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); diff --git a/altosuilib/AltosUIRateList.java b/altosuilib/AltosUIRateList.java new file mode 100644 index 00000000..2e0c65a2 --- /dev/null +++ b/altosuilib/AltosUIRateList.java @@ -0,0 +1,65 @@ +/* + * Copyright © 2011 Keith Packard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib_3; + +import javax.swing.*; +import org.altusmetrum.altoslib_5.*; + +public class AltosUIRateList extends JComboBox { + + String product; + int serial; + + public void set_rate(int new_rate) { + int i; + + if (new_rate < 0) { + setVisible(false); + return; + } + + setSelectedIndex(new_rate); + } + + public void set_product(String new_product) { + product = new_product; + } + + public void set_serial(int new_serial) { + serial = new_serial; + } + + public int rate() { + return getSelectedIndex(); + } + + public AltosUIRateList () { + super(); + for (int i = 0; i < AltosLib.ao_telemetry_rate_values.length; i++) + addItem(String.format("%d baud", AltosLib.ao_telemetry_rate_values[i])); + setMaximumRowCount(getItemCount()); + setEditable(false); + product = "Unknown"; + serial = 0; + } + + public AltosUIRateList(int in_rate) { + this(); + set_rate(in_rate); + } +} diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am index 40e6dda5..21ccd131 100644 --- a/altosuilib/Makefile.am +++ b/altosuilib/Makefile.am @@ -83,6 +83,7 @@ altosuilib_JAVA = \ AltosUIVoltageIndicator.java \ AltosUIFreqList.java \ AltosUITelemetryList.java \ + AltosUIRateList.java \ OSXAdapter.java JAR=altosuilib_$(ALTOSUILIB_VERSION).jar -- cgit v1.2.3 From 95f3a2825377bdb6737446df051c069d58f42d08 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 8 Jul 2014 23:43:31 -0700 Subject: altosui: Hide inactive altimeter configuration entries Instead of disabling them, just hide them so that entries that do not apply to a particular device won't get shown at all. Signed-off-by: Keith Packard --- altosui/AltosConfigTD.java | 2 -- altosui/AltosConfigUI.java | 63 ++++++++++++++++++++++++++++++----------- altosuilib/AltosUIFreqList.java | 1 + altosuilib/AltosUIRateList.java | 6 +--- 4 files changed, 48 insertions(+), 24 deletions(-) (limited to 'altosui/AltosConfigUI.java') diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java index 397ed3db..4389e49b 100644 --- a/altosui/AltosConfigTD.java +++ b/altosui/AltosConfigTD.java @@ -183,14 +183,12 @@ public class AltosConfigTD implements ActionListener { } synchronized int telemetry_rate() { - System.out.printf("telemetry_rate: %d\n", telemetry_rate.get()); return telemetry_rate.get(); } synchronized void set_telemetry_rate(int new_telemetry_rate){ int rate = telemetry_rate.get(); - System.out.printf("set_telemetry_rate %d\n", new_telemetry_rate); if (rate >= 0) telemetry_rate.set(new_telemetry_rate); } diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index e3a1a24f..043cb876 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -508,7 +508,7 @@ public class AltosConfigUI c.insets = il; c.ipady = 5; rate_label = new JLabel("Telemetry baud rate:"); - pane.add(radio_enable_label, c); + pane.add(rate_label, c); c = new GridBagConstraints(); c.gridx = 4; c.gridy = row; @@ -929,6 +929,10 @@ public class AltosConfigUI public void set_main_deploy(int new_main_deploy) { main_deploy_value.setSelectedItem(AltosConvert.height.say(new_main_deploy)); main_deploy_value.setEnabled(new_main_deploy >= 0); + + main_deploy_value.setVisible(new_main_deploy >= 0); + main_deploy_label.setVisible(new_main_deploy >= 0); + } public int main_deploy() { @@ -976,6 +980,9 @@ public class AltosConfigUI } public void set_apogee_delay(int new_apogee_delay) { + apogee_delay_value.setVisible(new_apogee_delay >= 0); + apogee_delay_label.setVisible(new_apogee_delay >= 0); + apogee_delay_value.setSelectedItem(Integer.toString(new_apogee_delay)); apogee_delay_value.setEnabled(new_apogee_delay >= 0); } @@ -998,6 +1005,9 @@ public class AltosConfigUI public void set_apogee_lockout(int new_apogee_lockout) { apogee_lockout_value.setSelectedItem(Integer.toString(new_apogee_lockout)); apogee_lockout_value.setEnabled(new_apogee_lockout >= 0); + + apogee_lockout_value.setVisible(new_apogee_lockout >= 0); + apogee_lockout_label.setVisible(new_apogee_lockout >= 0); } public int apogee_lockout() throws AltosConfigDataException { @@ -1005,6 +1015,7 @@ public class AltosConfigUI } public void set_radio_frequency(double new_radio_frequency) { + radio_frequency_label.setVisible(new_radio_frequency >= 0); radio_frequency_value.set_frequency(new_radio_frequency); } @@ -1014,6 +1025,8 @@ public class AltosConfigUI public void set_radio_calibration(int new_radio_calibration) { radio_calibration_value.setVisible(new_radio_calibration >= 0); + radio_calibration_label.setVisible(new_radio_calibration >= 0); + if (new_radio_calibration < 0) radio_calibration_value.setText("Disabled"); else @@ -1025,12 +1038,14 @@ public class AltosConfigUI } public void set_radio_enable(int new_radio_enable) { + radio_enable_label.setVisible(new_radio_enable >= 0); + radio_enable_value.setVisible(new_radio_enable >= 0); + if (new_radio_enable >= 0) { radio_enable_value.setSelected(new_radio_enable > 0); radio_enable_value.setEnabled(true); } else { radio_enable_value.setSelected(true); - radio_enable_value.setVisible(radio_frequency() > 0); radio_enable_value.setEnabled(false); } set_radio_enable_tool_tip(); @@ -1044,6 +1059,8 @@ public class AltosConfigUI } public void set_telemetry_rate(int new_rate) { + rate_label.setVisible(new_rate >= 0); + rate_value.set_rate(new_rate); } @@ -1053,6 +1070,8 @@ public class AltosConfigUI public void set_callsign(String new_callsign) { callsign_value.setVisible(new_callsign != null); + callsign_label.setVisible(new_callsign != null); + callsign_value.setText(new_callsign); } @@ -1074,6 +1093,9 @@ public class AltosConfigUI } public void set_flight_log_max(int new_flight_log_max) { + flight_log_max_value.setVisible(new_flight_log_max >= 0); + flight_log_max_label.setVisible(new_flight_log_max >= 0); + flight_log_max_value.setSelectedItem(flight_log_max_label(new_flight_log_max)); flight_log_max = new_flight_log_max; set_flight_log_max_tool_tip(); @@ -1100,6 +1122,9 @@ public class AltosConfigUI } public void set_ignite_mode(int new_ignite_mode) { + ignite_mode_value.setVisible(new_ignite_mode >= 0); + ignite_mode_label.setVisible(new_ignite_mode >= 0); + if (new_ignite_mode >= ignite_mode_values.length) new_ignite_mode = 0; if (new_ignite_mode < 0) { @@ -1121,14 +1146,13 @@ public class AltosConfigUI public void set_pad_orientation(int new_pad_orientation) { + pad_orientation_value.setVisible(new_pad_orientation >= 0); + pad_orientation_label.setVisible(new_pad_orientation >= 0); + if (new_pad_orientation >= pad_orientation_values.length) new_pad_orientation = 0; - if (new_pad_orientation < 0) { - pad_orientation_value.setVisible(false); + if (new_pad_orientation < 0) new_pad_orientation = 0; - } else { - pad_orientation_value.setVisible(true); - } pad_orientation_value.setSelectedIndex(new_pad_orientation); set_pad_orientation_tool_tip(); } @@ -1141,6 +1165,9 @@ public class AltosConfigUI } 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]))) { @@ -1192,13 +1219,12 @@ public class AltosConfigUI } 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_label.setVisible(false); - tracker_motion_value.setVisible(false); tracker_motion_value.setEnabled(false); } else { - tracker_motion_label.setVisible(true); - tracker_motion_value.setVisible(true); tracker_motion_value.setEnabled(true); tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion)); } @@ -1209,13 +1235,12 @@ public class AltosConfigUI } 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_label.setVisible(false); - tracker_interval_value.setVisible(false); tracker_interval_value.setEnabled(false); } else { - tracker_interval_label.setVisible(true); - tracker_interval_value.setVisible(true); tracker_interval_value.setEnabled(true); tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval)); } @@ -1252,6 +1277,9 @@ public class AltosConfigUI } 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) @@ -1259,7 +1287,6 @@ public class AltosConfigUI 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(); } @@ -1272,8 +1299,10 @@ public class AltosConfigUI } public void set_aprs_ssid(int new_aprs_ssid) { - aprs_ssid_value.setSelectedItem(Math.max(0,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(); } diff --git a/altosuilib/AltosUIFreqList.java b/altosuilib/AltosUIFreqList.java index f1f83dd5..84e6dce4 100644 --- a/altosuilib/AltosUIFreqList.java +++ b/altosuilib/AltosUIFreqList.java @@ -53,6 +53,7 @@ public class AltosUIFreqList extends JComboBox { AltosUIPreferences.add_common_frequency(frequency); insertItemAt(frequency, i); setMaximumRowCount(getItemCount()); + setVisible(true); } public void set_product(String new_product) { diff --git a/altosuilib/AltosUIRateList.java b/altosuilib/AltosUIRateList.java index 2e0c65a2..ee35ce6d 100644 --- a/altosuilib/AltosUIRateList.java +++ b/altosuilib/AltosUIRateList.java @@ -28,11 +28,7 @@ public class AltosUIRateList extends JComboBox { public void set_rate(int new_rate) { int i; - if (new_rate < 0) { - setVisible(false); - return; - } - + setVisible(new_rate >= 0); setSelectedIndex(new_rate); } -- cgit v1.2.3 From 59702e5ff8d0522b0aa9dcca863309eaafbcda09 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 17:27:43 -0700 Subject: altoslib: Extend telemetry heights from 16 to 32 bits Uses the GPS data and/or previous kalman data to compute the upper 16 bits of the truncated telemetry altitude value. Signed-off-by: Keith Packard --- altoslib/AltosConfigData.java | 3 +++ altoslib/AltosConfigValues.java | 2 ++ altoslib/AltosState.java | 28 ++++++++++++++++++++++++---- altoslib/AltosTelemetry.java | 29 +++++++++++++++++++++++++++++ altoslib/AltosTelemetryMegaData.java | 13 ++++++++++--- altoslib/AltosTelemetryMetrumSensor.java | 7 ++++--- altosui/AltosConfigUI.java | 3 +++ 7 files changed, 75 insertions(+), 10 deletions(-) (limited to 'altosui/AltosConfigUI.java') diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index 847436cd..134a0ed2 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -31,6 +31,7 @@ public class AltosConfigData implements Iterable { public int log_format; public int log_space; public String version; + public int altitude_32; /* Strings returned */ public LinkedList lines; @@ -274,6 +275,7 @@ public class AltosConfigData implements Iterable { try { flight = get_int(line, "current-flight"); } catch (Exception e) {} try { log_format = get_int(line, "log-format"); } catch (Exception e) {} try { log_space = get_int(line, "log-space"); } catch (Exception e) {} + try { altitude_32 = get_int(line, "altitude-32"); } catch (Exception e) {} try { version = get_string(line, "software-version"); } catch (Exception e) {} /* Version also contains MS5607 info, which we ignore here */ @@ -484,6 +486,7 @@ public class AltosConfigData implements Iterable { dest.set_serial(serial); dest.set_product(product); dest.set_version(version); + dest.set_altitude_32(altitude_32); dest.set_main_deploy(main_deploy); dest.set_apogee_delay(apogee_delay); dest.set_apogee_lockout(apogee_lockout); diff --git a/altoslib/AltosConfigValues.java b/altoslib/AltosConfigValues.java index 987da53b..3f0a7075 100644 --- a/altoslib/AltosConfigValues.java +++ b/altoslib/AltosConfigValues.java @@ -25,6 +25,8 @@ public interface AltosConfigValues { public abstract void set_serial(int serial); + public abstract void set_altitude_32(int altitude_32); + public abstract void set_main_deploy(int new_main_deploy); public abstract int main_deploy() throws AltosConfigDataException; diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java index 2fc13b44..5fce15c4 100644 --- a/altoslib/AltosState.java +++ b/altoslib/AltosState.java @@ -271,6 +271,7 @@ public class AltosState implements Cloneable { public int state; public int flight; public int serial; + public int altitude_32; public int receiver_serial; public boolean landed; public boolean ascent; /* going up? */ @@ -472,15 +473,23 @@ public class AltosState implements Cloneable { pressure.set(p, time); } + public double baro_height() { + double a = altitude(); + double g = ground_altitude(); + if (a != AltosLib.MISSING && g != AltosLib.MISSING) + return a - g; + return AltosLib.MISSING; + } + public double height() { double k = kalman_height.value(); if (k != AltosLib.MISSING) return k; - double a = altitude(); - double g = ground_altitude(); - if (a != AltosLib.MISSING && g != AltosLib.MISSING) - return a - g; + double b = baro_height(); + if (b != AltosLib.MISSING) + return b; + return gps_height(); } @@ -762,6 +771,7 @@ public class AltosState implements Cloneable { product = null; serial = AltosLib.MISSING; receiver_serial = AltosLib.MISSING; + altitude_32 = AltosLib.MISSING; baro = null; companion = null; @@ -899,6 +909,7 @@ public class AltosState implements Cloneable { product = old.product; serial = old.serial; receiver_serial = old.receiver_serial; + altitude_32 = old.altitude_32; baro = old.baro; companion = old.companion; @@ -1066,6 +1077,15 @@ public class AltosState implements Cloneable { receiver_serial = serial; } + public boolean altitude_32() { + return altitude_32 == 1; + } + + public void set_altitude_32(int altitude_32) { + if (altitude_32 != AltosLib.MISSING) + this.altitude_32 = altitude_32; + } + public int rssi() { if (rssi == AltosLib.MISSING) return 0; diff --git a/altoslib/AltosTelemetry.java b/altoslib/AltosTelemetry.java index 4d50a059..2f15cd89 100644 --- a/altoslib/AltosTelemetry.java +++ b/altoslib/AltosTelemetry.java @@ -114,6 +114,35 @@ public abstract class AltosTelemetry implements AltosStateUpdate { return telem; } + public static int extend_height(AltosState state, int height_16) { + double compare_height; + int height = height_16; + + System.out.printf("state kalman height %g altitude %g ground_altitude %g gps_height %g\n", + state.kalman_height.value(), state.altitude(), state.ground_altitude(), state.gps_height()); + if (state.gps != null && state.gps.alt != AltosLib.MISSING) { + compare_height = state.gps_height(); + } else { + compare_height = state.height(); + } + + if (compare_height != AltosLib.MISSING) { + int high_bits = (int) Math.floor (compare_height / 65536.0); + + height = (high_bits << 16) | (height_16 & 0xffff); + + if (Math.abs(height + 65536 - compare_height) < Math.abs(height - compare_height)) + height += 65536; + else if (Math.abs(height - 65536 - compare_height) < Math.abs(height - compare_height)) + height -= 65536; + if (height != height_16) { + System.out.printf("Height adjusted from %d to %d with %g\n", + height_16, height, compare_height); + } + } + return height; + } + public static AltosTelemetry parse(String line) throws ParseException, AltosCRCException { String[] word = line.split("\\s+"); int i =0; diff --git a/altoslib/AltosTelemetryMegaData.java b/altoslib/AltosTelemetryMegaData.java index 93610118..8b1869bb 100644 --- a/altoslib/AltosTelemetryMegaData.java +++ b/altoslib/AltosTelemetryMegaData.java @@ -31,7 +31,7 @@ public class AltosTelemetryMegaData extends AltosTelemetryStandard { int acceleration; int speed; - int height; + int height_16; public AltosTelemetryMegaData(int[] bytes) { super(bytes); @@ -55,7 +55,8 @@ public class AltosTelemetryMegaData extends AltosTelemetryStandard { acceleration = int16(26); speed = int16(28); - height = int16(30); + + height_16 = int16(30); } public void update_state(AltosState state) { @@ -79,7 +80,13 @@ public class AltosTelemetryMegaData extends AltosTelemetryStandard { state.set_ground_pressure(ground_pres); state.set_accel_g(accel_plus_g, accel_minus_g); - state.set_kalman(height, speed/16.0, acceleration / 16.0); + /* Fill in the high bits of height from recent GPS + * data if available, otherwise guess using the + * previous kalman height + */ + + state.set_kalman(extend_height(state, height_16), + speed/16.0, acceleration / 16.0); } } diff --git a/altoslib/AltosTelemetryMetrumSensor.java b/altoslib/AltosTelemetryMetrumSensor.java index 3e0abedc..beab6da9 100644 --- a/altoslib/AltosTelemetryMetrumSensor.java +++ b/altoslib/AltosTelemetryMetrumSensor.java @@ -27,7 +27,7 @@ public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard { int acceleration; int speed; - int height; + int height_16; int v_batt; int sense_a; @@ -43,7 +43,7 @@ public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard { acceleration = int16(14); speed = int16(16); - height = int16(18); + height_16 = int16(18); v_batt = int16(20); sense_a = int16(22); @@ -59,7 +59,8 @@ public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard { state.set_pressure(pres); state.set_temperature(temp/100.0); - state.set_kalman(height, speed/16.0, acceleration/16.0); + state.set_kalman(extend_height(state, height_16), + speed/16.0, acceleration/16.0); state.set_battery_voltage(AltosConvert.mega_battery_voltage(v_batt)); diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 043cb876..9fcace61 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -926,6 +926,9 @@ public class AltosConfigUI serial_value.setText(String.format("%d", serial)); } + public void set_altitude_32(int altitude_32) { + } + public void set_main_deploy(int new_main_deploy) { main_deploy_value.setSelectedItem(AltosConvert.height.say(new_main_deploy)); main_deploy_value.setEnabled(new_main_deploy >= 0); -- cgit v1.2.3