X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosConfigTDUI.java;h=529c2fa20ac1e74619145dcd2ae0ca33e03efd09;hp=f653d94196eb120a68a7012d408cb21d387f408a;hb=4fdf8ca9ca1cd5a84b03bd7a03c5806af64b413d;hpb=708e7937cba52982b91244cf89bfbff46d346135 diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java index f653d941..529c2fa2 100644 --- a/altosui/AltosConfigTDUI.java +++ b/altosui/AltosConfigTDUI.java @@ -3,7 +3,8 @@ * * 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. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,26 +16,17 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package AltosUI; +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_11.*; +import org.altusmetrum.altosuilib_11.*; public class AltosConfigTDUI - extends AltosDialog + extends AltosUIDialog implements ActionListener, ItemListener, DocumentListener { @@ -46,6 +38,7 @@ public class AltosConfigTDUI JLabel frequency_label; JLabel radio_calibration_label; JLabel radio_frequency_label; + JLabel rate_label; public boolean dirty; @@ -53,8 +46,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 +57,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 +168,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 +195,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 +335,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 +343,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 +364,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; }