summaryrefslogtreecommitdiff
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
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>
-rw-r--r--ao-tools/altosui/AltosState.java15
-rw-r--r--ao-tools/altosui/AltosUI.java12
2 files changed, 22 insertions, 5 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);
diff --git a/ao-tools/altosui/AltosUI.java b/ao-tools/altosui/AltosUI.java
index 5c771df2..4994f093 100644
--- a/ao-tools/altosui/AltosUI.java
+++ b/ao-tools/altosui/AltosUI.java
@@ -243,17 +243,15 @@ public class AltosUI extends JFrame {
flightInfoModel[i].finish();
}
- static final int MIN_PAD_SAMPLES = 10;
-
public void show(AltosState state) {
flightStatusModel.set(state);
info_reset();
- if (state.npad >= MIN_PAD_SAMPLES)
+ if (state.gps_ready)
info_add_row(0, "Ground state", "%s", "ready");
else
info_add_row(0, "Ground state", "wait (%d)",
- MIN_PAD_SAMPLES - state.npad);
+ state.gps_waiting);
info_add_row(0, "Rocket state", "%s", state.data.state);
info_add_row(0, "Callsign", "%s", state.data.callsign);
info_add_row(0, "Rocket serial", "%6d", state.data.serial);
@@ -413,6 +411,12 @@ public class AltosUI extends JFrame {
(int) (state.max_height + 0.5));
}
}
+ if (old_state == null || old_state.gps_ready != state.gps_ready) {
+ if (state.gps_ready)
+ voice.speak("GPS ready");
+ else if (old_state != null)
+ voice.speak("GPS lost");
+ }
old_state = state;
}