diff options
| author | Keith Packard <keithp@keithp.com> | 2013-04-13 12:13:18 -0700 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2013-04-13 12:13:18 -0700 |
| commit | 3cd8ff18a7546c1e251747ba26240cb130003ef1 (patch) | |
| tree | c02d8b775d91ca828c7cb3092bed363f62c00f99 /altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java | |
| parent | 192bc28fbe2a8613d0b42e4fb3f7674a1a50abc7 (diff) | |
altosdroid: Update UI even if no telem has been received. Center map.
This allows the receiver location to be displayed even when telemetry
is not.
Center the map on the first valid location, either receiver or
rocket. Update center if a significantly more precise location is received.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java')
| -rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java index de3bc3d2..23d2e97c 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java @@ -86,22 +86,24 @@ public class TabAscent extends Fragment implements AltosDroidTab { } public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) { - mHeightView.setText(String.format("%6.0f m", state.height)); - mMaxHeightView.setText(String.format("%6.0f m", state.max_height)); - mSpeedView.setText(String.format("%6.0f m/s", state.speed())); - mMaxSpeedView.setText(String.format("%6.0f m/s", state.max_speed())); - mAccelView.setText(String.format("%6.0f m/s²", state.acceleration)); - mMaxAccelView.setText(String.format("%6.0f m/s²", state.max_acceleration)); - - if (state.gps != null) { - mLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S")); - mLongitudeView.setText(AltosDroid.pos(state.gps.lon, "W", "E")); + if (state != null) { + mHeightView.setText(String.format("%6.0f m", state.height)); + mMaxHeightView.setText(String.format("%6.0f m", state.max_height)); + mSpeedView.setText(String.format("%6.0f m/s", state.speed())); + mMaxSpeedView.setText(String.format("%6.0f m/s", state.max_speed())); + mAccelView.setText(String.format("%6.0f m/s²", state.acceleration)); + mMaxAccelView.setText(String.format("%6.0f m/s²", state.max_acceleration)); + + if (state.gps != null) { + mLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S")); + mLongitudeView.setText(AltosDroid.pos(state.gps.lon, "W", "E")); + } + + mApogeeVoltageView.setText(String.format("%4.2f V", state.drogue_sense)); + mApogeeLights.set(state.drogue_sense > 3.2); + + mMainVoltageView.setText(String.format("%4.2f V", state.main_sense)); + mMainLights.set(state.main_sense > 3.2); } - - mApogeeVoltageView.setText(String.format("%4.2f V", state.drogue_sense)); - mApogeeLights.set(state.drogue_sense > 3.2); - - mMainVoltageView.setText(String.format("%4.2f V", state.main_sense)); - mMainLights.set(state.main_sense > 3.2); } } |
