X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosConfigTDUI.java;h=b677ad2388de472cbe0d4bae76279d7cccb8e435;hp=f2058f6968881808ee11b3bad391c2c9481bb31e;hb=629b29b2718c174be9c811f224d0acf73fba4aff;hpb=95268d681c9a6652d84db383f55a4fe8a4ac5173 diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java index f2058f69..b677ad23 100644 --- a/altosui/AltosConfigTDUI.java +++ b/altosui/AltosConfigTDUI.java @@ -20,21 +20,12 @@ package altosui; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; import javax.swing.event.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; - -import libaltosJNI.*; - -import org.altusmetrum.AltosLib.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosConfigTDUI - extends AltosDialog + extends AltosUIDialog implements ActionListener, ItemListener, DocumentListener { @@ -46,6 +37,7 @@ public class AltosConfigTDUI JLabel frequency_label; JLabel radio_calibration_label; JLabel radio_frequency_label; + JLabel rate_label; public boolean dirty; @@ -53,8 +45,9 @@ public class AltosConfigTDUI JLabel product_value; JLabel version_value; JLabel serial_value; - AltosFreqList radio_frequency_value; + AltosUIFreqList radio_frequency_value; JLabel radio_calibration_value; + AltosUIRateList rate_value; JButton save; JButton reset; @@ -63,7 +56,6 @@ public class AltosConfigTDUI ActionListener listener; - /* A window listener to catch closing events and tell the config code */ class ConfigListener extends WindowAdapter { AltosConfigTDUI ui; @@ -175,7 +167,7 @@ public class AltosConfigTDUI 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); pane.add(radio_frequency_value, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); @@ -202,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; @@ -320,7 +334,7 @@ public class AltosConfigTDUI 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; @@ -328,7 +342,7 @@ public class AltosConfigTDUI } for (i = 0; i < radio_frequency_value.getItemCount(); i++) { AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i); - + if (new_radio_frequency < f.frequency) break; } @@ -349,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; }