From 067b21993e9a97fceadb355e571e5610535336a8 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 27 Mar 2011 00:13:38 -0700 Subject: [PATCH] altosui: Allow radio channel to be configured over the radio link 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 --- altosui/AltosConfig.java | 13 ++++++++++--- altosui/AltosConfigUI.java | 2 -- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/altosui/AltosConfig.java b/altosui/AltosConfig.java index 854d5384..f45e2040 100644 --- a/altosui/AltosConfig.java +++ b/altosui/AltosConfig.java @@ -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()); diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index e09eab25..f835ee2e 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -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 */ -- 2.30.2