summaryrefslogtreecommitdiff
path: root/telegps/TeleGPSStatus.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-06-13 00:28:38 -0700
committerKeith Packard <keithp@keithp.com>2014-06-13 00:28:38 -0700
commita21dbb05fad2625d17bc2302faa96dc295e6ed7c (patch)
tree02c243bab5525fd591f6c8ad3fec52c6265c7650 /telegps/TeleGPSStatus.java
parent8cb41ce9a64029b611b3595c86a4a8e74b952ff4 (diff)
telegps: Show flight number in monitor window
This lets the user find the flight by number Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'telegps/TeleGPSStatus.java')
-rw-r--r--telegps/TeleGPSStatus.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/telegps/TeleGPSStatus.java b/telegps/TeleGPSStatus.java
index e6bb1ea5..14706877 100644
--- a/telegps/TeleGPSStatus.java
+++ b/telegps/TeleGPSStatus.java
@@ -108,6 +108,26 @@ public class TeleGPSStatus extends JComponent implements AltosFlightDisplay {
Serial serial;
+ class Flight extends Value {
+
+ int last_flight = -1;
+
+ void show(AltosState state, AltosListenerState listener_state) {
+ if (state.flight != last_flight) {
+ if (state.flight == AltosLib.MISSING)
+ value.setText("none");
+ else
+ value.setText(String.format("%d", state.flight));
+ last_flight = state.flight;
+ }
+ }
+ public Flight (GridBagLayout layout, int x) {
+ super (layout, x, "Flight");
+ }
+ }
+
+ Flight flight;
+
class RSSI extends Value {
int rssi = 10000;
@@ -152,6 +172,7 @@ public class TeleGPSStatus extends JComponent implements AltosFlightDisplay {
public void reset () {
call.reset();
serial.reset();
+ flight.reset();
rssi.reset();
last_packet.reset();
}
@@ -159,6 +180,7 @@ public class TeleGPSStatus extends JComponent implements AltosFlightDisplay {
public void font_size_changed(int font_size) {
call.set_font();
serial.set_font();
+ flight.set_font();
rssi.set_font();
last_packet.set_font();
}
@@ -169,6 +191,7 @@ public class TeleGPSStatus extends JComponent implements AltosFlightDisplay {
public void show (AltosState state, AltosListenerState listener_state) {
call.show(state, listener_state);
serial.show(state, listener_state);
+ flight.show(state, listener_state);
rssi.show(state, listener_state);
last_packet.show(state, listener_state);
}
@@ -185,6 +208,7 @@ public class TeleGPSStatus extends JComponent implements AltosFlightDisplay {
call = new Call(layout, 0);
serial = new Serial(layout, 1);
+ flight = new Flight(layout, 2);
rssi = new RSSI(layout, 4);
last_packet = new LastPacket(layout, 5);
}