summaryrefslogtreecommitdiff
path: root/ao-tools/altosui/AltosState.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-07-28 21:49:23 -0700
committerKeith Packard <keithp@keithp.com>2010-07-28 21:49:23 -0700
commitd0fd53bdab2f480cd43b6d7010c2094f4fccda91 (patch)
tree30e9fbf172d502a72dcf10c487f88770262e352a /ao-tools/altosui/AltosState.java
parent5fd225c3a52445ecdc7c04fac5e3d9a0db177c66 (diff)
Reset GPS ready status when GPS comes unlocked on the pad
If GPS becomes unlocked, then report that in the UI and via voice. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/altosui/AltosState.java')
-rw-r--r--ao-tools/altosui/AltosState.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/ao-tools/altosui/AltosState.java b/ao-tools/altosui/AltosState.java
index 59a1999e..9aa10a08 100644
--- a/ao-tools/altosui/AltosState.java
+++ b/ao-tools/altosui/AltosState.java
@@ -56,8 +56,12 @@ public class AltosState {
double pad_lat;
double pad_lon;
double pad_alt;
+
+ static final int MIN_PAD_SAMPLES = 10;
+
int npad;
- int prev_npad;
+ int gps_waiting;
+ boolean gps_ready;
AltosGreatCircle from_pad;
@@ -134,8 +138,17 @@ public class AltosState {
pad_lon = data.gps.lon;
pad_alt = data.gps.alt;
}
+ } else {
+ npad = 0;
}
}
+
+ gps_waiting = MIN_PAD_SAMPLES - npad;
+ if (gps_waiting < 0)
+ gps_waiting = 0;
+
+ gps_ready = gps_waiting == 0;
+
ascent = (AltosTelemetry.ao_flight_boost <= state &&
state <= AltosTelemetry.ao_flight_coast);