package org.altusmetrum.AltosDroid;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_4.*;
import android.app.Activity;
import android.os.Bundle;
}
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(AltosDroid.number("%4.2f V", state.battery_voltage));
+ mBatteryLights.set(state.battery_voltage >= AltosLib.ao_battery_good, state.battery_voltage == AltosLib.MISSING);
+
+ mApogeeVoltageView.setText(AltosDroid.number("%4.2f V", state.apogee_voltage));
+ mApogeeLights.set(state.apogee_voltage >= AltosLib.ao_igniter_good, state.apogee_voltage == AltosLib.MISSING);
+
+ mMainVoltageView.setText(AltosDroid.number("%4.2f V", state.main_voltage));
+ mMainLights.set(state.main_voltage >= AltosLib.ao_igniter_good, state.main_voltage == AltosLib.MISSING);
+
+ if (state.flight != 0) {
+ if (state.state <= AltosLib.ao_flight_pad)
+ mDataLoggingView.setText("Ready to record");
+ else if (state.state < AltosLib.ao_flight_landed)
+ mDataLoggingView.setText("Recording data");
+ else
+ mDataLoggingView.setText("Recorded data");
+ } else {
+ mDataLoggingView.setText("Storage full");
+ }
+ mDataLoggingLights.set(state.flight != 0, state.flight == AltosLib.MISSING);
+
+ if (state.gps != null) {
+ int soln = state.gps.nsat;
+ int nsat = state.gps.cc_gps_sat != null ? state.gps.cc_gps_sat.length : 0;
+ mGPSLockedView.setText(String.format("%4d in soln, %4d in view", soln, nsat));
+ mGPSLockedLights.set(state.gps.locked && state.gps.nsat >= 4, false);
+ if (state.gps_ready)
+ mGPSReadyView.setText("Ready");
+ else
+ mGPSReadyView.setText(AltosDroid.integer("Waiting %d", state.gps_waiting));
+ } else
+ mGPSLockedLights.set(false, true);
+ mGPSReadyLights.set(state.gps_ready, state.gps == null);
}
if (receiver != null) {
altitude = receiver.getAltitude();
mPadLatitudeView.setText(AltosDroid.pos(receiver.getLatitude(), "N", "S"));
mPadLongitudeView.setText(AltosDroid.pos(receiver.getLongitude(), "W", "E"));
- mPadAltitudeView.setText(String.format("%4.0f m", altitude));
+ mPadAltitudeView.setText(AltosDroid.number("%4.0f m", altitude));
}
}