-import java.awt.*;
-import javax.swing.*;
-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);
- }
-
- public void show() {
- label.setVisible(true);
- value.setVisible(true);
- lights.setVisible(true);
- }
-
- void show(String s) {
- show();
- value.setText(s);
+import java.util.*;
+import org.altusmetrum.altoslib_12.*;
+import org.altusmetrum.altosuilib_12.*;
+
+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) {
+ AltosCalData cal_data = state.cal_data();
+ if (state == null || cal_data.flight == AltosLib.MISSING) {
+ hide();
+ } else {
+ if (cal_data.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(cal_data.flight != 0);
+ }