summaryrefslogtreecommitdiff
path: root/altosui/AltosFlightStatus.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-26 22:04:13 -0700
committerKeith Packard <keithp@keithp.com>2012-03-26 22:04:13 -0700
commit8610fdae8f47e1e8b6e8525227cc912664ecfafd (patch)
tree9c2091390470aaef033f695cac0937c5a3c960c0 /altosui/AltosFlightStatus.java
parent392a3107b9e9cc8c1ea51df6ff5ec54817adbc65 (diff)
altosui: Show time since last packet in flight status window
Makes it easy to see when the UI is wedged, and when telemetry data are being successfully received. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosFlightStatus.java')
-rw-r--r--altosui/AltosFlightStatus.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/altosui/AltosFlightStatus.java b/altosui/AltosFlightStatus.java
index ed273384..45e55b4b 100644
--- a/altosui/AltosFlightStatus.java
+++ b/altosui/AltosFlightStatus.java
@@ -119,18 +119,31 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
value.setText(String.format("%d", state.data.rssi));
}
public RSSI (GridBagLayout layout, int x) {
- super (layout, x, "RSSI (dBm)");
+ super (layout, x, "RSSI");
}
}
RSSI rssi;
+ class LastPacket extends FlightValue {
+ void show(AltosState state, int crc_errors) {
+ long secs = (System.currentTimeMillis() - state.report_time + 500) / 1000;
+ value.setText(String.format("%d", secs));
+ }
+ public LastPacket(GridBagLayout layout, int x) {
+ super (layout, x, "Age");
+ }
+ }
+
+ LastPacket last_packet;
+
public void reset () {
call.reset();
serial.reset();
flight.reset();
flight_state.reset();
rssi.reset();
+ last_packet.reset();
}
public void set_font () {
@@ -139,6 +152,7 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
flight.set_font();
flight_state.set_font();
rssi.set_font();
+ last_packet.set_font();
}
public void show (AltosState state, int crc_errors) {
@@ -147,6 +161,7 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
flight.show(state, crc_errors);
flight_state.show(state, crc_errors);
rssi.show(state, crc_errors);
+ last_packet.show(state, crc_errors);
}
public int height() {
@@ -164,5 +179,6 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
flight = new Flight(layout, 2);
flight_state = new FlightState(layout, 3);
rssi = new RSSI(layout, 4);
+ last_packet = new LastPacket(layout, 5);
}
}