summaryrefslogtreecommitdiff
path: root/ao-tools
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-23 19:08:07 -0800
committerKeith Packard <keithp@keithp.com>2010-11-23 19:10:27 -0800
commit6cd9be22f06f21d12ee2f668989d83d3c61d14c0 (patch)
treee382abd414c9c50bc6efadee2fd8308a46e01157 /ao-tools
parented7cf7d262fcf7c0c677c2fb981582b571de9e5e (diff)
altosui: New AltosSerial.set_radio function sets channel/call
Use this anytime you need to set the device radio channel and call sign, either for telemetry reception or packet mode origination. This uses the saved callsign and per-device radio channel number. Do not use this when opening a telemetrum as there won't be a saved channel number. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools')
-rw-r--r--ao-tools/altosui/AltosConfig.java7
-rw-r--r--ao-tools/altosui/AltosEepromDownload.java7
-rw-r--r--ao-tools/altosui/AltosFlightUI.java1
-rw-r--r--ao-tools/altosui/AltosIgnite.java7
-rw-r--r--ao-tools/altosui/AltosSerial.java9
-rw-r--r--ao-tools/altosui/AltosTelemetryReader.java6
6 files changed, 18 insertions, 19 deletions
diff --git a/ao-tools/altosui/AltosConfig.java b/ao-tools/altosui/AltosConfig.java
index 6bda20d8..52dbfd79 100644
--- a/ao-tools/altosui/AltosConfig.java
+++ b/ao-tools/altosui/AltosConfig.java
@@ -109,9 +109,8 @@ public class AltosConfig implements Runnable, ActionListener {
void start_serial() throws InterruptedException {
if (remote) {
- serial_line.set_channel(AltosPreferences.channel(device.getSerial()));
- serial_line.set_callsign(AltosPreferences.callsign());
- serial_line.printf("p\n");
+ serial_line.set_radio();
+ serial_line.printf("p\nE 0\n");
serial_line.flush_input();
}
}
@@ -128,7 +127,7 @@ public class AltosConfig implements Runnable, ActionListener {
start_serial();
serial_line.printf("c s\nv\n");
for (;;) {
- String line = serial_line.get_reply(1000);
+ String line = serial_line.get_reply(5000);
if (line == null)
throw new TimeoutException();
get_int(line, "serial-number", serial);
diff --git a/ao-tools/altosui/AltosEepromDownload.java b/ao-tools/altosui/AltosEepromDownload.java
index fb5dcfc0..02fc36f2 100644
--- a/ao-tools/altosui/AltosEepromDownload.java
+++ b/ao-tools/altosui/AltosEepromDownload.java
@@ -97,7 +97,7 @@ public class AltosEepromDownload implements Runnable {
/* Pull the serial number out of the version information */
for (;;) {
- String line = serial_line.get_reply(1000);
+ String line = serial_line.get_reply(5000);
if (line == null)
throw new TimeoutException();
@@ -127,7 +127,7 @@ public class AltosEepromDownload implements Runnable {
any_valid = false;
monitor.set_value(state_names[state], state, block - state_block);
for (addr = 0; addr < 0x100;) {
- String line = serial_line.get_reply(1000);
+ String line = serial_line.get_reply(5000);
if (line == null)
throw new TimeoutException();
int[] values = ParseHex(line);
@@ -216,8 +216,7 @@ public class AltosEepromDownload implements Runnable {
public void run () {
if (remote) {
- serial_line.set_channel(AltosPreferences.channel(device.getSerial()));
- serial_line.set_callsign(AltosPreferences.callsign());
+ serial_line.set_radio();
serial_line.printf("p\nE 0\n");
serial_line.flush_input();
}
diff --git a/ao-tools/altosui/AltosFlightUI.java b/ao-tools/altosui/AltosFlightUI.java
index 732f7395..24d25bd7 100644
--- a/ao-tools/altosui/AltosFlightUI.java
+++ b/ao-tools/altosui/AltosFlightUI.java
@@ -148,7 +148,6 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
public void actionPerformed(ActionEvent e) {
int channel = channels.getSelectedIndex();
reader.set_channel(channel);
- AltosPreferences.set_channel(serial, channel);
}
});
c.gridx = 0;
diff --git a/ao-tools/altosui/AltosIgnite.java b/ao-tools/altosui/AltosIgnite.java
index 8e92ec1b..75c0a17a 100644
--- a/ao-tools/altosui/AltosIgnite.java
+++ b/ao-tools/altosui/AltosIgnite.java
@@ -35,9 +35,8 @@ public class AltosIgnite {
private void start_serial() throws InterruptedException {
if (remote) {
- serial.set_channel(AltosPreferences.channel(device.getSerial()));
- serial.set_callsign(AltosPreferences.callsign());
- serial.printf("~\np\n");
+ serial.set_radio();
+ serial.printf("p\nE 0\n");
serial.flush_input();
}
}
@@ -100,7 +99,7 @@ public class AltosIgnite {
start_serial();
serial.printf("t\n");
for (;;) {
- String line = serial.get_reply(1000);
+ String line = serial.get_reply(5000);
if (line == null)
throw new TimeoutException();
if (get_string(line, "Igniter: drogue Status: ", status_name))
diff --git a/ao-tools/altosui/AltosSerial.java b/ao-tools/altosui/AltosSerial.java
index 8a6ad05e..b19143e5 100644
--- a/ao-tools/altosui/AltosSerial.java
+++ b/ao-tools/altosui/AltosSerial.java
@@ -198,13 +198,18 @@ public class AltosSerial implements Runnable {
devices_opened.add(device.getPath());
}
altos = libaltos.altos_open(device);
- if (altos == null)
+ if (altos == null) {
+ close();
throw new FileNotFoundException(device.toShortString());
+ }
input_thread = new Thread(this);
input_thread.start();
print("~\nE 0\n");
+ set_monitor(false);
flush_output();
- set_monitor(monitor_mode);
+ }
+
+ public void set_radio() {
set_channel(AltosPreferences.channel(device.getSerial()));
set_callsign(AltosPreferences.callsign());
}
diff --git a/ao-tools/altosui/AltosTelemetryReader.java b/ao-tools/altosui/AltosTelemetryReader.java
index de5f50e9..6c5a9397 100644
--- a/ao-tools/altosui/AltosTelemetryReader.java
+++ b/ao-tools/altosui/AltosTelemetryReader.java
@@ -44,10 +44,7 @@ class AltosTelemetryReader extends AltosFlightReader {
void set_channel(int channel) {
serial.set_channel(channel);
- }
-
- void set_callsign(String callsign) {
- serial.set_callsign(callsign);
+ AltosPreferences.set_channel(device.getSerial(), channel);
}
public AltosTelemetryReader (AltosDevice in_device)
@@ -58,6 +55,7 @@ class AltosTelemetryReader extends AltosFlightReader {
name = device.toShortString();
telem = new LinkedBlockingQueue<AltosLine>();
+ serial.set_radio();
serial.add_monitor(telem);
}
}