summaryrefslogtreecommitdiff
path: root/telegps/TeleGPSDisplayThread.java
diff options
context:
space:
mode:
authorBdale Garbee <bdale@gag.com>2017-07-21 17:44:03 -0600
committerBdale Garbee <bdale@gag.com>2017-07-21 17:44:03 -0600
commitc8dbcaf69cd538a31ab6e2b568237ae7c8656a9a (patch)
tree213ec02db2e80f2e8c39772c0bde95d802900e53 /telegps/TeleGPSDisplayThread.java
parent0cbfa444a9f9159cb509bb47ca5590fc1d709f64 (diff)
parentea3b5815b27005b2f4c3034715f656d28ea8534e (diff)
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
Diffstat (limited to 'telegps/TeleGPSDisplayThread.java')
-rw-r--r--telegps/TeleGPSDisplayThread.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/telegps/TeleGPSDisplayThread.java b/telegps/TeleGPSDisplayThread.java
index a9c80dc0..fdf0e201 100644
--- 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 org.altusmetrum.altoslib_11.*;
-import org.altusmetrum.altosuilib_11.*;
+import org.altusmetrum.altoslib_12.*;
+import org.altusmetrum.altosuilib_12.*;
public class TeleGPSDisplayThread extends Thread {
@@ -31,7 +31,9 @@ public class TeleGPSDisplayThread extends Thread {
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;
@@ -130,11 +132,12 @@ public class TeleGPSDisplayThread extends Thread {
}
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();
+ old_state = state.state();
}
public IdleThread() {
@@ -144,17 +147,17 @@ public class TeleGPSDisplayThread extends Thread {
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;
}
- else if (old_state != null) {
+ else if (old_gps_ready) {
voice.speak("GPS lost");
ret = true;
}
+ old_gps_ready = state.gps_ready;
}
- old_state = state;
return ret;
}
@@ -173,7 +176,6 @@ public class TeleGPSDisplayThread extends Thread {
listener_state.running = false;
break;
}
- reader.update(state);
show_safely();
told = tell();
idle_thread.notice(told);