summaryrefslogtreecommitdiff
path: root/altosui/AltosLanded.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-03-24 05:27:57 +0900
committerKeith Packard <keithp@keithp.com>2011-03-24 05:27:57 +0900
commitf3e68341f6f5daaf26dd162e4f9a06c29988986a (patch)
tree2590305c2cc5677f190ae89f4d7ce61005d96544 /altosui/AltosLanded.java
parent1e976a105423f2da1842f70da531c9051ba88a7f (diff)
altosui: Add support for telemetry version 4
New telemetry format needed to support TeleNano and TeleMini Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosLanded.java')
-rw-r--r--altosui/AltosLanded.java31
1 files changed, 27 insertions, 4 deletions
diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java
index d34efe6d..0717ffe2 100644
--- a/altosui/AltosLanded.java
+++ b/altosui/AltosLanded.java
@@ -42,10 +42,22 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay {
value.setText("");
}
+ void show() {
+ label.show();
+ value.show();
+ }
+
+ void hide() {
+ label.hide();
+ value.hide();
+ }
+
void show(String format, double v) {
+ show();
value.setText(String.format(format, v));
}
+
public LandedValue (GridBagLayout layout, int y, String text) {
GridBagConstraints c = new GridBagConstraints();
c.weighty = 1;
@@ -86,6 +98,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay {
class Lat extends LandedValue {
void show (AltosState state, int crc_errors) {
+ show();
if (state.gps != null)
value.setText(pos(state.gps.lat,"N", "S"));
else
@@ -100,6 +113,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay {
class Lon extends LandedValue {
void show (AltosState state, int crc_errors) {
+ show();
if (state.gps != null)
value.setText(pos(state.gps.lon,"E", "W"));
else
@@ -114,6 +128,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay {
class Bearing extends LandedValue {
void show (AltosState state, int crc_errors) {
+ show();
if (state.from_pad != null)
show("%3.0f°", state.from_pad.bearing);
else
@@ -128,6 +143,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay {
class Distance extends LandedValue {
void show (AltosState state, int crc_errors) {
+ show();
if (state.from_pad != null)
show("%6.0f m", state.from_pad.distance);
else
@@ -184,10 +200,17 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay {
}
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);
+ if (state.gps != null) {
+ bearing.show(state, crc_errors);
+ distance.show(state, crc_errors);
+ lat.show(state, crc_errors);
+ lon.show(state, crc_errors);
+ } else {
+ bearing.hide();
+ distance.hide();
+ lat.hide();
+ lon.hide();
+ }
height.show(state, crc_errors);
speed.show(state, crc_errors);
accel.show(state, crc_errors);