summaryrefslogtreecommitdiff
path: root/altoslib/AltosConfigData.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-09-06 20:41:58 -0700
committerKeith Packard <keithp@keithp.com>2014-09-06 20:41:58 -0700
commit46f08f8709c538f3fee8e166598f0bb930df6e3c (patch)
tree1829a5a82dc08e0f3941eb204e87f5c4a7a345b2 /altoslib/AltosConfigData.java
parentf395bcaa620490954d4a42de9b4870bc12bedc91 (diff)
altoslib: Update local callsign/baud rate when using remote protocol
We've had code to synchronously update the local and remote radio frequencies when doing configuration over the remote link. This patch adds the same code when changing the call sign and baud rate. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosConfigData.java')
-rw-r--r--altoslib/AltosConfigData.java31
1 files changed, 27 insertions, 4 deletions
diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java
index fd38635c..4ada1d3b 100644
--- a/altoslib/AltosConfigData.java
+++ b/altoslib/AltosConfigData.java
@@ -386,6 +386,10 @@ public class AltosConfigData implements Iterable<String> {
return radio_frequency >= 0 || radio_setting >= 0 || radio_channel >= 0;
}
+ public boolean has_telemetry_rate() {
+ return telemetry_rate >= 0;
+ }
+
public void set_frequency(double freq) {
int frequency = radio_frequency;
int setting = radio_setting;
@@ -558,20 +562,39 @@ public class AltosConfigData implements Iterable<String> {
radio_calibration);
/* When remote, reset the dongle frequency at the same time */
if (remote) {
+ link.flush_output();
link.stop_remote();
link.set_radio_frequency(frequency);
+ link.flush_output();
link.start_remote();
}
}
- if (callsign != null)
+ if (telemetry_rate >= 0) {
+ link.printf("c T %d\n", telemetry_rate);
+ if (remote) {
+ link.flush_output();
+ link.stop_remote();
+ link.set_telemetry_rate(telemetry_rate);
+ link.flush_output();
+ link.start_remote();
+ }
+ }
+
+ if (callsign != null) {
link.printf("c c %s\n", callsign);
+ if (remote) {
+ link.flush_output();
+ link.stop_remote();
+ link.set_callsign(callsign);
+ link.flush_output();
+ link.start_remote();
+ }
+ }
+
if (radio_enable >= 0)
link.printf("c e %d\n", radio_enable);
- if (telemetry_rate >= 0)
- link.printf("c T %d\n", telemetry_rate);
-
/* HAS_ACCEL */
/* UI doesn't support accel cal */
if (pad_orientation >= 0)