diff options
author | Keith Packard <keithp@keithp.com> | 2012-03-26 22:04:13 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-03-26 22:04:13 -0700 |
commit | 8610fdae8f47e1e8b6e8525227cc912664ecfafd (patch) | |
tree | 9c2091390470aaef033f695cac0937c5a3c960c0 /altosui/AltosFlightUI.java | |
parent | 392a3107b9e9cc8c1ea51df6ff5ec54817adbc65 (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/AltosFlightUI.java')
-rw-r--r-- | altosui/AltosFlightUI.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index d166c9ae..dcf85277 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -28,6 +28,21 @@ import java.text.*; import java.util.prefs.*; import java.util.concurrent.*; +class AltosFlightStatusUpdate implements ActionListener { + + public AltosState saved_state; + AltosFlightStatus flightStatus; + + public void actionPerformed (ActionEvent e) { + if (saved_state != null) + flightStatus.show(saved_state, 0); + } + + public AltosFlightStatusUpdate (AltosFlightStatus in_flightStatus) { + flightStatus = in_flightStatus; + } +} + public class AltosFlightUI extends AltosFrame implements AltosFlightDisplay, AltosFontListener { AltosVoice voice; AltosFlightReader reader; @@ -98,7 +113,11 @@ public class AltosFlightUI extends AltosFrame implements AltosFlightDisplay, Alt set_font(); } + + AltosFlightStatusUpdate status_update; + public void show(AltosState state, int crc_errors) { + status_update.saved_state = state; JComponent tab = which_tab(state); try { pad.show(state, crc_errors); @@ -151,6 +170,8 @@ public class AltosFlightUI extends AltosFrame implements AltosFlightDisplay, Alt AltosFreqList frequencies; JComboBox telemetries; + ActionListener show_timer; + public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) { AltosPreferences.set_component(this); @@ -289,6 +310,10 @@ public class AltosFlightUI extends AltosFrame implements AltosFlightDisplay, Alt thread = new AltosDisplayThread(this, voice, this, reader); + status_update = new AltosFlightStatusUpdate(flightStatus); + + new javax.swing.Timer(100, status_update).start(); + thread.start(); } |