From: Keith Packard Date: Sat, 13 Nov 2010 01:02:22 +0000 (-0800) Subject: altosui: Add RF calibration to TeleMetrum config dialog X-Git-Tag: debian/0.7.1+70+g9ffc2eb~18 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=a6f30fae906bd87dff192c5fd4d10df283f99930 altosui: Add RF calibration to TeleMetrum config dialog I think that's the last user-settable value. Signed-off-by: Keith Packard --- diff --git a/ao-tools/altosui/AltosConfig.java b/ao-tools/altosui/AltosConfig.java index 7fecff0e..b7474f3b 100644 --- a/ao-tools/altosui/AltosConfig.java +++ b/ao-tools/altosui/AltosConfig.java @@ -83,6 +83,7 @@ public class AltosConfig implements Runnable, ActionListener { int_ref main_deploy; int_ref apogee_delay; int_ref radio_channel; + int_ref radio_calibration; string_ref version; string_ref product; string_ref callsign; @@ -146,6 +147,7 @@ public class AltosConfig implements Runnable, ActionListener { get_int(line, "Main deploy:", main_deploy); get_int(line, "Apogee delay:", apogee_delay); get_int(line, "Radio channel:", radio_channel); + get_int(line, "Radio cal:", radio_calibration); get_string(line, "Callsign:", callsign); get_string(line,"software-version", version); get_string(line,"product", product); @@ -175,6 +177,7 @@ public class AltosConfig implements Runnable, ActionListener { config_ui.set_main_deploy(main_deploy.get()); config_ui.set_apogee_delay(apogee_delay.get()); config_ui.set_radio_channel(radio_channel.get()); + config_ui.set_radio_calibration(radio_calibration.get()); config_ui.set_callsign(callsign.get()); config_ui.set_clean(); } catch (InterruptedException ie) { @@ -188,12 +191,14 @@ public class AltosConfig implements Runnable, ActionListener { main_deploy.set(config_ui.main_deploy()); apogee_delay.set(config_ui.apogee_delay()); radio_channel.set(config_ui.radio_channel()); + radio_calibration.set(config_ui.radio_calibration()); callsign.set(config_ui.callsign()); try { start_serial(); serial_line.printf("c m %d\n", main_deploy.get()); serial_line.printf("c d %d\n", apogee_delay.get()); serial_line.printf("c r %d\n", radio_channel.get()); + serial_line.printf("c f %d\n", radio_calibration.get()); serial_line.printf("c c %s\n", callsign.get()); serial_line.printf("c w\n"); } catch (InterruptedException ie) { @@ -234,6 +239,7 @@ public class AltosConfig implements Runnable, ActionListener { main_deploy = new int_ref(250); apogee_delay = new int_ref(0); radio_channel = new int_ref(0); + radio_calibration = new int_ref(1186611); callsign = new string_ref("N0CALL"); version = new string_ref("unknown"); product = new string_ref("unknown"); diff --git a/ao-tools/altosui/AltosConfigUI.java b/ao-tools/altosui/AltosConfigUI.java index 605ccc8b..37128573 100644 --- a/ao-tools/altosui/AltosConfigUI.java +++ b/ao-tools/altosui/AltosConfigUI.java @@ -57,6 +57,7 @@ public class AltosConfigUI JLabel main_deploy_label; JLabel apogee_delay_label; JLabel radio_channel_label; + JLabel radio_calibration_label; JLabel callsign_label; public boolean dirty; @@ -68,6 +69,7 @@ public class AltosConfigUI JComboBox main_deploy_value; JComboBox apogee_delay_value; JComboBox radio_channel_value; + JTextField radio_calibration_value; JTextField callsign_value; JButton save; @@ -256,7 +258,7 @@ public class AltosConfigUI radio_channel_value.addItemListener(this); pane.add(radio_channel_value, c); - /* Callsign */ + /* Radio Calibration */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = 6; c.gridwidth = 3; @@ -264,11 +266,34 @@ public class AltosConfigUI c.anchor = GridBagConstraints.LINE_START; c.insets = il; c.ipady = 5; + radio_calibration_label = new JLabel("RF Calibration:"); + pane.add(radio_calibration_label, c); + + c = new GridBagConstraints(); + c.gridx = 3; c.gridy = 6; + c.gridwidth = 3; + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.anchor = GridBagConstraints.LINE_START; + c.insets = ir; + c.ipady = 5; + radio_calibration_value = new JTextField(String.format("%d", 1186611)); + radio_calibration_value.getDocument().addDocumentListener(this); + pane.add(radio_calibration_value, c); + + /* Callsign */ + c = new GridBagConstraints(); + c.gridx = 0; c.gridy = 7; + c.gridwidth = 3; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + c.ipady = 5; callsign_label = new JLabel("Callsign:"); pane.add(callsign_label, c); c = new GridBagConstraints(); - c.gridx = 3; c.gridy = 6; + c.gridx = 3; c.gridy = 7; c.gridwidth = 3; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; @@ -281,7 +306,7 @@ public class AltosConfigUI /* Buttons */ c = new GridBagConstraints(); - c.gridx = 0; c.gridy = 7; + c.gridx = 0; c.gridy = 8; c.gridwidth = 6; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; @@ -292,7 +317,7 @@ public class AltosConfigUI save.setActionCommand("save"); c = new GridBagConstraints(); - c.gridx = 0; c.gridy = 7; + c.gridx = 0; c.gridy = 8; c.gridwidth = 6; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.CENTER; @@ -303,7 +328,7 @@ public class AltosConfigUI reset.setActionCommand("reset"); c = new GridBagConstraints(); - c.gridx = 0; c.gridy = 7; + c.gridx = 0; c.gridy = 8; c.gridwidth = 6; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_END; @@ -415,6 +440,14 @@ public class AltosConfigUI return radio_channel_value.getSelectedIndex(); } + public void set_radio_calibration(int new_radio_calibration) { + radio_calibration_value.setText(String.format("%d", new_radio_calibration)); + } + + public int radio_calibration() { + return Integer.parseInt(radio_calibration_value.getText()); + } + public void set_callsign(String new_callsign) { callsign_value.setText(new_callsign); }