diff options
| -rw-r--r-- | altosui/AltosDebug.java | 5 | ||||
| -rw-r--r-- | altosui/AltosEepromDelete.java | 12 | ||||
| -rw-r--r-- | altosui/AltosEepromDownload.java | 8 | ||||
| -rw-r--r-- | altosui/AltosEepromManage.java | 5 | ||||
| -rw-r--r-- | altosui/AltosSerial.java | 17 | 
5 files changed, 31 insertions, 16 deletions
diff --git a/altosui/AltosDebug.java b/altosui/AltosDebug.java index 8d435b66..d18de80d 100644 --- a/altosui/AltosDebug.java +++ b/altosui/AltosDebug.java @@ -62,7 +62,10 @@ public class AltosDebug extends AltosSerial {  	void ensure_debug_mode() {  		if (!debug_mode) {  			printf("D\n"); -			flush_input(); +			try { +				flush_input(); +			} catch (InterruptedException ie) { +			}  			debug_mode = true;  		}  	} diff --git a/altosui/AltosEepromDelete.java b/altosui/AltosEepromDelete.java index cd9abfab..a9d77788 100644 --- a/altosui/AltosEepromDelete.java +++ b/altosui/AltosEepromDelete.java @@ -104,10 +104,14 @@ public class AltosEepromDelete implements Runnable {  						  serial_line.device.toShortString()),  				    "Connection Failed");  		} finally { -			if (remote) -				serial_line.stop_remote(); -			serial_line.flush_output(); -			serial_line.close(); +			try { +				if (remote) +					serial_line.stop_remote(); +			} catch (InterruptedException ie) { +			} finally { +				serial_line.flush_output(); +				serial_line.close(); +			}  		}  		if (listener != null) {  			Runnable r = new Runnable() { diff --git a/altosui/AltosEepromDownload.java b/altosui/AltosEepromDownload.java index b44a1451..358ad337 100644 --- a/altosui/AltosEepromDownload.java +++ b/altosui/AltosEepromDownload.java @@ -373,8 +373,12 @@ public class AltosEepromDownload implements Runnable {  				     "Connection Failed",  				     JOptionPane.ERROR_MESSAGE);  		} finally { -			if (remote) -				serial_line.stop_remote(); +			if (remote) { +				try { +					serial_line.stop_remote(); +				} catch (InterruptedException ie) { +				} +			}  			serial_line.flush_output();  		}  		monitor.done(); diff --git a/altosui/AltosEepromManage.java b/altosui/AltosEepromManage.java index 0652ca04..2e520628 100644 --- a/altosui/AltosEepromManage.java +++ b/altosui/AltosEepromManage.java @@ -44,7 +44,10 @@ public class AltosEepromManage implements ActionListener {  	public void finish() {  		if (serial_line != null) { -			serial_line.flush_input(); +			try { +				serial_line.flush_input(); +			} catch (InterruptedException ie) { +			}  			serial_line.close();  			serial_line = null;  		} diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java index b089c9c4..f0e25fa5 100644 --- a/altosui/AltosSerial.java +++ b/altosui/AltosSerial.java @@ -187,7 +187,7 @@ public class AltosSerial implements Runnable {  		return abort;  	} -	public void flush_input() { +	public void flush_input() throws InterruptedException {  		flush_output();  		boolean	got_some; @@ -195,10 +195,7 @@ public class AltosSerial implements Runnable {  		if (remote)  			timeout = 500;  		do { -			try { -				Thread.sleep(timeout); -			} catch (InterruptedException ie) { -			} +			Thread.sleep(timeout);  			got_some = !reply_queue.isEmpty();  			synchronized(this) {  				if (!"VERSION".startsWith(line) && @@ -271,8 +268,12 @@ public class AltosSerial implements Runnable {  	}  	public void close() { -		if (remote) -			stop_remote(); +		if (remote) { +			try { +				stop_remote(); +			} catch (InterruptedException ie) { +			} +		}  		if (in_reply != 0)  			System.out.printf("Uh-oh. Closing active serial device\n"); @@ -422,7 +423,7 @@ public class AltosSerial implements Runnable {  		remote = true;  	} -	public void stop_remote() { +	public void stop_remote() throws InterruptedException {  		if (debug)  			System.out.printf("stop remote\n");  		try {  | 
