Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
[fw/altos] / altosui / AltosAscent.java
index 38b3b30fe8cec9ee6ccd79306b0696fd5add6cc9..de6c90a1098e97a9503860f82e22971b4ef1637f 100644 (file)
@@ -15,7 +15,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package altosui;
+package AltosUI;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -169,14 +169,14 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
                        max_value.setFont(Altos.value_font);
                }
 
-               void show(String format, double v) {
+               void show(AltosUnits units, double v) {
                        if (v == AltosRecord.MISSING) {
                                value.setText("Missing");
                                max_value.setText("Missing");
                        } else {
-                               value.setText(String.format(format, v));
+                               value.setText(units.show(8, v));
                                if (v > max || max == AltosRecord.MISSING) {
-                                       max_value.setText(String.format(format, v));
+                                       max_value.setText(units.show(8, v));
                                        max = v;
                                }
                        }
@@ -221,7 +221,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
 
        class Height extends AscentValueHold {
                void show (AltosState state, int crc_errors) {
-                       show("%6.0f m", state.height);
+                       show(AltosConvert.height, state.height);
                }
                public Height (GridBagLayout layout, int y) {
                        super (layout, y, "Height");
@@ -235,7 +235,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
                        double speed = state.speed;
                        if (!state.ascent)
                                speed = state.baro_speed;
-                       show("%6.0f m/s", speed);
+                       show(AltosConvert.speed, speed);
                }
                public Speed (GridBagLayout layout, int y) {
                        super (layout, y, "Speed");
@@ -246,7 +246,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
 
        class Accel extends AscentValueHold {
                void show (AltosState state, int crc_errors) {
-                       show("%6.0f m/s²", state.acceleration);
+                       show(AltosConvert.accel, state.acceleration);
                }
                public Accel (GridBagLayout layout, int y) {
                        super (layout, y, "Acceleration");