From ae02b1590439d5c8dfb472cf1f83a14fdcfbaf11 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 29 Aug 2010 21:36:47 -0700 Subject: 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 --- ao-tools/altosui/AltosEepromDownload.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ao-tools/altosui/AltosEepromDownload.java') diff --git a/ao-tools/altosui/AltosEepromDownload.java b/ao-tools/altosui/AltosEepromDownload.java index 02a71118..5e43345b 100644 --- a/ao-tools/altosui/AltosEepromDownload.java +++ b/ao-tools/altosui/AltosEepromDownload.java @@ -223,10 +223,10 @@ public class AltosEepromDownload implements Runnable { public void run () { if (remote) { - serial_line.printf("m 0\n"); serial_line.set_channel(AltosPreferences.channel()); serial_line.set_callsign(AltosPreferences.callsign()); - serial_line.printf("p\n"); + serial_line.printf("p\nE 0\n"); + serial_line.flush_input(); } monitor = new AltosEepromMonitor(frame, Altos.ao_flight_boost, Altos.ao_flight_landed); @@ -247,6 +247,7 @@ public class AltosEepromDownload implements Runnable { if (remote) serial_line.printf("~"); monitor.done(); + serial_line.flush_output(); serial_line.close(); } -- cgit v1.2.3