summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-09-03 01:21:57 -0700
committerKeith Packard <keithp@keithp.com>2010-09-03 07:04:28 -0700
commitba65e4aeb952a1cf49a77f1e24e235508fcea71f (patch)
tree784f04d97f7b277855b583e0e5eaf63a0bd14d1c
parente5ef42c2b22c6639d90631dbbb588f9fd2494385 (diff)
altosui: Deal with altos bug setting radio channel while monitoring
If the monitoring thread is active, then setting the radio channel can sometimes cause the monitoring thread to get stuck. I'm not entirely sure why though. For now, work around the issue by making sure monitoring is off, and the monitoring thread has stopped, before changing the radio channel. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--ao-tools/altosui/AltosSerial.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/ao-tools/altosui/AltosSerial.java b/ao-tools/altosui/AltosSerial.java
index c3daf3b9..c4a7ad76 100644
--- a/ao-tools/altosui/AltosSerial.java
+++ b/ao-tools/altosui/AltosSerial.java
@@ -186,10 +186,14 @@ public class AltosSerial implements Runnable {
public void set_channel(int channel) {
if (altos != null) {
+ if (monitor_mode) {
+ printf("m 0\n");
+ flush_input();
+ }
+ printf("c r %d\n", channel);
if (monitor_mode)
- printf("m 0\nc r %d\nm 1\n", channel);
- else
- printf("c r %d\n", channel);
+ printf("m 1\n");
+ flush_input();
}
}
@@ -198,8 +202,10 @@ public class AltosSerial implements Runnable {
if (altos != null) {
if (monitor)
printf("m 1\n");
- else
+ else {
printf("m 0\n");
+ flush_input();
+ }
}
}