X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FTabPad.java;h=3c168e37d4f69a4740f4a9567b37f6304d478fc7;hp=5070ec0bb0a33d765a33bc067a2f9f285bf2a105;hb=3cd8ff18a7546c1e251747ba26240cb130003ef1;hpb=192bc28fbe2a8613d0b42e4fb3f7674a1a50abc7 diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java index 5070ec0b..3c168e37 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java @@ -102,35 +102,37 @@ public class TabPad extends Fragment implements AltosDroidTab { } public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) { - mBatteryVoltageView.setText(String.format("%4.2f V", state.battery)); - mBatteryLights.set(state.battery > 3.7); - - 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); - - if (state.data.flight != 0) { - if (state.data.state <= AltosLib.ao_flight_pad) - mDataLoggingView.setText("Ready to record"); - else if (state.data.state < AltosLib.ao_flight_landed) - mDataLoggingView.setText("Recording data"); - else - mDataLoggingView.setText("Recorded data"); - } else { - mDataLoggingView.setText("Storage full"); - } - mDataLoggingLights.set(state.data.flight != 0); - - if (state.gps != null) { - mGPSLockedView.setText(String.format("%4d sats", state.gps.nsat)); - mGPSLockedLights.set(state.gps.locked && state.gps.nsat >= 4); - if (state.gps_ready) - mGPSReadyView.setText("Ready"); - else - mGPSReadyView.setText(String.format("Waiting %d", state.gps_waiting)); - mGPSReadyLights.set(state.gps_ready); + if (state != null) { + mBatteryVoltageView.setText(String.format("%4.2f V", state.battery)); + mBatteryLights.set(state.battery > 3.7); + + 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); + + if (state.data.flight != 0) { + if (state.data.state <= AltosLib.ao_flight_pad) + mDataLoggingView.setText("Ready to record"); + else if (state.data.state < AltosLib.ao_flight_landed) + mDataLoggingView.setText("Recording data"); + else + mDataLoggingView.setText("Recorded data"); + } else { + mDataLoggingView.setText("Storage full"); + } + mDataLoggingLights.set(state.data.flight != 0); + + if (state.gps != null) { + mGPSLockedView.setText(String.format("%4d sats", state.gps.nsat)); + mGPSLockedLights.set(state.gps.locked && state.gps.nsat >= 4); + if (state.gps_ready) + mGPSReadyView.setText("Ready"); + else + mGPSReadyView.setText(String.format("Waiting %d", state.gps_waiting)); + mGPSReadyLights.set(state.gps_ready); + } } if (receiver != null) {