altosdroid: Improve voice for TeleGPS
authorKeith Packard <keithp@keithp.com>
Fri, 13 Jun 2014 22:54:08 +0000 (15:54 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 13 Jun 2014 23:02:18 +0000 (16:02 -0700)
This avoids making lots of useless voice announcements for TeleGPS

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java
altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java

index 77d4ba382d0e63882ac79e2c750a3feaa5e3f7b5..5e8515cb35d8a06e753e6fdb210809e73199a2de 100644 (file)
@@ -63,14 +63,17 @@ public class AltosVoice {
 
                boolean spoke = false;
                if (old_state == null || old_state.state != state.state) {
-                       speak(state.state_name());
+                       if (state.state != AltosLib.ao_flight_stateless)
+                               speak(state.state_name());
                        if ((old_state == null || old_state.state <= AltosLib.ao_flight_boost) &&
                            state.state > AltosLib.ao_flight_boost) {
-                               speak(String.format("max speed: %d meters per second.", (int) (state.max_speed() + 0.5)));
+                               if (state.max_speed() != AltosLib.MISSING)
+                                       speak(String.format("max speed: %d meters per second.", (int) (state.max_speed() + 0.5)));
                                spoke = true;
                        } else if ((old_state == null || old_state.state < AltosLib.ao_flight_drogue) &&
                                   state.state >= AltosLib.ao_flight_drogue) {
-                               speak(String.format("max height: %d meters.", (int) (state.max_height() + 0.5)));
+                               if (state.max_height() != AltosLib.MISSING)
+                                       speak(String.format("max height: %d meters.", (int) (state.max_height() + 0.5)));
                                spoke = true;
                        }
                }
@@ -109,8 +112,9 @@ public class AltosVoice {
                        }
 
                        /* If the rocket isn't on the pad, then report height */
-                       if (AltosLib.ao_flight_drogue <= state.state &&
-                           state.state < AltosLib.ao_flight_landed &&
+                       if (((AltosLib.ao_flight_drogue <= state.state &&
+                             state.state < AltosLib.ao_flight_landed) ||
+                            state.state == AltosLib.ao_flight_stateless) &&
                            state.range >= 0)
                        {
                                speak(String.format("Height %d, bearing %s %d, elevation %d, range %d.\n",
@@ -121,7 +125,8 @@ public class AltosVoice {
                                                    (int) (state.elevation + 0.5),
                                                    (int) (state.range + 0.5)));
                        } else if (state.state > AltosLib.ao_flight_pad) {
-                               speak(String.format("%d meters", (int) (state.height() + 0.5)));
+                               if (state.height() != AltosLib.MISSING)
+                                       speak(String.format("%d meters", (int) (state.height() + 0.5)));
                        } else {
                                reported_landing = 0;
                        }
index 10bb3bd9c0eae7c57dcb2269145973dfff796d2f..2d88974d3d787f516c15ea352b6e3936a5cfae84 100644 (file)
@@ -125,7 +125,9 @@ public class TabPad extends Fragment implements AltosDroidTab {
                        mDataLoggingLights.set(state.flight != 0, state.flight == AltosLib.MISSING);
 
                        if (state.gps != null) {
-                               mGPSLockedView.setText(AltosDroid.integer("%4d sats", state.gps.nsat));
+                               int soln = state.gps.nsat;
+                               int nsat = state.gps.cc_gps_sat != null ? state.gps.cc_gps_sat.length : 0;
+                               mGPSLockedView.setText(String.format("%4d in soln, %4d in view", soln, nsat));
                                mGPSLockedLights.set(state.gps.locked && state.gps.nsat >= 4, false);
                                if (state.gps_ready)
                                        mGPSReadyView.setText("Ready");