X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FTabAscent.java;h=69bc68c95f6575b99fe95e09c56b5f909d7c8382;hp=bda6b1fd3b5dfdb4fe63b0b8d3ff8f919a7f1926;hb=5b976a6651f4eb05d30afc08b9e1f27c7e52ae00;hpb=59dfcbe14622c20aaa7d5b131eece9f4c8db6887 diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java index bda6b1fd..69bc68c9 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java @@ -17,7 +17,7 @@ package org.altusmetrum.AltosDroid; -import org.altusmetrum.altoslib_1.AltosState; +import org.altusmetrum.altoslib_2.*; import android.app.Activity; import android.os.Bundle; @@ -27,6 +27,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import android.location.Location; public class TabAscent extends Fragment implements AltosDroidTab { AltosDroid mAltosDroid; @@ -84,21 +85,28 @@ public class TabAscent extends Fragment implements AltosDroidTab { mAltosDroid = null; } - public void update_ui(AltosState state) { - 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)); - - 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); + public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) { + if (state != null) { + mHeightView.setText(AltosDroid.number("%6.0f m", state.height)); + mMaxHeightView.setText(AltosDroid.number("%6.0f m", state.max_height)); + mSpeedView.setText(AltosDroid.number("%6.0f m/s", state.speed())); + mMaxSpeedView.setText(AltosDroid.number("%6.0f m/s", state.max_speed())); + mAccelView.setText(AltosDroid.number("%6.0f m/s²", state.acceleration)); + mMaxAccelView.setText(AltosDroid.number("%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")); + } else { + mLatitudeView.setText(""); + mLongitudeView.setText(""); + } + + mApogeeVoltageView.setText(AltosDroid.number("%4.2f V", state.drogue_sense)); + mApogeeLights.set(state.drogue_sense > 3.2, state.drogue_sense == AltosLib.MISSING); + + mMainVoltageView.setText(AltosDroid.number("%4.2f V", state.main_sense)); + mMainLights.set(state.main_sense > 3.2, state.main_sense == AltosLib.MISSING); + } } }