projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altoslib: Clear saved TelemetryReader state instead of resetting in ScanUI
[fw/altos]
/
altosuilib
/
AltosDisplayThread.java
diff --git
a/altosuilib/AltosDisplayThread.java
b/altosuilib/AltosDisplayThread.java
index e88a891e22fb4e76e6f75268e1c64f75667989dc..627088bcddfc7c6ee6aa598362628979a9765877 100644
(file)
--- a/
altosuilib/AltosDisplayThread.java
+++ b/
altosuilib/AltosDisplayThread.java
@@
-15,13
+15,13
@@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altosuilib_
2
;
+package org.altusmetrum.altosuilib_
3
;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.text.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.text.*;
-import org.altusmetrum.altoslib_
4
.*;
+import org.altusmetrum.altoslib_
5
.*;
public class AltosDisplayThread extends Thread {
public class AltosDisplayThread extends Thread {
@@
-99,7
+99,7
@@
public class AltosDisplayThread extends Thread {
(int) (state.from_pad.bearing + 0.5),
(int) (state.elevation + 0.5),
AltosConvert.distance.say(state.range));
(int) (state.from_pad.bearing + 0.5),
(int) (state.elevation + 0.5),
AltosConvert.distance.say(state.range));
- } else if (state.state > AltosLib.ao_flight_pad) {
+ } else if (state.state > AltosLib.ao_flight_pad
&& state.height() != AltosLib.MISSING
) {
voice.speak(AltosConvert.height.say_units(state.height()));
} else {
reported_landing = 0;
voice.speak(AltosConvert.height.say_units(state.height()));
} else {
reported_landing = 0;
@@
-109,7
+109,8
@@
public class AltosDisplayThread extends Thread {
* either we've got a landed report or we haven't heard from it in
* a long time
*/
* either we've got a landed report or we haven't heard from it in
* a long time
*/
- if (state.state >= AltosLib.ao_flight_drogue &&
+ if (state.state != AltosLib.ao_flight_stateless &&
+ state.state >= AltosLib.ao_flight_drogue &&
(last ||
System.currentTimeMillis() - state.received_time >= 15000 ||
state.state == AltosLib.ao_flight_landed))
(last ||
System.currentTimeMillis() - state.received_time >= 15000 ||
state.state == AltosLib.ao_flight_landed))
@@
-182,16
+183,19
@@
public class AltosDisplayThread extends Thread {
synchronized boolean tell() {
boolean ret = false;
if (old_state == null || old_state.state != state.state) {
synchronized boolean tell() {
boolean ret = false;
if (old_state == null || old_state.state != state.state) {
- voice.speak(state.state_name());
+ if (state.state != AltosLib.ao_flight_stateless)
+ voice.speak(state.state_name());
if ((old_state == null || old_state.state <= AltosLib.ao_flight_boost) &&
state.state > AltosLib.ao_flight_boost) {
if ((old_state == null || old_state.state <= AltosLib.ao_flight_boost) &&
state.state > AltosLib.ao_flight_boost) {
- voice.speak("max speed: %s.",
- AltosConvert.speed.say_units(state.max_speed() + 0.5));
+ if (state.max_speed() != AltosLib.MISSING)
+ voice.speak("max speed: %s.",
+ AltosConvert.speed.say_units(state.max_speed() + 0.5));
ret = true;
} else if ((old_state == null || old_state.state < AltosLib.ao_flight_drogue) &&
state.state >= AltosLib.ao_flight_drogue) {
ret = true;
} else if ((old_state == null || old_state.state < AltosLib.ao_flight_drogue) &&
state.state >= AltosLib.ao_flight_drogue) {
- voice.speak("max height: %s.",
- AltosConvert.height.say_units(state.max_height() + 0.5));
+ if (state.max_height() != AltosLib.MISSING)
+ voice.speak("max height: %s.",
+ AltosConvert.height.say_units(state.max_height() + 0.5));
ret = true;
}
}
ret = true;
}
}
@@
-220,8
+224,10
@@
public class AltosDisplayThread extends Thread {
for (;;) {
try {
state = reader.read();
for (;;) {
try {
state = reader.read();
- if (state == null)
+ if (state == null) {
+ listener_state.running = false;
break;
break;
+ }
reader.update(state);
show_safely();
told = tell();
reader.update(state);
show_safely();
told = tell();