summaryrefslogtreecommitdiff
path: root/altosui/AltosSerial.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-03-24 08:08:43 +0900
committerKeith Packard <keithp@keithp.com>2011-03-24 08:08:43 +0900
commit7f5b5848ad6ef5c808638a29c3dc0101b56ed11e (patch)
treec85d6936a17ee4533cc8b41e29e59acd1e93d47c /altosui/AltosSerial.java
parentf3e68341f6f5daaf26dd162e4f9a06c29988986a (diff)
altosui: Add telemetry format menu and preferences
Switches the TeleDongle between full and tiny telemetry packet formats, saving the last used format for each teledongle in the application preferences. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosSerial.java')
-rw-r--r--altosui/AltosSerial.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java
index f9f9e6e4..a8ba66bd 100644
--- a/altosui/AltosSerial.java
+++ b/altosui/AltosSerial.java
@@ -47,6 +47,8 @@ public class AltosSerial implements Runnable {
byte[] line_bytes;
int line_count;
boolean monitor_mode;
+ int telemetry;
+ int channel;
static boolean debug;
boolean remote;
LinkedList<String> pending_output = new LinkedList<String>();
@@ -231,25 +233,37 @@ public class AltosSerial implements Runnable {
}
public void set_radio() {
- set_channel(AltosPreferences.channel(device.getSerial()));
+ telemetry = AltosPreferences.telemetry(device.getSerial());
+ channel = AltosPreferences.channel(device.getSerial());
+ set_channel(channel);
set_callsign(AltosPreferences.callsign());
}
- public void set_channel(int channel) {
+ public void set_channel(int in_channel) {
+ channel = in_channel;
if (altos != null) {
if (monitor_mode)
- printf("m 0\nc r %d\nm 1\n", channel);
+ printf("m 0\nc r %d\nm %d\n", channel, telemetry);
else
printf("c r %d\n", channel);
flush_output();
}
}
+ public void set_telemetry(int in_telemetry) {
+ telemetry = in_telemetry;
+ if (altos != null) {
+ if (monitor_mode)
+ printf("m 0\nm %d\n", telemetry);
+ flush_output();
+ }
+ }
+
void set_monitor(boolean monitor) {
monitor_mode = monitor;
if (altos != null) {
if (monitor)
- printf("m 1\n");
+ printf("m %d\n", telemetry);
else
printf("m 0\n");
flush_output();
@@ -285,6 +299,7 @@ public class AltosSerial implements Runnable {
device = in_device;
line = "";
monitor_mode = false;
+ telemetry = Altos.ao_telemetry_full;
monitors = new LinkedList<LinkedBlockingQueue<AltosLine>> ();
reply_queue = new LinkedBlockingQueue<AltosLine> ();
open();