summaryrefslogtreecommitdiff
path: root/ao-tools/altosui/AltosDebug.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-08-29 21:36:47 -0700
committerKeith Packard <keithp@keithp.com>2010-08-29 21:36:47 -0700
commitae02b1590439d5c8dfb472cf1f83a14fdcfbaf11 (patch)
tree16f36835f0bf89a9db129ba26eb568284f1e0fac /ao-tools/altosui/AltosDebug.java
parentedcfb1bdf64772d3b83405ccf99385b8fea5d8e4 (diff)
altosui: provide separate flush_input/flush_output for serial. deal with monitor automatically
(yes, this should be two patches, but the diffs in AltosSerial were merged together). First, this replaces the existing flush/flush_reply mess with two simple functions, one to flush output to the serial device, making sure that all data written will be seen while we wait for input. The other sucks any pending input off of the serial line and discards it. Second, AltosSerial now tracks whether the serial line is being used for telemetry monitoring. If so, it enables monitoring, otherwise it disables it. Eliminates a bunch of manual state tracking elsewhere. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/altosui/AltosDebug.java')
-rw-r--r--ao-tools/altosui/AltosDebug.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/ao-tools/altosui/AltosDebug.java b/ao-tools/altosui/AltosDebug.java
index ca2e5a90..3f469d48 100644
--- a/ao-tools/altosui/AltosDebug.java
+++ b/ao-tools/altosui/AltosDebug.java
@@ -62,8 +62,8 @@ public class AltosDebug extends AltosSerial {
void ensure_debug_mode() {
if (!debug_mode) {
- printf("m 0\nD\n");
- flush_reply();
+ printf("D\n");
+ flush_input();
debug_mode = true;
}
}
@@ -103,7 +103,7 @@ public class AltosDebug extends AltosSerial {
throws IOException, InterruptedException {
byte[] data = new byte[length];
- flush_reply();
+ flush_input();
ensure_debug_mode();
printf("I %x %x\n", length, address);
int i = 0;
@@ -155,7 +155,7 @@ public class AltosDebug extends AltosSerial {
public byte[] read_bytes(int length)
throws IOException, InterruptedException {
- flush_reply();
+ flush_input();
ensure_debug_mode();
printf("G %x\n", length);
int i = 0;