altosui: Add ascent, descent and landed tabs
authorKeith Packard <keithp@keithp.com>
Wed, 10 Nov 2010 07:34:32 +0000 (23:34 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 10 Nov 2010 07:34:32 +0000 (23:34 -0800)
This completes the set of tabs for in-flight status information.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/altosui/AltosAscent.java [new file with mode: 0644]
ao-tools/altosui/AltosDescent.java [new file with mode: 0644]
ao-tools/altosui/AltosDisplayThread.java
ao-tools/altosui/AltosFlightUI.java
ao-tools/altosui/AltosLanded.java [new file with mode: 0644]
ao-tools/altosui/AltosLights.java
ao-tools/altosui/AltosPad.java
ao-tools/altosui/AltosState.java
ao-tools/altosui/Makefile.am

diff --git a/ao-tools/altosui/AltosAscent.java b/ao-tools/altosui/AltosAscent.java
new file mode 100644 (file)
index 0000000..40df7af
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ * Copyright © 2010 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package altosui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import javax.swing.table.*;
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.util.prefs.*;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class AltosAscent extends JComponent implements AltosFlightDisplay {
+       GridBagLayout   layout;
+       Font            label_font;
+       Font            value_font;
+
+       public class AscentValue {
+               JLabel          label;
+               JTextField      value;
+               void show(AltosState state, int crc_errors) {}
+
+               void reset() {
+                       value.setText("");
+               }
+               public AscentValue (GridBagLayout layout, int y, String text) {
+                       GridBagConstraints      c = new GridBagConstraints();
+
+                       label = new JLabel(text);
+                       label.setFont(label_font);
+                       label.setHorizontalAlignment(SwingConstants.LEFT);
+                       c.gridx = 0; c.gridy = y;
+                       c.insets = new Insets(10, 10, 10, 10);
+                       c.anchor = GridBagConstraints.WEST;
+                       layout.setConstraints(label, c);
+                       add(label);
+
+                       value = new JTextField(20);
+                       value.setFont(label_font);
+                       value.setHorizontalAlignment(SwingConstants.RIGHT);
+                       c.gridx = 1; c.gridy = y;
+                       c.anchor = GridBagConstraints.WEST;
+                       c.fill = GridBagConstraints.HORIZONTAL;
+                       c.gridwidth = 2;
+                       layout.setConstraints(value, c);
+                       add(value);
+               }
+       }
+
+       public class AscentValueHold {
+               JLabel          label;
+               JTextField      value;
+               JTextField      max_value;
+               double          max;
+
+               void show(AltosState state, int crc_errors) {}
+
+               void reset() {
+                       value.setText("");
+                       max_value.setText("");
+                       max = 0;
+               }
+
+               void show(String format, double v) {
+                       value.setText(String.format(format, v));
+                       if (v > max) {
+                               max_value.setText(String.format(format, v));
+                               max = v;
+                       }
+               }
+               public AscentValueHold (GridBagLayout layout, int y, String text) {
+                       GridBagConstraints      c = new GridBagConstraints();
+
+                       label = new JLabel(text);
+                       label.setFont(label_font);
+                       label.setHorizontalAlignment(SwingConstants.LEFT);
+                       c.gridx = 0; c.gridy = y;
+                       c.insets = new Insets(10, 10, 10, 10);
+                       c.anchor = GridBagConstraints.WEST;
+                       layout.setConstraints(label, c);
+                       add(label);
+
+                       value = new JTextField(10);
+                       value.setFont(label_font);
+                       value.setHorizontalAlignment(SwingConstants.RIGHT);
+                       c.gridx = 1; c.gridy = y;
+                       c.anchor = GridBagConstraints.EAST;
+                       layout.setConstraints(value, c);
+                       add(value);
+
+                       max_value = new JTextField(10);
+                       max_value.setFont(label_font);
+                       max_value.setHorizontalAlignment(SwingConstants.RIGHT);
+                       c.gridx = 2; c.gridy = y;
+                       c.anchor = GridBagConstraints.EAST;
+                       layout.setConstraints(max_value, c);
+                       add(max_value);
+               }
+       }
+
+
+       class Height extends AscentValueHold {
+               void show (AltosState state, int crc_errors) {
+                       show("%6.0f m", state.height);
+               }
+               public Height (GridBagLayout layout, int y) {
+                       super (layout, y, "Height");
+               }
+       }
+
+       Height  height;
+
+       class Speed extends AscentValueHold {
+               void show (AltosState state, int crc_errors) {
+                       double speed = state.speed;
+                       if (!state.ascent)
+                               speed = state.baro_speed;
+                       show("%6.0f m/s", speed);
+               }
+               public Speed (GridBagLayout layout, int y) {
+                       super (layout, y, "Speed");
+               }
+       }
+
+       Speed   speed;
+
+       class Accel extends AscentValueHold {
+               void show (AltosState state, int crc_errors) {
+                       show("%6.0f m/s²", state.acceleration);
+               }
+               public Accel (GridBagLayout layout, int y) {
+                       super (layout, y, "Acceleration");
+               }
+       }
+
+       Accel   accel;
+
+       String pos(double p, String pos, String neg) {
+               String  h = pos;
+               if (p < 0) {
+                       h = neg;
+                       p = -p;
+               }
+               int deg = (int) Math.floor(p);
+               double min = (p - Math.floor(p)) * 60.0;
+               return String.format("%s %4d° %9.6f", h, deg, min);
+       }
+
+       class Lat extends AscentValue {
+               void show (AltosState state, int crc_errors) {
+                       if (state.gps != null)
+                               value.setText(pos(state.gps.lat,"N", "S"));
+                       else
+                               value.setText("???");
+               }
+               public Lat (GridBagLayout layout, int y) {
+                       super (layout, y, "Latitude");
+               }
+       }
+
+       Lat lat;
+
+       class Lon extends AscentValue {
+               void show (AltosState state, int crc_errors) {
+                       if (state.gps != null)
+                               value.setText(pos(state.gps.lon,"E", "W"));
+                       else
+                               value.setText("???");
+               }
+               public Lon (GridBagLayout layout, int y) {
+                       super (layout, y, "Longitude");
+               }
+       }
+
+       Lon lon;
+
+       public void reset() {
+               lat.reset();
+               lon.reset();
+               height.reset();
+               speed.reset();
+               accel.reset();
+       }
+
+       public void show(AltosState state, int crc_errors) {
+               lat.show(state, crc_errors);
+               lon.show(state, crc_errors);
+               height.show(state, crc_errors);
+               speed.show(state, crc_errors);
+               accel.show(state, crc_errors);
+       }
+
+       public void labels(GridBagLayout layout, int y) {
+               GridBagConstraints      c;
+               JLabel                  cur, max;
+
+               cur = new JLabel("Current");
+               cur.setFont(label_font);
+               c = new GridBagConstraints();
+               c.gridx = 1; c.gridy = y;
+               c.insets = new Insets(10, 10, 10, 10);
+               layout.setConstraints(cur, c);
+               add(cur);
+
+               max = new JLabel("Maximum");
+               max.setFont(label_font);
+               c.gridx = 2; c.gridy = y;
+               layout.setConstraints(max, c);
+               add(max);
+       }
+
+       public AltosAscent() {
+               layout = new GridBagLayout();
+
+               label_font = new Font("Dialog", Font.PLAIN, 24);
+               value_font = new Font("Monospace", Font.PLAIN, 24);
+               setLayout(layout);
+
+               /* Elements in ascent display:
+                *
+                * lat
+                * lon
+                * height
+                */
+               labels(layout, 0);
+               height = new Height(layout, 1);
+               speed = new Speed(layout, 2);
+               accel = new Accel(layout, 3);
+               lat = new Lat(layout, 4);
+               lon = new Lon(layout, 5);
+       }
+}
diff --git a/ao-tools/altosui/AltosDescent.java b/ao-tools/altosui/AltosDescent.java
new file mode 100644 (file)
index 0000000..0d3d17f
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * Copyright © 2010 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package altosui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import javax.swing.table.*;
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.util.prefs.*;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class AltosDescent extends JComponent implements AltosFlightDisplay {
+       GridBagLayout   layout;
+       Font            label_font;
+       Font            value_font;
+
+       public class DescentValue {
+               JLabel          label;
+               JTextField      value;
+               void show(AltosState state, int crc_errors) {}
+
+               void reset() {
+                       value.setText("");
+               }
+
+               void show(String format, double v) {
+                       value.setText(String.format(format, v));
+               }
+
+               public DescentValue (GridBagLayout layout, int y, String text) {
+                       GridBagConstraints      c = new GridBagConstraints();
+
+                       label = new JLabel(text);
+                       label.setFont(label_font);
+                       label.setHorizontalAlignment(SwingConstants.LEFT);
+                       c.gridx = 0; c.gridy = y;
+                       c.insets = new Insets(10, 10, 10, 10);
+                       c.anchor = GridBagConstraints.WEST;
+                       layout.setConstraints(label, c);
+                       add(label);
+
+                       value = new JTextField(20);
+                       value.setFont(label_font);
+                       value.setHorizontalAlignment(SwingConstants.RIGHT);
+                       c.gridx = 1; c.gridy = y;
+                       c.anchor = GridBagConstraints.WEST;
+                       c.fill = GridBagConstraints.HORIZONTAL;
+                       layout.setConstraints(value, c);
+                       add(value);
+               }
+       }
+
+       class Height extends DescentValue {
+               void show (AltosState state, int crc_errors) {
+                       show("%6.0f m", state.height);
+               }
+               public Height (GridBagLayout layout, int y) {
+                       super (layout, y, "Height");
+               }
+       }
+
+       Height  height;
+
+       class Speed extends DescentValue {
+               void show (AltosState state, int crc_errors) {
+                       double speed = state.speed;
+                       if (!state.ascent)
+                               speed = state.baro_speed;
+                       show("%6.0f m/s", speed);
+               }
+               public Speed (GridBagLayout layout, int y) {
+                       super (layout, y, "Speed");
+               }
+       }
+
+       Speed   speed;
+
+       String pos(double p, String pos, String neg) {
+               String  h = pos;
+               if (p < 0) {
+                       h = neg;
+                       p = -p;
+               }
+               int deg = (int) Math.floor(p);
+               double min = (p - Math.floor(p)) * 60.0;
+               return String.format("%s %4d° %9.6f", h, deg, min);
+       }
+
+       class Lat extends DescentValue {
+               void show (AltosState state, int crc_errors) {
+                       if (state.gps != null)
+                               value.setText(pos(state.gps.lat,"N", "S"));
+                       else
+                               value.setText("???");
+               }
+               public Lat (GridBagLayout layout, int y) {
+                       super (layout, y, "Latitude");
+               }
+       }
+
+       Lat lat;
+
+       class Lon extends DescentValue {
+               void show (AltosState state, int crc_errors) {
+                       if (state.gps != null)
+                               value.setText(pos(state.gps.lon,"E", "W"));
+                       else
+                               value.setText("???");
+               }
+               public Lon (GridBagLayout layout, int y) {
+                       super (layout, y, "Longitude");
+               }
+       }
+
+       Lon lon;
+
+       class Bearing extends DescentValue {
+               void show (AltosState state, int crc_errors) {
+                       if (state.from_pad != null)
+                               show("%3.0f°", state.from_pad.bearing);
+                       else
+                               value.setText("???");
+               }
+               public Bearing (GridBagLayout layout, int y) {
+                       super (layout, y, "Bearing");
+               }
+       }
+
+       Bearing bearing;
+
+       class Elevation extends DescentValue {
+               void show (AltosState state, int crc_errors) {
+                       if (state.from_pad != null)
+                               show("%3.0f°", state.elevation);
+                       else
+                               value.setText("???");
+               }
+               public Elevation (GridBagLayout layout, int y) {
+                       super (layout, y, "Elevation");
+               }
+       }
+
+       Elevation elevation;
+
+       class Range extends DescentValue {
+               void show (AltosState state, int crc_errors) {
+                       show("%6.0f m", state.range);
+               }
+               public Range (GridBagLayout layout, int y) {
+                       super (layout, y, "Range");
+               }
+       }
+
+       Range range;
+
+       public void reset() {
+               lat.reset();
+               lon.reset();
+               height.reset();
+               speed.reset();
+               bearing.reset();
+               elevation.reset();
+               range.reset();
+       }
+
+       public void show(AltosState state, int crc_errors) {
+               height.show(state, crc_errors);
+               speed.show(state, crc_errors);
+               bearing.show(state, crc_errors);
+               elevation.show(state, crc_errors);
+               range.show(state, crc_errors);
+               lat.show(state, crc_errors);
+               lon.show(state, crc_errors);
+       }
+
+       public AltosDescent() {
+               layout = new GridBagLayout();
+
+               label_font = new Font("Dialog", Font.PLAIN, 24);
+               value_font = new Font("Monospace", Font.PLAIN, 24);
+               setLayout(layout);
+
+               /* Elements in descent display */
+               speed = new Speed(layout, 0);
+               height = new Height(layout, 1);
+               bearing = new Bearing(layout, 2);
+               elevation = new Elevation(layout, 3);
+               range = new Range(layout, 4);
+               lat = new Lat(layout, 5);
+               lon = new Lon(layout, 6);
+       }
+}
index 957ac0d69581f00693b59104739a1d23c335943d..b5b2777e7885bbc79071faae7fd4238e0563a446 100644 (file)
@@ -38,6 +38,11 @@ public class AltosDisplayThread extends Thread {
        int                     crc_errors;
        AltosFlightDisplay      display;
 
+       synchronized void show(AltosState state, int crc_errors) {
+               if (state != null)
+                       display.show(state, crc_errors);
+       }
+
        class IdleThread extends Thread {
 
                boolean started;
@@ -93,6 +98,10 @@ public class AltosDisplayThread extends Thread {
                                                    (int) (state.from_pad.bearing + 0.5),
                                                    (int) (state.from_pad.distance + 0.5));
                                ++reported_landing;
+                               if (state.state != Altos.ao_flight_landed) {
+                                       state.state = Altos.ao_flight_landed;
+                                       show(state, 0);
+                               }
                        }
                }
 
@@ -180,11 +189,6 @@ public class AltosDisplayThread extends Thread {
                return ret;
        }
 
-       void show(AltosState state, int crc_errors) {
-               if (state != null)
-                       display.show(state, crc_errors);
-       }
-
        public void run() {
                boolean         interrupted = false;
                String          line;
index a7caf7e9620d9f504f5d673a0e3a5b1779734993..558b0395abb3bc126a04f6d8e0e969c2883401e3 100644 (file)
@@ -41,10 +41,30 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
        JTabbedPane     pane;
 
        AltosPad        pad;
+       AltosAscent     ascent;
+       AltosDescent    descent;
+       AltosLanded     landed;
 
        private AltosStatusTable flightStatus;
        private AltosInfoTable flightInfo;
 
+       static final int tab_pad = 1;
+       static final int tab_ascent = 2;
+       static final int tab_descent = 3;
+       static final int tab_landed = 4;
+
+       int cur_tab = 0;
+
+       int which_tab(AltosState state) {
+               if (state.state < Altos.ao_flight_boost)
+                       return tab_pad;
+               if (state.state <= Altos.ao_flight_coast)
+                       return tab_ascent;
+               if (state.state <= Altos.ao_flight_main)
+                       return tab_descent;
+               return tab_landed;
+       }
+
        public int width() {
                return flightInfo.width();
        }
@@ -69,11 +89,34 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
 
        public void reset() {
                pad.reset();
+               ascent.reset();
+               descent.reset();
+               landed.reset();
                flightInfo.clear();
        }
 
        public void show(AltosState state, int crc_errors) {
+               int     tab = which_tab(state);
                pad.show(state, crc_errors);
+               ascent.show(state, crc_errors);
+               descent.show(state, crc_errors);
+               landed.show(state, crc_errors);
+               if (tab != cur_tab) {
+                       switch (tab) {
+                       case tab_pad:
+                               pane.setSelectedComponent(pad);
+                               break;
+                       case tab_ascent:
+                               pane.setSelectedComponent(ascent);
+                               break;
+                       case tab_descent:
+                               pane.setSelectedComponent(descent);
+                               break;
+                       case tab_landed:
+                               pane.setSelectedComponent(landed);
+                       }
+                       cur_tab = tab;
+               }
                flightStatus.set(state);
                flightInfo.show(state, crc_errors);
        }
@@ -98,6 +141,15 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                pad = new AltosPad();
                pane.add("Launch Pad", pad);
 
+               ascent = new AltosAscent();
+               pane.add("Ascent", ascent);
+
+               descent = new AltosDescent();
+               pane.add("Descent", descent);
+
+               landed = new AltosLanded();
+               pane.add("Landed", landed);
+
                flightInfo = new AltosInfoTable();
                pane.add("Table", flightInfo.box());
 
diff --git a/ao-tools/altosui/AltosLanded.java b/ao-tools/altosui/AltosLanded.java
new file mode 100644 (file)
index 0000000..4b74aaa
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Copyright © 2010 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package altosui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import javax.swing.table.*;
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.util.prefs.*;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class AltosLanded extends JComponent implements AltosFlightDisplay {
+       GridBagLayout   layout;
+       Font            label_font;
+       Font            value_font;
+
+       public class LandedValue {
+               JLabel          label;
+               JTextField      value;
+               void show(AltosState state, int crc_errors) {}
+
+               void reset() {
+                       value.setText("");
+               }
+
+               void show(String format, double v) {
+                       value.setText(String.format(format, v));
+               }
+
+               public LandedValue (GridBagLayout layout, int y, String text) {
+                       GridBagConstraints      c = new GridBagConstraints();
+
+                       label = new JLabel(text);
+                       label.setFont(label_font);
+                       label.setHorizontalAlignment(SwingConstants.LEFT);
+                       c.gridx = 0; c.gridy = y;
+                       c.insets = new Insets(10, 10, 10, 10);
+                       c.anchor = GridBagConstraints.WEST;
+                       layout.setConstraints(label, c);
+                       add(label);
+
+                       value = new JTextField(20);
+                       value.setFont(label_font);
+                       value.setHorizontalAlignment(SwingConstants.RIGHT);
+                       c.gridx = 1; c.gridy = y;
+                       c.anchor = GridBagConstraints.WEST;
+                       c.fill = GridBagConstraints.HORIZONTAL;
+                       layout.setConstraints(value, c);
+                       add(value);
+               }
+       }
+
+       String pos(double p, String pos, String neg) {
+               String  h = pos;
+               if (p < 0) {
+                       h = neg;
+                       p = -p;
+               }
+               int deg = (int) Math.floor(p);
+               double min = (p - Math.floor(p)) * 60.0;
+               return String.format("%s %4d° %9.6f", h, deg, min);
+       }
+
+       class Lat extends LandedValue {
+               void show (AltosState state, int crc_errors) {
+                       if (state.gps != null)
+                               value.setText(pos(state.gps.lat,"N", "S"));
+                       else
+                               value.setText("???");
+               }
+               public Lat (GridBagLayout layout, int y) {
+                       super (layout, y, "Latitude");
+               }
+       }
+
+       Lat lat;
+
+       class Lon extends LandedValue {
+               void show (AltosState state, int crc_errors) {
+                       if (state.gps != null)
+                               value.setText(pos(state.gps.lon,"E", "W"));
+                       else
+                               value.setText("???");
+               }
+               public Lon (GridBagLayout layout, int y) {
+                       super (layout, y, "Longitude");
+               }
+       }
+
+       Lon lon;
+
+       class Bearing extends LandedValue {
+               void show (AltosState state, int crc_errors) {
+                       if (state.from_pad != null)
+                               show("%3.0f°", state.from_pad.bearing);
+                       else
+                               value.setText("???");
+               }
+               public Bearing (GridBagLayout layout, int y) {
+                       super (layout, y, "Bearing");
+               }
+       }
+
+       Bearing bearing;
+
+       class Distance extends LandedValue {
+               void show (AltosState state, int crc_errors) {
+                       if (state.from_pad != null)
+                               show("%6.0f m", state.from_pad.distance);
+                       else
+                               value.setText("???");
+               }
+               public Distance (GridBagLayout layout, int y) {
+                       super (layout, y, "Distance");
+               }
+       }
+
+       Distance distance;
+
+       class Height extends LandedValue {
+               void show (AltosState state, int crc_errors) {
+                       show("%6.0f m", state.max_height);
+               }
+               public Height (GridBagLayout layout, int y) {
+                       super (layout, y, "Maximum Height");
+               }
+       }
+
+       Height  height;
+
+       class Speed extends LandedValue {
+               void show (AltosState state, int crc_errors) {
+                       show("%6.0f m/s", state.max_speed);
+               }
+               public Speed (GridBagLayout layout, int y) {
+                       super (layout, y, "Maximum Speed");
+               }
+       }
+
+       Speed   speed;
+
+       class Accel extends LandedValue {
+               void show (AltosState state, int crc_errors) {
+                       show("%6.0f m/s²", state.max_acceleration);
+               }
+               public Accel (GridBagLayout layout, int y) {
+                       super (layout, y, "Maximum Acceleration");
+               }
+       }
+
+       Accel   accel;
+
+       public void reset() {
+               lat.reset();
+               lon.reset();
+               bearing.reset();
+               distance.reset();
+               height.reset();
+               speed.reset();
+               accel.reset();
+       }
+
+       public void show(AltosState state, int crc_errors) {
+               bearing.show(state, crc_errors);
+               distance.show(state, crc_errors);
+               lat.show(state, crc_errors);
+               lon.show(state, crc_errors);
+               height.show(state, crc_errors);
+               speed.show(state, crc_errors);
+               accel.show(state, crc_errors);
+       }
+
+       public AltosLanded() {
+               layout = new GridBagLayout();
+
+               label_font = new Font("Dialog", Font.PLAIN, 24);
+               value_font = new Font("Monospace", Font.PLAIN, 24);
+               setLayout(layout);
+
+               /* Elements in descent display */
+               bearing = new Bearing(layout, 0);
+               distance = new Distance(layout, 1);
+               lat = new Lat(layout, 2);
+               lon = new Lon(layout, 3);
+               height = new Height(layout, 4);
+               speed = new Speed(layout, 5);
+               accel = new Accel(layout, 6);
+       }
+}
index 2d2a193807508a56f00e879dd247be325c9677e0..f1ed47c275f0a68a525e031863565ba6eb159750 100644 (file)
@@ -60,6 +60,7 @@ public class AltosLights extends JComponent {
                c = new GridBagConstraints();
                red = new AltosLed("/redled.png", "/redoff.png");
                c.gridx = 0; c.gridy = 0;
+               c.insets = new Insets (0, 5, 0, 5);
                gridbag.setConstraints(red, c);
                add(red);
                red.set(true);
index 133dbed3e363b5383e10dc35607fd85a30cf384f..7b72be20cbea4fb019a726d8fe0e7878cff4c7f9 100644 (file)
@@ -35,12 +35,12 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        public class LaunchStatus {
                JLabel          label;
-               JLabel          value;
+               JTextField      value;
                AltosLights     lights;
 
                void show(AltosState state, int crc_errors) {}
                void reset() {
-                       value.setText("0");
+                       value.setText("");
                        lights.set(false);
                }
 
@@ -64,12 +64,11 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                        layout.setConstraints(label, c);
                        add(label);
 
-                       value = new JLabel("4.00");
+                       value = new JTextField(10);
                        value.setFont(label_font);
                        value.setHorizontalAlignment(SwingConstants.RIGHT);
                        c.gridx = 2; c.gridy = y;
-                       c.anchor = GridBagConstraints.EAST;
-                       c.fill = GridBagConstraints.EAST;
+                       c.anchor = GridBagConstraints.WEST;
                        layout.setConstraints(value, c);
                        add(value);
 
@@ -78,11 +77,11 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        public class LaunchValue {
                JLabel          label;
-               JLabel          value;
+               JTextField      value;
                void show(AltosState state, int crc_errors) {}
 
                void reset() {
-                       value.setText("0");
+                       value.setText("");
                }
                public LaunchValue (GridBagLayout layout, int y, String text) {
                        GridBagConstraints      c = new GridBagConstraints();
@@ -93,16 +92,15 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                        c.gridx = 1; c.gridy = y;
                        c.insets = new Insets(10, 10, 10, 10);
                        c.anchor = GridBagConstraints.WEST;
-                       c.fill = GridBagConstraints.WEST;
                        layout.setConstraints(label, c);
                        add(label);
 
-                       value = new JLabel("4.00");
+                       value = new JTextField(20);
                        value.setFont(label_font);
                        value.setHorizontalAlignment(SwingConstants.RIGHT);
                        c.gridx = 2; c.gridy = y;
                        c.anchor = GridBagConstraints.EAST;
-                       c.fill = GridBagConstraints.EAST;
+                       c.fill = GridBagConstraints.HORIZONTAL;
                        layout.setConstraints(value, c);
                        add(value);
                }
index 1048bb51b09ca8faee0dccb4c4953850d135c2cf..86eb636a19687561c093565eaae2410eed96c70a 100644 (file)
@@ -35,6 +35,7 @@ public class AltosState {
        int     tick;
 
        int     state;
+       boolean landed;
        boolean ascent; /* going up? */
 
        double  ground_altitude;
index ab9cf2010626dec6184302b87f7c8479a1f81c27..267bae63b85ae8c7153b0e84fe84ba794800db42 100644 (file)
@@ -10,6 +10,7 @@ CLASSPATH_ENV=mkdir -p $(JAVAROOT); CLASSPATH=".:classes:../libaltos:$(FREETTS)/
 bin_SCRIPTS=altosui
 
 altosui_JAVA = \
+       AltosAscent.java \
        AltosChannelMenu.java \
        AltosConfig.java \
        AltosConfigUI.java \
@@ -18,6 +19,7 @@ altosui_JAVA = \
        AltosCSV.java \
        AltosCSVUI.java \
        AltosDebug.java \
+       AltosDescent.java \
        AltosDeviceDialog.java \
        AltosDevice.java \
        AltosDisplayThread.java \
@@ -39,6 +41,7 @@ altosui_JAVA = \
        Altos.java \
        AltosInfoTable.java \
        AltosKML.java \
+       AltosLanded.java \
        AltosLed.java \
        AltosLights.java \
        AltosLine.java \