projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Test commit (comment) to confirm push works
[fw/altos]
/
altosui
/
AltosAscent.java
diff --git
a/altosui/AltosAscent.java
b/altosui/AltosAscent.java
index d607b0c50aeff986137282c43fa4aeaef2e41da7..a158eb214d92ec33b4bec9c3597b5fb5f3c1630d 100644
(file)
--- a/
altosui/AltosAscent.java
+++ b/
altosui/AltosAscent.java
@@
-27,9
+27,11
@@
import java.util.*;
import java.text.*;
import java.util.prefs.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.text.*;
import java.util.prefs.*;
import java.util.concurrent.LinkedBlockingQueue;
+import org.altusmetrum.AltosLib.*;
public class AltosAscent extends JComponent implements AltosFlightDisplay {
GridBagLayout layout;
public class AltosAscent extends JComponent implements AltosFlightDisplay {
GridBagLayout layout;
+ JLabel cur, max;
public class AscentStatus {
JLabel label;
public class AscentStatus {
JLabel label;
@@
-54,6
+56,11
@@
public class AltosAscent extends JComponent implements AltosFlightDisplay {
lights.set(false);
}
lights.set(false);
}
+ void set_font() {
+ label.setFont(Altos.label_font);
+ value.setFont(Altos.value_font);
+ }
+
public AscentStatus (GridBagLayout layout, int y, String text) {
GridBagConstraints c = new GridBagConstraints();
c.weighty = 1;
public AscentStatus (GridBagLayout layout, int y, String text) {
GridBagConstraints c = new GridBagConstraints();
c.weighty = 1;
@@
-109,6
+116,11
@@
public class AltosAscent extends JComponent implements AltosFlightDisplay {
label.setVisible(false);
value.setVisible(false);
}
label.setVisible(false);
value.setVisible(false);
}
+ void set_font() {
+ label.setFont(Altos.label_font);
+ value.setFont(Altos.value_font);
+ }
+
public AscentValue (GridBagLayout layout, int y, String text) {
GridBagConstraints c = new GridBagConstraints();
c.weighty = 1;
public AscentValue (GridBagLayout layout, int y, String text) {
GridBagConstraints c = new GridBagConstraints();
c.weighty = 1;
@@
-151,14
+163,20
@@
public class AltosAscent extends JComponent implements AltosFlightDisplay {
max = AltosRecord.MISSING;
}
max = AltosRecord.MISSING;
}
- void show(String format, double v) {
+ void set_font() {
+ label.setFont(Altos.label_font);
+ value.setFont(Altos.value_font);
+ max_value.setFont(Altos.value_font);
+ }
+
+ void show(AltosUnits units, double v) {
if (v == AltosRecord.MISSING) {
value.setText("Missing");
max_value.setText("Missing");
} else {
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) {
if (v > max || max == AltosRecord.MISSING) {
- max_value.setText(
String.format(format
, v));
+ max_value.setText(
units.show(8
, v));
max = v;
}
}
max = v;
}
}
@@
-203,7
+221,7
@@
public class AltosAscent extends JComponent implements AltosFlightDisplay {
class Height extends AscentValueHold {
void show (AltosState state, int crc_errors) {
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");
}
public Height (GridBagLayout layout, int y) {
super (layout, y, "Height");
@@
-217,7
+235,7
@@
public class AltosAscent extends JComponent implements AltosFlightDisplay {
double speed = state.speed;
if (!state.ascent)
speed = state.baro_speed;
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");
}
public Speed (GridBagLayout layout, int y) {
super (layout, y, "Speed");
@@
-228,7
+246,7
@@
public class AltosAscent extends JComponent implements AltosFlightDisplay {
class Accel extends AscentValueHold {
void show (AltosState state, int crc_errors) {
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");
}
public Accel (GridBagLayout layout, int y) {
super (layout, y, "Acceleration");
@@
-314,6
+332,18
@@
public class AltosAscent extends JComponent implements AltosFlightDisplay {
accel.reset();
}
accel.reset();
}
+ public void set_font() {
+ cur.setFont(Altos.label_font);
+ max.setFont(Altos.label_font);
+ lat.set_font();
+ lon.set_font();
+ main.set_font();
+ apogee.set_font();
+ height.set_font();
+ speed.set_font();
+ accel.set_font();
+ }
+
public void show(AltosState state, int crc_errors) {
if (state.gps != null && state.gps.connected) {
lat.show(state, crc_errors);
public void show(AltosState state, int crc_errors) {
if (state.gps != null && state.gps.connected) {
lat.show(state, crc_errors);
@@
-337,7
+367,6
@@
public class AltosAscent extends JComponent implements AltosFlightDisplay {
public void labels(GridBagLayout layout, int y) {
GridBagConstraints c;
public void labels(GridBagLayout layout, int y) {
GridBagConstraints c;
- JLabel cur, max;
cur = new JLabel("Current");
cur.setFont(Altos.label_font);
cur = new JLabel("Current");
cur.setFont(Altos.label_font);