-import java.text.*;
-import java.util.prefs.*;
-import java.util.concurrent.LinkedBlockingQueue;
-
-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);
- }
-
- public void hide() {
- label.setVisible(false);
- value.setVisible(false);
- lights.setVisible(false);
- }
-
- public void set_font() {
- label.setFont(Altos.label_font);
- value.setFont(Altos.value_font);
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
+
+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);
+ }