X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FTabAscent.java;h=fa4e3c8b3da13e7c5c957a422bf7e85ab1da9d62;hb=a488da3ca72fe0778b2d79a8cac935621d1d789d;hp=de3bc3d29f5cefd8e5e16e2e643eff1017be410e;hpb=2f7015afcca7c6042365d2124d3a5b7219e8e588;p=fw%2Faltos diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java index de3bc3d2..fa4e3c8b 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.*; +import org.altusmetrum.altoslib_5.*; import android.app.Activity; import android.os.Bundle; @@ -29,7 +29,7 @@ import android.widget.ImageView; import android.widget.TextView; import android.location.Location; -public class TabAscent extends Fragment implements AltosDroidTab { +public class TabAscent extends AltosDroidTab { AltosDroid mAltosDroid; private TextView mHeightView; @@ -85,23 +85,33 @@ public class TabAscent extends Fragment implements AltosDroidTab { mAltosDroid = null; } - 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")); - } - - mApogeeVoltageView.setText(String.format("%4.2f V", state.drogue_sense)); - mApogeeLights.set(state.drogue_sense > 3.2); + public String tab_name() { + return "ascent"; + } - mMainVoltageView.setText(String.format("%4.2f V", state.main_sense)); - mMainLights.set(state.main_sense > 3.2); + public void show(AltosState state, AltosGreatCircle from_receiver, Location receiver) { + if (state != null) { + set_value(mHeightView, AltosConvert.height, 6, state.height()); + set_value(mHeightView, AltosConvert.height, 6, state.height()); + set_value(mMaxHeightView, AltosConvert.height, 6, state.max_height()); + set_value(mSpeedView, AltosConvert.speed, 6, state.speed()); + set_value(mMaxSpeedView, AltosConvert.speed, 6, state.max_speed()); + set_value(mAccelView, AltosConvert.accel, 6, state.acceleration()); + set_value(mMaxAccelView, AltosConvert.accel, 6, 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.apogee_voltage)); + mApogeeLights.set(state.apogee_voltage > 3.2, state.apogee_voltage == AltosLib.MISSING); + + mMainVoltageView.setText(AltosDroid.number("%4.2f V", state.main_voltage)); + mMainLights.set(state.main_voltage > 3.2, state.main_voltage == AltosLib.MISSING); + } } }