altosui: Allow radio channel to be configured over the radio link
authorKeith Packard <keithp@keithp.com>
Sun, 27 Mar 2011 07:13:38 +0000 (00:13 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 27 Mar 2011 07:13:38 +0000 (00:13 -0700)
TeleMini/TeleNano can't be configured via USB, so we need to allow
the radio channel to be set over the radio link.

This change carefully sets the new radio channel, disables the remote
link and then sets the teledongle channel to the new value and brings
the link back up.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosConfig.java
altosui/AltosConfigUI.java

index 854d5384620e34e0655188d002aa9a27704678e8..f45e20408c7501b604f0b6d67e829ea66772b9c6 100644 (file)
@@ -207,13 +207,20 @@ public class AltosConfig implements ActionListener {
 
                void save_data() {
                        try {
+                               int     channel;
                                start_serial();
                                serial_line.printf("c m %d\n", main_deploy.get());
                                serial_line.printf("c d %d\n", apogee_delay.get());
-                               if (!remote) {
-                                       serial_line.printf("c r %d\n", radio_channel.get());
-                                       serial_line.printf("c f %d\n", radio_calibration.get());
+                               channel = radio_channel.get();
+                               serial_line.printf("c r %d\n", channel);
+                               if (remote) {
+                                       serial_line.stop_remote();
+                                       serial_line.set_channel(channel);
+                                       AltosPreferences.set_channel(device.getSerial(), channel);
+                                       serial_line.start_remote();
                                }
+                               if (!remote)
+                                       serial_line.printf("c f %d\n", radio_calibration.get());
                                serial_line.printf("c c %s\n", callsign.get());
                                if (flight_log_max.get() != 0)
                                        serial_line.printf("c l %d\n", flight_log_max.get());
index e09eab25dc65b9835dda10a656742f3d9ad84371..f835ee2e86d4df46a4055894031202374ccc6acf 100644 (file)
@@ -252,8 +252,6 @@ public class AltosConfigUI
                radio_channel_value = new JComboBox(radio_channel_values);
                radio_channel_value.setEditable(false);
                radio_channel_value.addItemListener(this);
-               if (remote)
-                       radio_channel_value.setEnabled(false);
                pane.add(radio_channel_value, c);
 
                /* Radio Calibration */