altosdroid: AltosState now has speed and max_speed funcs
authorKeith Packard <keithp@keithp.com>
Mon, 22 Oct 2012 03:57:21 +0000 (20:57 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 22 Oct 2012 03:57:21 +0000 (20:57 -0700)
These pull out the appropriate baro/accel speed values and may use
some fancier values in future.

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

index 3396f77e40f9df866d94bd5ef87e355cfa1a3299..b1fc8d30fd091d124c52619f2c930e763235e843 100644 (file)
@@ -189,10 +189,7 @@ public class AltosDroid extends Activity {
                mSerialView.setText(String.format("%d", state.data.serial));
                mFlightView.setText(String.format("%d", state.data.flight));
                mStateView.setText(state.data.state());
-               double speed = state.speed;
-               if (!state.ascent)
-                       speed = state.baro_speed;
-               mSpeedView.setText(String.format("%6.0f m/s", speed));
+               mSpeedView.setText(String.format("%6.0f m/s", state.speed()));
                mAccelView.setText(String.format("%6.0f m/s²", state.acceleration));
                mRangeView.setText(String.format("%6.0f m", state.range));
                mHeightView.setText(String.format("%6.0f m", state.height));
index 3382d5516e76605a4f49e6d11a9a1d4763726245..264e35c6be17466929fa8c274b1037c32c1bbf8b 100644 (file)
@@ -67,7 +67,7 @@ public class AltosVoice {
                        speak(state.data.state());\r
                        if ((old_state == null || old_state.state <= AltosLib.ao_flight_boost) &&\r
                            state.state > AltosLib.ao_flight_boost) {\r
-                               speak(String.format("max speed: %d meters per second.", (int) (state.max_speed + 0.5)));\r
+                               speak(String.format("max speed: %d meters per second.", (int) (state.max_speed() + 0.5)));\r
                                spoke = true;\r
                        } else if ((old_state == null || old_state.state < AltosLib.ao_flight_drogue) &&\r
                                   state.state >= AltosLib.ao_flight_drogue) {\r