-import java.text.*;
-import java.util.prefs.*;
-import java.util.concurrent.LinkedBlockingQueue;
-import org.altusmetrum.AltosLib.*;
-
-public class AltosPad extends JComponent implements AltosFlightDisplay {
- GridBagLayout layout;
-
- public class LaunchStatus {
- JLabel label;
- JTextField value;
- AltosLights lights;
-
- void show(AltosState state, int crc_errors) {}
- void reset() {
- value.setText("");
- lights.set(false);
+import org.altusmetrum.altoslib_11.*;
+import org.altusmetrum.altosuilib_11.*;
+
+public class AltosPad extends AltosUIFlightTab {
+
+ class Battery extends AltosUIVoltageIndicator {
+ public double voltage(AltosState state) { return state.battery_voltage; }
+ public double good() { return AltosLib.ao_battery_good; }
+ public Battery (AltosUIFlightTab container, int y) { super(container, y, "Battery Voltage", 2); }
+ }
+
+ class Apogee extends AltosUIVoltageIndicator {
+ public boolean hide(double v) { return v == AltosLib.MISSING; }
+ public double voltage(AltosState state) { return state.apogee_voltage; }
+ public double good() { return AltosLib.ao_igniter_good; }
+ public Apogee (AltosUIFlightTab container, int y) { super(container, y, "Apogee Igniter Voltage", 2); }
+ }
+
+ class Main extends AltosUIVoltageIndicator {
+ public boolean hide(double v) { return v == AltosLib.MISSING; }
+ public double voltage(AltosState state) { return state.main_voltage; }
+ public double good() { return AltosLib.ao_igniter_good; }
+ public Main (AltosUIFlightTab container, int y) { super(container, y, "Main Igniter Voltage", 2); }
+ }
+
+ class LoggingReady extends AltosUIIndicator {
+ public void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null || state.flight == AltosLib.MISSING) {
+ hide();
+ } else {
+ if (state.flight != 0) {
+ if (state.state() <= Altos.ao_flight_pad)
+ show("Ready to record");
+ else if (state.state() < Altos.ao_flight_landed ||
+ state.state() == AltosLib.ao_flight_stateless)
+ show("Recording data");
+ else
+ show("Recorded data");
+ } else
+ show("Storage full");
+ set_lights(state.flight != 0);
+ }