diff options
author | Keith Packard <keithp@keithp.com> | 2014-07-02 22:48:13 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-07-05 00:38:10 -0700 |
commit | 55e6558fa7cb23fb1363a86c83fbd6abf67ea324 (patch) | |
tree | 45f14786b0c165bdb6d7249f70bf0626aad4a500 /altoslib/AltosLink.java | |
parent | 292cb8380b478542555b5f370e8252eafa2f74ac (diff) |
altoslib: Support multiple telemetry rates
Altos now supports 2400 and 9600 baud in addition to the classic 38400
baud rate. Add support to altoslib for these as well
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosLink.java')
-rw-r--r-- | altoslib/AltosLink.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/altoslib/AltosLink.java b/altoslib/AltosLink.java index ef40c8cb..eadab5df 100644 --- a/altoslib/AltosLink.java +++ b/altoslib/AltosLink.java @@ -274,6 +274,8 @@ public abstract class AltosLink implements Runnable { } public void flush_output() { + if (pending_output == null) + return; for (String s : pending_output) System.out.print(s); pending_output.clear(); @@ -305,6 +307,7 @@ public abstract class AltosLink implements Runnable { */ public boolean monitor_mode = false; public int telemetry = AltosLib.ao_telemetry_standard; + public int telemetry_rate = AltosLib.ao_telemetry_rate_38400; public double frequency; public String callsign; AltosConfigData config_data; @@ -356,6 +359,15 @@ public abstract class AltosLink implements Runnable { flush_output(); } + public void set_telemetry_rate(int in_telemetry_rate) { + telemetry_rate = in_telemetry_rate; + if (monitor_mode) + printf("m 0\nc T %d\nm %x\n", telemetry_rate, telemetry_len()); + else + printf("c T %d\n", telemetry_rate); + flush_output(); + } + public void set_monitor(boolean monitor) { monitor_mode = monitor; if (monitor) @@ -383,7 +395,7 @@ public abstract class AltosLink implements Runnable { flush_output(); } - public AltosConfigData config_data() throws InterruptedException, TimeoutException { + public AltosConfigData config_data() throws InterruptedException, TimeoutException { synchronized(config_data_lock) { if (config_data == null) { printf("m 0\n"); |