altosui: Add 'On-board Data Logging' indicator to pad tab
authorKeith Packard <keithp@keithp.com>
Mon, 15 Aug 2011 04:11:41 +0000 (21:11 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 15 Aug 2011 04:11:41 +0000 (21:11 -0700)
This shows whether the on-board data memory is full, or is ready to
record the flight. This is indicated in the telemetry stream by a
flight number of '0'.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosPad.java

index d08925be9bc916e8cf9a19e170f3516ce2d8e79f..2ed1ab2c0b54e32815c1f9bad283d7b299693e29 100644 (file)
@@ -173,6 +173,29 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        Main main;
 
 
        Main main;
 
+       class LoggingReady extends LaunchStatus {
+               void show (AltosState state, int crc_errors) {
+                       show();
+                       System.out.printf("flight %d state %d\n", state.data.flight, state.data.state);
+                       if (state.data.flight != 0) {
+                               if (state.data.state <= Altos.ao_flight_pad)
+                                       value.setText("Ready to record");
+                               else if (state.data.state < Altos.ao_flight_landed)
+                                       value.setText("Recording data");
+                               else
+                                       value.setText("Recorded data");
+                       }
+                       else
+                               value.setText("Storage full");
+                       lights.set(state.data.flight != 0);
+               }
+               public LoggingReady (GridBagLayout layout, int y) {
+                       super(layout, y, "On-board Data Logging");
+               }
+       }
+
+       LoggingReady logging_ready;
+
        class GPSLocked extends LaunchStatus {
                void show (AltosState state, int crc_errors) {
                        show();
        class GPSLocked extends LaunchStatus {
                void show (AltosState state, int crc_errors) {
                        show();
@@ -252,6 +275,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                battery.reset();
                apogee.reset();
                main.reset();
                battery.reset();
                apogee.reset();
                main.reset();
+               logging_ready.reset();
                gps_locked.reset();
                gps_ready.reset();
                pad_lat.reset();
                gps_locked.reset();
                gps_ready.reset();
                pad_lat.reset();
@@ -269,6 +293,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                        main.hide();
                else
                        main.show(state, crc_errors);
                        main.hide();
                else
                        main.show(state, crc_errors);
+               logging_ready.show(state, crc_errors);
                pad_alt.show(state, crc_errors);
                if (state.gps != null && state.gps.connected) {
                        gps_locked.show(state, crc_errors);
                pad_alt.show(state, crc_errors);
                if (state.gps != null && state.gps.connected) {
                        gps_locked.show(state, crc_errors);
@@ -301,10 +326,11 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                battery = new Battery(layout, 0);
                apogee = new Apogee(layout, 1);
                main = new Main(layout, 2);
                battery = new Battery(layout, 0);
                apogee = new Apogee(layout, 1);
                main = new Main(layout, 2);
-               gps_locked = new GPSLocked(layout, 3);
-               gps_ready = new GPSReady(layout, 4);
-               pad_lat = new PadLat(layout, 5);
-               pad_lon = new PadLon(layout, 6);
-               pad_alt = new PadAlt(layout, 7);
+               logging_ready = new LoggingReady(layout, 3);
+               gps_locked = new GPSLocked(layout, 4);
+               gps_ready = new GPSReady(layout, 5);
+               pad_lat = new PadLat(layout, 6);
+               pad_lon = new PadLon(layout, 7);
+               pad_alt = new PadAlt(layout, 8);
        }
 }
        }
 }