projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/scheme: Add vector and string funcs. Test everybody.
[fw/altos]
/
telegps
/
TeleGPSDisplayThread.java
diff --git
a/telegps/TeleGPSDisplayThread.java
b/telegps/TeleGPSDisplayThread.java
index a9c80dc00d537cd60cb87c892e72abfad257583f..fdf0e2019af56c66af8acadc61d2b56535791e1d 100644
(file)
--- a/
telegps/TeleGPSDisplayThread.java
+++ b/
telegps/TeleGPSDisplayThread.java
@@
-22,8
+22,8
@@
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.text.*;
import javax.swing.*;
import java.io.*;
import java.text.*;
-import org.altusmetrum.altoslib_1
1
.*;
-import org.altusmetrum.altosuilib_1
1
.*;
+import org.altusmetrum.altoslib_1
2
.*;
+import org.altusmetrum.altosuilib_1
2
.*;
public class TeleGPSDisplayThread extends Thread {
public class TeleGPSDisplayThread extends Thread {
@@
-31,7
+31,9
@@
public class TeleGPSDisplayThread extends Thread {
IdleThread idle_thread;
AltosVoice voice;
AltosFlightReader reader;
IdleThread idle_thread;
AltosVoice voice;
AltosFlightReader reader;
- AltosState old_state, state;
+ AltosState state;
+ int old_state = AltosLib.ao_flight_invalid;
+ boolean old_gps_ready = false;
AltosListenerState listener_state;
AltosFlightDisplay display;
AltosListenerState listener_state;
AltosFlightDisplay display;
@@
-130,11
+132,12
@@
public class TeleGPSDisplayThread extends Thread {
}
public synchronized void notice(boolean spoken) {
}
public synchronized void notice(boolean spoken) {
- if (old_state !=
null && old_state.state() !=
state.state()) {
+ if (old_state != state.state()) {
report_time = now();
this.notify();
} else if (spoken)
set_report_time();
report_time = now();
this.notify();
} else if (spoken)
set_report_time();
+ old_state = state.state();
}
public IdleThread() {
}
public IdleThread() {
@@
-144,17
+147,17
@@
public class TeleGPSDisplayThread extends Thread {
synchronized boolean tell() {
boolean ret = false;
synchronized boolean tell() {
boolean ret = false;
- if (old_
state == null || old_state.
gps_ready != state.gps_ready) {
+ if (old_gps_ready != state.gps_ready) {
if (state.gps_ready) {
voice.speak("GPS ready");
ret = true;
}
if (state.gps_ready) {
voice.speak("GPS ready");
ret = true;
}
- else if (old_
state != null
) {
+ else if (old_
gps_ready
) {
voice.speak("GPS lost");
ret = true;
}
voice.speak("GPS lost");
ret = true;
}
+ old_gps_ready = state.gps_ready;
}
}
- old_state = state;
return ret;
}
return ret;
}
@@
-173,7
+176,6
@@
public class TeleGPSDisplayThread extends Thread {
listener_state.running = false;
break;
}
listener_state.running = false;
break;
}
- reader.update(state);
show_safely();
told = tell();
idle_thread.notice(told);
show_safely();
told = tell();
idle_thread.notice(told);