projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote branch 'origin/master'
[fw/altos]
/
ao-tools
/
altosui
/
AltosSerial.java
diff --git
a/ao-tools/altosui/AltosSerial.java
b/ao-tools/altosui/AltosSerial.java
index e84f5b63e4e21c7ca5cdd0cbb0cb90c863383ced..efa63f681819e2ed9f3d22ebfac66d79e47f7750 100644
(file)
--- a/
ao-tools/altosui/AltosSerial.java
+++ b/
ao-tools/altosui/AltosSerial.java
@@
-104,10
+104,8
@@
public class AltosSerial implements Runnable {
}
public void close() {
}
public void close() {
- if (altos != null)
{
+ if (altos != null)
libaltos.altos_close(altos);
libaltos.altos_close(altos);
- altos = null;
- }
if (input_thread != null) {
try {
input_thread.interrupt();
if (input_thread != null) {
try {
input_thread.interrupt();
@@
-116,10
+114,15
@@
public class AltosSerial implements Runnable {
}
input_thread = null;
}
}
input_thread = null;
}
+ if (altos != null) {
+ libaltos.altos_free(altos);
+ altos = null;
+ }
}
public void putc(char c) {
}
public void putc(char c) {
- libaltos.altos_putchar(altos, c);
+ if (altos != null)
+ libaltos.altos_putchar(altos, c);
}
public void print(String data) {
}
public void print(String data) {
@@
-134,8
+137,21
@@
public class AltosSerial implements Runnable {
public void open(altos_device device) throws FileNotFoundException {
close();
altos = libaltos.altos_open(device);
public void open(altos_device device) throws FileNotFoundException {
close();
altos = libaltos.altos_open(device);
+ if (altos == null)
+ throw new FileNotFoundException(device.getPath());
input_thread = new Thread(this);
input_thread.start();
input_thread = new Thread(this);
input_thread.start();
+ print("\nE 0\n");
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ }
+ flush();
+ }
+
+ public void set_channel(int channel) {
+ if (altos != null)
+ printf("m 0\nc r %d\nm 1\n", channel);
}
public AltosSerial() {
}
public AltosSerial() {