summaryrefslogtreecommitdiff
path: root/altosui
diff options
context:
space:
mode:
Diffstat (limited to 'altosui')
-rw-r--r--altosui/AltosAscent.java36
-rw-r--r--altosui/AltosCompanionInfo.java2
-rw-r--r--altosui/AltosDescent.java48
-rw-r--r--altosui/AltosDisplayThread.java55
-rw-r--r--altosui/AltosFlightDisplay.java2
-rw-r--r--altosui/AltosFlightStatus.java38
-rw-r--r--altosui/AltosFlightStatusUpdate.java12
-rw-r--r--altosui/AltosFlightUI.java31
-rw-r--r--altosui/AltosGraphUI.java2
-rw-r--r--altosui/AltosIdleMonitorUI.java10
-rw-r--r--altosui/AltosInfoTable.java213
-rw-r--r--altosui/AltosLanded.java32
-rw-r--r--altosui/AltosPad.java199
-rw-r--r--altosui/AltosSiteMap.java6
-rw-r--r--altosui/AltosSiteMapTile.java2
15 files changed, 366 insertions, 322 deletions
diff --git a/altosui/AltosAscent.java b/altosui/AltosAscent.java
index 80a5b759..4da4d591 100644
--- a/altosui/AltosAscent.java
+++ b/altosui/AltosAscent.java
@@ -42,7 +42,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
label.setVisible(false);
}
- void show(AltosState state, int crc_errors) {}
+ void show(AltosState state, AltosListenerState listener_state) {}
void show(String s) {
show();
@@ -107,7 +107,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
public class AscentValue {
JLabel label;
JTextField value;
- void show(AltosState state, int crc_errors) {}
+ void show(AltosState state, AltosListenerState listener_state) {}
void reset() {
value.setText("");
@@ -174,7 +174,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
JTextField max_value;
double max;
- void show(AltosState state, int crc_errors) {}
+ void show(AltosState state, AltosListenerState listener_state) {}
void reset() {
value.setText("");
@@ -239,7 +239,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
class Height extends AscentValueHold {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show(AltosConvert.height, state.height);
}
public Height (GridBagLayout layout, int y) {
@@ -250,7 +250,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
Height height;
class Speed extends AscentValueHold {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
double speed = state.accel_speed;
if (!state.ascent)
speed = state.baro_speed;
@@ -264,7 +264,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
Speed speed;
class Accel extends AscentValueHold {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show(AltosConvert.accel, state.acceleration);
}
public Accel (GridBagLayout layout, int y) {
@@ -286,7 +286,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
}
class Apogee extends AscentStatus {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show("%4.2f V", state.drogue_sense);
lights.set(state.drogue_sense > 3.2);
}
@@ -298,7 +298,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
Apogee apogee;
class Main extends AscentStatus {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show("%4.2f V", state.main_sense);
lights.set(state.main_sense > 3.2);
}
@@ -310,7 +310,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
Main main;
class Lat extends AscentValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
if (state.gps != null)
show(pos(state.gps.lat,"N", "S"));
else
@@ -324,7 +324,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
Lat lat;
class Lon extends AscentValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
if (state.gps != null)
show(pos(state.gps.lon,"E", "W"));
else
@@ -359,25 +359,25 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
accel.set_font();
}
- public void show(AltosState state, int crc_errors) {
+ public void show(AltosState state, AltosListenerState listener_state) {
if (state.gps != null && state.gps.connected) {
- lat.show(state, crc_errors);
- lon.show(state, crc_errors);
+ lat.show(state, listener_state);
+ lon.show(state, listener_state);
} else {
lat.hide();
lon.hide();
}
- height.show(state, crc_errors);
+ height.show(state, listener_state);
if (state.main_sense != AltosRecord.MISSING)
- main.show(state, crc_errors);
+ main.show(state, listener_state);
else
main.hide();
if (state.drogue_sense != AltosRecord.MISSING)
- apogee.show(state, crc_errors);
+ apogee.show(state, listener_state);
else
apogee.hide();
- speed.show(state, crc_errors);
- accel.show(state, crc_errors);
+ speed.show(state, listener_state);
+ accel.show(state, listener_state);
}
public void labels(GridBagLayout layout, int y) {
diff --git a/altosui/AltosCompanionInfo.java b/altosui/AltosCompanionInfo.java
index 7dd36aec..ebe1d1f9 100644
--- a/altosui/AltosCompanionInfo.java
+++ b/altosui/AltosCompanionInfo.java
@@ -83,7 +83,7 @@ public class AltosCompanionInfo extends JTable {
}
}
- public void show(AltosState state, int crc_errors) {
+ public void show(AltosState state, AltosListenerState listener_state) {
if (state == null)
return;
if (state.data.companion != null)
diff --git a/altosui/AltosDescent.java b/altosui/AltosDescent.java
index 9838f46b..29d33ddc 100644
--- a/altosui/AltosDescent.java
+++ b/altosui/AltosDescent.java
@@ -29,7 +29,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
JTextField value;
AltosLights lights;
- abstract void show(AltosState state, int crc_errors);
+ abstract void show(AltosState state, AltosListenerState listener_state);
void show() {
label.setVisible(true);
@@ -108,7 +108,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
value.setText("");
}
- abstract void show(AltosState state, int crc_errors);
+ abstract void show(AltosState state, AltosListenerState listener_state);
void show() {
label.setVisible(true);
@@ -192,7 +192,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
value2.setFont(Altos.value_font);
}
- abstract void show(AltosState state, int crc_errors);
+ abstract void show(AltosState state, AltosListenerState listener_state);
void show(String v1, String v2) {
show();
@@ -244,7 +244,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
}
class Height extends DescentValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show(AltosConvert.height, state.height);
}
public Height (GridBagLayout layout, int x, int y) {
@@ -255,7 +255,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
Height height;
class Speed extends DescentValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
double speed = state.accel_speed;
if (!state.ascent)
speed = state.baro_speed;
@@ -280,7 +280,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
}
class Lat extends DescentValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
if (state.gps != null && state.gps.connected)
show(pos(state.gps.lat,"N", "S"));
else
@@ -294,7 +294,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
Lat lat;
class Lon extends DescentValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
if (state.gps != null && state.gps.connected)
show(pos(state.gps.lon,"W", "E"));
else
@@ -308,7 +308,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
Lon lon;
class Distance extends DescentValue {
- void show(AltosState state, int crc_errors) {
+ void show(AltosState state, AltosListenerState listener_state) {
if (state.from_pad != null)
show(AltosConvert.distance, state.from_pad.distance);
else
@@ -324,7 +324,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
class Apogee extends DescentStatus {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show("%4.2f V", state.drogue_sense);
lights.set(state.drogue_sense > 3.2);
}
@@ -336,7 +336,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
Apogee apogee;
class Main extends DescentStatus {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show("%4.2f V", state.main_sense);
lights.set(state.main_sense > 3.2);
}
@@ -348,7 +348,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
Main main;
class Bearing extends DescentDualValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
if (state.from_pad != null) {
show( String.format("%3.0f°", state.from_pad.bearing),
state.from_pad.bearing_words(
@@ -365,7 +365,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
Bearing bearing;
class Range extends DescentValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show(AltosConvert.distance, state.range);
}
public Range (GridBagLayout layout, int x, int y) {
@@ -376,7 +376,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
Range range;
class Elevation extends DescentValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show("%3.0f°", state.elevation);
}
public Elevation (GridBagLayout layout, int x, int y) {
@@ -412,16 +412,16 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
apogee.set_font();
}
- public void show(AltosState state, int crc_errors) {
- height.show(state, crc_errors);
- speed.show(state, crc_errors);
+ public void show(AltosState state, AltosListenerState listener_state) {
+ height.show(state, listener_state);
+ speed.show(state, listener_state);
if (state.gps != null && state.gps.connected) {
- bearing.show(state, crc_errors);
- range.show(state, crc_errors);
- distance.show(state, crc_errors);
- elevation.show(state, crc_errors);
- lat.show(state, crc_errors);
- lon.show(state, crc_errors);
+ bearing.show(state, listener_state);
+ range.show(state, listener_state);
+ distance.show(state, listener_state);
+ elevation.show(state, listener_state);
+ lat.show(state, listener_state);
+ lon.show(state, listener_state);
} else {
bearing.hide();
range.hide();
@@ -431,11 +431,11 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
lon.hide();
}
if (state.main_sense != AltosRecord.MISSING)
- main.show(state, crc_errors);
+ main.show(state, listener_state);
else
main.hide();
if (state.drogue_sense != AltosRecord.MISSING)
- apogee.show(state, crc_errors);
+ apogee.show(state, listener_state);
else
apogee.hide();
}
diff --git a/altosui/AltosDisplayThread.java b/altosui/AltosDisplayThread.java
index 6f8aa9ee..095bed99 100644
--- a/altosui/AltosDisplayThread.java
+++ b/altosui/AltosDisplayThread.java
@@ -29,21 +29,17 @@ public class AltosDisplayThread extends Thread {
IdleThread idle_thread;
AltosVoice voice;
AltosFlightReader reader;
- int crc_errors;
+ AltosState old_state, state;
+ AltosListenerState listener_state;
AltosFlightDisplay display;
- void show_internal(AltosState state, int crc_errors) {
- if (state != null)
- display.show(state, crc_errors);
- }
-
- void show_safely(AltosState in_state, int in_crc_errors) {
- final AltosState state = in_state;
- final int crc_errors = in_crc_errors;
+ synchronized void show_safely() {
+ final AltosState my_state = state;
+ final AltosListenerState my_listener_state = listener_state;
Runnable r = new Runnable() {
public void run() {
try {
- show_internal(state, crc_errors);
+ display.show(my_state, my_listener_state);
} catch (Exception ex) {
}
}
@@ -73,7 +69,6 @@ public class AltosDisplayThread extends Thread {
class IdleThread extends Thread {
boolean started;
- private AltosState state;
int reported_landing;
int report_interval;
long report_time;
@@ -129,7 +124,7 @@ public class AltosDisplayThread extends Thread {
++reported_landing;
if (state.state != Altos.ao_flight_landed) {
state.state = Altos.ao_flight_landed;
- show_safely(state, 0);
+ show_safely();
}
}
}
@@ -145,6 +140,10 @@ public class AltosDisplayThread extends Thread {
public void run () {
try {
for (;;) {
+ if (reader.has_monitor_battery()) {
+ listener_state.battery = reader.monitor_battery();
+ show_safely();
+ }
set_report_time();
for (;;) {
voice.drain();
@@ -155,6 +154,7 @@ public class AltosDisplayThread extends Thread {
wait(sleep_time);
}
}
+
report(false);
}
} catch (InterruptedException ie) {
@@ -164,18 +164,7 @@ public class AltosDisplayThread extends Thread {
}
}
- public synchronized void notice(AltosState new_state, boolean spoken) {
- AltosState old_state = state;
- state = new_state;
- if (!started && state.state > Altos.ao_flight_pad) {
- started = true;
- start();
- }
-
- if (state.state < Altos.ao_flight_drogue)
- report_interval = 10000;
- else
- report_interval = 20000;
+ public synchronized void notice(boolean spoken) {
if (old_state != null && old_state.state != state.state) {
report_time = now();
this.notify();
@@ -184,13 +173,12 @@ public class AltosDisplayThread extends Thread {
}
public IdleThread() {
- state = null;
reported_landing = 0;
report_interval = 10000;
}
}
- boolean tell(AltosState state, AltosState old_state) {
+ synchronized boolean tell() {
boolean ret = false;
if (old_state == null || old_state.state != state.state) {
voice.speak(state.data.state());
@@ -222,12 +210,10 @@ public class AltosDisplayThread extends Thread {
public void run() {
boolean interrupted = false;
- //String line;
- AltosState state = null;
- AltosState old_state = null;
boolean told;
idle_thread = new IdleThread();
+ idle_thread.start();
try {
for (;;) {
@@ -238,14 +224,14 @@ public class AltosDisplayThread extends Thread {
old_state = state;
state = new AltosState(record, state);
reader.update(state);
- show_safely(state, crc_errors);
- told = tell(state, old_state);
- idle_thread.notice(state, told);
+ show_safely();
+ told = tell();
+ idle_thread.notice(told);
} catch (ParseException pp) {
System.out.printf("Parse error: %d \"%s\"\n", pp.getErrorOffset(), pp.getMessage());
} catch (AltosCRCException ce) {
- ++crc_errors;
- show_safely(state, crc_errors);
+ ++listener_state.crc_errors;
+ show_safely();
}
}
} catch (InterruptedException ee) {
@@ -264,6 +250,7 @@ public class AltosDisplayThread extends Thread {
}
public AltosDisplayThread(Frame in_parent, AltosVoice in_voice, AltosFlightDisplay in_display, AltosFlightReader in_reader) {
+ listener_state = new AltosListenerState();
parent = in_parent;
voice = in_voice;
display = in_display;
diff --git a/altosui/AltosFlightDisplay.java b/altosui/AltosFlightDisplay.java
index d1ed7d2f..4f4c158e 100644
--- a/altosui/AltosFlightDisplay.java
+++ b/altosui/AltosFlightDisplay.java
@@ -22,7 +22,7 @@ import org.altusmetrum.altoslib_1.*;
public interface AltosFlightDisplay {
void reset();
- void show(AltosState state, int crc_errors);
+ void show(AltosState state, AltosListenerState listener_state);
void set_font();
}
diff --git a/altosui/AltosFlightStatus.java b/altosui/AltosFlightStatus.java
index 20539a9f..d2910414 100644
--- a/altosui/AltosFlightStatus.java
+++ b/altosui/AltosFlightStatus.java
@@ -28,7 +28,7 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
JLabel label;
JTextField value;
- void show(AltosState state, int crc_errors) {}
+ void show(AltosState state, AltosListenerState listener_state) {}
void reset() {
value.setText("");
@@ -64,7 +64,7 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
}
class Call extends FlightValue {
- void show(AltosState state, int crc_errors) {
+ void show(AltosState state, AltosListenerState listener_state) {
value.setText(state.data.callsign);
}
public Call (GridBagLayout layout, int x) {
@@ -75,8 +75,11 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
Call call;
class Serial extends FlightValue {
- void show(AltosState state, int crc_errors) {
- value.setText(String.format("%d", state.data.serial));
+ void show(AltosState state, AltosListenerState listener_state) {
+ if (state.data.serial == AltosRecord.MISSING)
+ value.setText("none");
+ else
+ value.setText(String.format("%d", state.data.serial));
}
public Serial (GridBagLayout layout, int x) {
super (layout, x, "Serial");
@@ -86,8 +89,11 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
Serial serial;
class Flight extends FlightValue {
- void show(AltosState state, int crc_errors) {
- value.setText(String.format("%d", state.data.flight));
+ void show(AltosState state, AltosListenerState listener_state) {
+ if (state.data.flight == AltosRecord.MISSING)
+ value.setText("none");
+ else
+ value.setText(String.format("%d", state.data.flight));
}
public Flight (GridBagLayout layout, int x) {
super (layout, x, "Flight");
@@ -97,7 +103,7 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
Flight flight;
class FlightState extends FlightValue {
- void show(AltosState state, int crc_errors) {
+ void show(AltosState state, AltosListenerState listener_state) {
value.setText(state.data.state());
}
public FlightState (GridBagLayout layout, int x) {
@@ -108,7 +114,7 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
FlightState flight_state;
class RSSI extends FlightValue {
- void show(AltosState state, int crc_errors) {
+ void show(AltosState state, AltosListenerState listener_state) {
value.setText(String.format("%d", state.data.rssi));
}
public RSSI (GridBagLayout layout, int x) {
@@ -119,7 +125,7 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
RSSI rssi;
class LastPacket extends FlightValue {
- void show(AltosState state, int crc_errors) {
+ void show(AltosState state, AltosListenerState listener_state) {
long secs = (System.currentTimeMillis() - state.report_time + 500) / 1000;
value.setText(String.format("%d", secs));
}
@@ -148,13 +154,13 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
last_packet.set_font();
}
- public void show (AltosState state, int crc_errors) {
- call.show(state, crc_errors);
- serial.show(state, crc_errors);
- flight.show(state, crc_errors);
- flight_state.show(state, crc_errors);
- rssi.show(state, crc_errors);
- last_packet.show(state, crc_errors);
+ public void show (AltosState state, AltosListenerState listener_state) {
+ call.show(state, listener_state);
+ serial.show(state, listener_state);
+ flight.show(state, listener_state);
+ flight_state.show(state, listener_state);
+ rssi.show(state, listener_state);
+ last_packet.show(state, listener_state);
}
public int height() {
diff --git a/altosui/AltosFlightStatusUpdate.java b/altosui/AltosFlightStatusUpdate.java
index bf679b85..962a08f7 100644
--- a/altosui/AltosFlightStatusUpdate.java
+++ b/altosui/AltosFlightStatusUpdate.java
@@ -22,12 +22,16 @@ import org.altusmetrum.altoslib_1.*;
public class AltosFlightStatusUpdate implements ActionListener {
- public AltosState saved_state;
- AltosFlightStatus flightStatus;
+ public AltosState saved_state;
+ public AltosListenerState saved_listener_state;
+ AltosFlightStatus flightStatus;
public void actionPerformed (ActionEvent e) {
- if (saved_state != null)
- flightStatus.show(saved_state, 0);
+ if (saved_state != null) {
+ if (saved_listener_state == null)
+ saved_listener_state = new AltosListenerState();
+ flightStatus.show(saved_state, saved_listener_state);
+ }
}
public AltosFlightStatusUpdate (AltosFlightStatus in_flightStatus) {
diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java
index c04a4357..6b258f2e 100644
--- a/altosui/AltosFlightUI.java
+++ b/altosui/AltosFlightUI.java
@@ -98,11 +98,15 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, A
AltosFlightStatusUpdate status_update;
- public void show(AltosState state, int crc_errors) {
+ public void show(AltosState state, AltosListenerState listener_state) {
status_update.saved_state = state;
- JComponent tab = which_tab(state);
- try {
- pad.show(state, crc_errors);
+
+ if (state == null) {
+ System.out.printf ("no state provided\n");
+ state = new AltosState(new AltosRecord());
+ }
+
+ pad.show(state, listener_state);
if (state.state != Altos.ao_flight_startup) {
if (!has_state) {
@@ -114,25 +118,26 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, A
}
}
- ascent.show(state, crc_errors);
- descent.show(state, crc_errors);
- landed.show(state, crc_errors);
+ ascent.show(state, listener_state);
+ descent.show(state, listener_state);
+ landed.show(state, listener_state);
+ JComponent tab = which_tab(state);
if (tab != cur_tab) {
if (cur_tab == pane.getSelectedComponent()) {
pane.setSelectedComponent(tab);
}
cur_tab = tab;
}
- flightStatus.show(state, crc_errors);
- flightInfo.show(state, crc_errors);
+ flightStatus.show(state, listener_state);
+ flightInfo.show(state, listener_state);
if (state.data.companion != null) {
if (!has_companion) {
pane.add("Companion", companion);
has_companion= true;
}
- companion.show(state, crc_errors);
+ companion.show(state, listener_state);
} else {
if (has_companion) {
pane.remove(companion);
@@ -144,17 +149,13 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, A
pane.add("Site Map", sitemap);
has_map = true;
}
- sitemap.show(state, crc_errors);
+ sitemap.show(state, listener_state);
} else {
if (has_map) {
pane.remove(sitemap);
has_map = false;
}
}
- } catch (Exception e) {
- System.out.print("Show exception " + e + "\n");
- e.printStackTrace();
- }
}
public void set_exit_on_close() {
diff --git a/altosui/AltosGraphUI.java b/altosui/AltosGraphUI.java
index f6e57e7e..d8b8f6dd 100644
--- a/altosui/AltosGraphUI.java
+++ b/altosui/AltosGraphUI.java
@@ -35,7 +35,7 @@ public class AltosGraphUI extends AltosUIFrame
if (state.gps != null && state.gps.locked && state.gps.nsat >= 4) {
if (map == null)
map = new AltosSiteMap();
- map.show(state, 0);
+ map.show(state, null);
has_gps = true;
}
}
diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java
index 8c883eeb..1ef30f0a 100644
--- a/altosui/AltosIdleMonitorUI.java
+++ b/altosui/AltosIdleMonitorUI.java
@@ -63,12 +63,12 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
AltosFlightStatusUpdate status_update;
- public void show(AltosState state, int crc_errors) {
+ public void show(AltosState state, AltosListenerState listener_state) {
status_update.saved_state = state;
try {
- pad.show(state, crc_errors);
- flightStatus.show(state, crc_errors);
- flightInfo.show(state, crc_errors);
+ pad.show(state, listener_state);
+ flightStatus.show(state, listener_state);
+ flightInfo.show(state, listener_state);
} catch (Exception e) {
System.out.print("Show exception" + e);
}
@@ -77,7 +77,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
public void update(final AltosState state) {
Runnable r = new Runnable() {
public void run() {
- show(state, 0);
+ show(state, null);
}
};
SwingUtilities.invokeLater(r);
diff --git a/altosui/AltosInfoTable.java b/altosui/AltosInfoTable.java
index 1dce6daf..3d16faf2 100644
--- a/altosui/AltosInfoTable.java
+++ b/altosui/AltosInfoTable.java
@@ -104,111 +104,118 @@ public class AltosInfoTable extends JTable {
model.clear();
}
- public void show(AltosState state, int crc_errors) {
- if (state == null)
- return;
+ public void show(AltosState state, AltosListenerState listener_state) {
info_reset();
- if (state.altitude != AltosRecord.MISSING)
- info_add_row(0, "Altitude", "%6.0f m", state.altitude);
- if (state.ground_altitude != AltosRecord.MISSING)
- info_add_row(0, "Pad altitude", "%6.0f m", state.ground_altitude);
- if (state.height != AltosRecord.MISSING)
- info_add_row(0, "Height", "%6.0f m", state.height);
- if (state.max_height != AltosRecord.MISSING)
- info_add_row(0, "Max height", "%6.0f m", state.max_height);
- if (state.acceleration != AltosRecord.MISSING)
- info_add_row(0, "Acceleration", "%8.1f m/s²", state.acceleration);
- if (state.max_acceleration != AltosRecord.MISSING)
- info_add_row(0, "Max acceleration", "%8.1f m/s²", state.max_acceleration);
- if (state.speed() != AltosRecord.MISSING)
- info_add_row(0, "Speed", "%8.1f m/s", state.speed());
- if (state.max_speed() != AltosRecord.MISSING)
- info_add_row(0, "Max Speed", "%8.1f m/s", state.max_accel_speed);
- if (state.temperature != AltosRecord.MISSING)
- info_add_row(0, "Temperature", "%9.2f °C", state.temperature);
- if (state.battery != AltosRecord.MISSING)
- info_add_row(0, "Battery", "%9.2f V", state.battery);
- if (state.drogue_sense != AltosRecord.MISSING)
- info_add_row(0, "Drogue", "%9.2f V", state.drogue_sense);
- if (state.main_sense != AltosRecord.MISSING)
- info_add_row(0, "Main", "%9.2f V", state.main_sense);
- info_add_row(0, "CRC Errors", "%6d", crc_errors);
-
- if (state.gps == null || !state.gps.connected) {
- info_add_row(1, "GPS", "not available");
- } else {
- if (state.gps_ready)
- info_add_row(1, "GPS state", "%s", "ready");
- else
- info_add_row(1, "GPS state", "wait (%d)",
- state.gps_waiting);
- if (state.data.gps.locked)
- info_add_row(1, "GPS", " locked");
- else if (state.data.gps.connected)
- info_add_row(1, "GPS", " unlocked");
- else
- info_add_row(1, "GPS", " missing");
- info_add_row(1, "Satellites", "%6d", state.data.gps.nsat);
- info_add_deg(1, "Latitude", state.gps.lat, 'N', 'S');
- info_add_deg(1, "Longitude", state.gps.lon, 'E', 'W');
- info_add_row(1, "GPS altitude", "%6d", state.gps.alt);
- info_add_row(1, "GPS height", "%6.0f", state.gps_height);
-
- /* The SkyTraq GPS doesn't report these values */
- /*
- if (false) {
- info_add_row(1, "GPS ground speed", "%8.1f m/s %3d°",
- state.gps.ground_speed,
- state.gps.course);
- info_add_row(1, "GPS climb rate", "%8.1f m/s",
- state.gps.climb_rate);
- info_add_row(1, "GPS error", "%6d m(h)%3d m(v)",
- state.gps.h_error, state.gps.v_error);
- }
- */
-
- info_add_row(1, "GPS hdop", "%8.1f", state.gps.hdop);
-
- if (state.npad > 0) {
- if (state.from_pad != null) {
- info_add_row(1, "Distance from pad", "%6d m",
- (int) (state.from_pad.distance + 0.5));
- info_add_row(1, "Direction from pad", "%6d°",
- (int) (state.from_pad.bearing + 0.5));
- info_add_row(1, "Elevation from pad", "%6d°",
- (int) (state.elevation + 0.5));
- info_add_row(1, "Range from pad", "%6d m",
- (int) (state.range + 0.5));
- } else {
- info_add_row(1, "Distance from pad", "unknown");
- info_add_row(1, "Direction from pad", "unknown");
- info_add_row(1, "Elevation from pad", "unknown");
- info_add_row(1, "Range from pad", "unknown");
+ if (state != null) {
+ if (state.altitude != AltosRecord.MISSING)
+ info_add_row(0, "Altitude", "%6.0f m", state.altitude);
+ if (state.ground_altitude != AltosRecord.MISSING)
+ info_add_row(0, "Pad altitude", "%6.0f m", state.ground_altitude);
+ if (state.height != AltosRecord.MISSING)
+ info_add_row(0, "Height", "%6.0f m", state.height);
+ if (state.height != AltosRecord.MISSING)
+ info_add_row(0, "Max height", "%6.0f m", state.max_height);
+ if (state.acceleration != AltosRecord.MISSING)
+ info_add_row(0, "Acceleration", "%8.1f m/s²", state.acceleration);
+ if (state.acceleration != AltosRecord.MISSING)
+ info_add_row(0, "Max acceleration", "%8.1f m/s²", state.max_acceleration);
+ if (state.speed() != AltosRecord.MISSING)
+ info_add_row(0, "Speed", "%8.1f m/s", state.speed());
+ if (state.speed() != AltosRecord.MISSING)
+ info_add_row(0, "Max Speed", "%8.1f m/s", state.max_accel_speed);
+ if (state.temperature != AltosRecord.MISSING)
+ info_add_row(0, "Temperature", "%9.2f °C", state.temperature);
+ if (state.battery != AltosRecord.MISSING)
+ info_add_row(0, "Battery", "%9.2f V", state.battery);
+ if (state.drogue_sense != AltosRecord.MISSING)
+ info_add_row(0, "Drogue", "%9.2f V", state.drogue_sense);
+ if (state.main_sense != AltosRecord.MISSING)
+ info_add_row(0, "Main", "%9.2f V", state.main_sense);
+ }
+ if (listener_state != null) {
+ info_add_row(0, "CRC Errors", "%6d", listener_state.crc_errors);
+
+ if (listener_state.battery != AltosRecord.MISSING)
+ info_add_row(0, "Receiver Battery", "%9.2f", listener_state.battery);
+ }
+
+ if (state != null) {
+ if (state.gps == null || !state.gps.connected) {
+ info_add_row(1, "GPS", "not available");
+ } else {
+ if (state.gps_ready)
+ info_add_row(1, "GPS state", "%s", "ready");
+ else
+ info_add_row(1, "GPS state", "wait (%d)",
+ state.gps_waiting);
+ if (state.data.gps.locked)
+ info_add_row(1, "GPS", " locked");
+ else if (state.data.gps.connected)
+ info_add_row(1, "GPS", " unlocked");
+ else
+ info_add_row(1, "GPS", " missing");
+ info_add_row(1, "Satellites", "%6d", state.data.gps.nsat);
+ info_add_deg(1, "Latitude", state.gps.lat, 'N', 'S');
+ info_add_deg(1, "Longitude", state.gps.lon, 'E', 'W');
+ info_add_row(1, "GPS altitude", "%6d", state.gps.alt);
+ info_add_row(1, "GPS height", "%6.0f", state.gps_height);
+
+ /* The SkyTraq GPS doesn't report these values */
+ /*
+ if (false) {
+ info_add_row(1, "GPS ground speed", "%8.1f m/s %3d°",
+ state.gps.ground_speed,
+ state.gps.course);
+ info_add_row(1, "GPS climb rate", "%8.1f m/s",
+ state.gps.climb_rate);
+ info_add_row(1, "GPS error", "%6d m(h)%3d m(v)",
+ state.gps.h_error, state.gps.v_error);
+ }
+ */
+
+ info_add_row(1, "GPS hdop", "%8.1f", state.gps.hdop);
+
+ if (state.npad > 0) {
+ if (state.from_pad != null) {
+ info_add_row(1, "Distance from pad", "%6d m",
+ (int) (state.from_pad.distance + 0.5));
+ info_add_row(1, "Direction from pad", "%6d°",
+ (int) (state.from_pad.bearing + 0.5));
+ info_add_row(1, "Elevation from pad", "%6d°",
+ (int) (state.elevation + 0.5));
+ info_add_row(1, "Range from pad", "%6d m",
+ (int) (state.range + 0.5));
+ } else {
+ info_add_row(1, "Distance from pad", "unknown");
+ info_add_row(1, "Direction from pad", "unknown");
+ info_add_row(1, "Elevation from pad", "unknown");
+ info_add_row(1, "Range from pad", "unknown");
+ }
+ info_add_deg(1, "Pad latitude", state.pad_lat, 'N', 'S');
+ info_add_deg(1, "Pad longitude", state.pad_lon, 'E', 'W');
+ info_add_row(1, "Pad GPS alt", "%6.0f m", state.pad_alt);
}
- info_add_deg(1, "Pad latitude", state.pad_lat, 'N', 'S');
- info_add_deg(1, "Pad longitude", state.pad_lon, 'E', 'W');
- info_add_row(1, "Pad GPS alt", "%6.0f m", state.pad_alt);
- }
- info_add_row(1, "GPS date", "%04d-%02d-%02d",
- state.gps.year,
- state.gps.month,
- state.gps.day);
- info_add_row(1, "GPS time", " %02d:%02d:%02d",
- state.gps.hour,
- state.gps.minute,
- state.gps.second);
- //int nsat_vis = 0;
- int c;
-
- if (state.gps.cc_gps_sat == null)
- info_add_row(2, "Satellites Visible", "%4d", 0);
- else {
- info_add_row(2, "Satellites Visible", "%4d", state.gps.cc_gps_sat.length);
- for (c = 0; c < state.gps.cc_gps_sat.length; c++) {
- info_add_row(2, "Satellite id,C/N0",
- "%4d, %4d",
- state.gps.cc_gps_sat[c].svid,
- state.gps.cc_gps_sat[c].c_n0);
+ info_add_row(1, "GPS date", "%04d-%02d-%02d",
+ state.gps.year,
+ state.gps.month,
+ state.gps.day);
+ info_add_row(1, "GPS time", " %02d:%02d:%02d",
+ state.gps.hour,
+ state.gps.minute,
+ state.gps.second);
+ //int nsat_vis = 0;
+ int c;
+
+ if (state.gps.cc_gps_sat == null)
+ info_add_row(2, "Satellites Visible", "%4d", 0);
+ else {
+ info_add_row(2, "Satellites Visible", "%4d", state.gps.cc_gps_sat.length);
+ for (c = 0; c < state.gps.cc_gps_sat.length; c++) {
+ info_add_row(2, "Satellite id,C/N0",
+ "%4d, %4d",
+ state.gps.cc_gps_sat[c].svid,
+ state.gps.cc_gps_sat[c].c_n0);
+ }
}
}
}
diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java
index a245dde3..1d209bda 100644
--- a/altosui/AltosLanded.java
+++ b/altosui/AltosLanded.java
@@ -29,7 +29,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
public class LandedValue {
JLabel label;
JTextField value;
- void show(AltosState state, int crc_errors) {}
+ void show(AltosState state, AltosListenerState listener_state) {}
void reset() {
value.setText("");
@@ -102,7 +102,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
}
class Lat extends LandedValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
if (state.gps != null && state.gps.connected)
show(pos(state.gps.lat,"N", "S"));
else
@@ -116,7 +116,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
Lat lat;
class Lon extends LandedValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show();
if (state.gps != null && state.gps.connected)
show(pos(state.gps.lon,"E", "W"));
@@ -131,7 +131,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
Lon lon;
class Bearing extends LandedValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show();
if (state.from_pad != null)
show("%3.0f°", state.from_pad.bearing);
@@ -146,7 +146,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
Bearing bearing;
class Distance extends LandedValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show();
if (state.from_pad != null)
show(AltosConvert.distance, state.from_pad.distance);
@@ -161,7 +161,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
Distance distance;
class Height extends LandedValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show(AltosConvert.height, state.max_height);
}
public Height (GridBagLayout layout, int y) {
@@ -172,7 +172,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
Height height;
class Speed extends LandedValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show(AltosConvert.speed, state.max_speed());
}
public Speed (GridBagLayout layout, int y) {
@@ -183,7 +183,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
Speed speed;
class Accel extends LandedValue {
- void show (AltosState state, int crc_errors) {
+ void show (AltosState state, AltosListenerState listener_state) {
show(AltosConvert.accel, state.max_acceleration);
}
public Accel (GridBagLayout layout, int y) {
@@ -213,21 +213,21 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
accel.set_font();
}
- public void show(AltosState state, int crc_errors) {
+ public void show(AltosState state, AltosListenerState listener_state) {
if (state.gps != null && state.gps.connected) {
- bearing.show(state, crc_errors);
- distance.show(state, crc_errors);
- lat.show(state, crc_errors);
- lon.show(state, crc_errors);
+ bearing.show(state, listener_state);
+ distance.show(state, listener_state);
+ lat.show(state, listener_state);
+ lon.show(state, listener_state);
} else {
bearing.hide();
distance.hide();
lat.hide();
lon.hide();
}
- height.show(state, crc_errors);
- speed.show(state, crc_errors);
- accel.show(state, crc_errors);
+ height.show(state, listener_state);
+ speed.show(state, listener_state);
+ accel.show(state, listener_state);
if (reader.backing_file() != null)
graph.setEnabled(true);
}
diff --git a/altosui/AltosPad.java b/altosui/AltosPad.java
index eb08525c..e2316a13 100644
--- a/altosui/AltosPad.java
+++ b/altosui/AltosPad.java
@@ -29,7 +29,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
JTextField value;
AltosLights lights;
- void show(AltosState state, int crc_errors) {}
+ void show(AltosState state, AltosListenerState listener_state) {}
void reset() {
value.setText("");
@@ -109,7 +109,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
public class LaunchValue {
JLabel label;
JTextField value;
- void show(AltosState state, int crc_errors) {}
+ void show(AltosState state, AltosListenerState listener_state) {}
void show() {
label.setVisible(true);
@@ -175,8 +175,8 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
}
class Battery extends LaunchStatus {
- void show (AltosState state, int crc_errors) {
- if (state.battery == AltosRecord.MISSING)
+ void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null || state.battery == AltosRecord.MISSING)
hide();
else {
show("%4.2f V", state.battery);
@@ -191,9 +191,13 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
Battery battery;
class Apogee extends LaunchStatus {
- void show (AltosState state, int crc_errors) {
- show("%4.2f V", state.drogue_sense);
- lights.set(state.drogue_sense > 3.2);
+ void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null || state.drogue_sense == AltosRecord.MISSING)
+ hide();
+ else {
+ show("%4.2f V", state.drogue_sense);
+ lights.set(state.drogue_sense > 3.2);
+ }
}
public Apogee (GridBagLayout layout, int y) {
super(layout, y, "Apogee Igniter Voltage");
@@ -203,9 +207,13 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
Apogee apogee;
class Main extends LaunchStatus {
- void show (AltosState state, int crc_errors) {
- show("%4.2f V", state.main_sense);
- lights.set(state.main_sense > 3.2);
+ void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null || state.main_sense == AltosRecord.MISSING)
+ hide();
+ else {
+ show("%4.2f V", state.main_sense);
+ lights.set(state.main_sense > 3.2);
+ }
}
public Main (GridBagLayout layout, int y) {
super(layout, y, "Main Igniter Voltage");
@@ -215,18 +223,21 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
Main main;
class LoggingReady extends LaunchStatus {
- void show (AltosState state, int crc_errors) {
- if (state.data.flight != 0) {
- if (state.data.state <= Altos.ao_flight_pad)
- show("Ready to record");
- else if (state.data.state < Altos.ao_flight_landed)
- show("Recording data");
- else
- show("Recorded data");
+ void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null || state.data.flight == AltosRecord.MISSING) {
+ hide();
+ } else {
+ if (state.data.flight != 0) {
+ if (state.data.state <= Altos.ao_flight_pad)
+ show("Ready to record");
+ else if (state.data.state < Altos.ao_flight_landed)
+ show("Recording data");
+ else
+ show("Recorded data");
+ } else
+ show("Storage full");
+ lights.set(state.data.flight != 0);
}
- else
- show("Storage full");
- lights.set(state.data.flight != 0);
}
public LoggingReady (GridBagLayout layout, int y) {
super(layout, y, "On-board Data Logging");
@@ -236,9 +247,13 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
LoggingReady logging_ready;
class GPSLocked extends LaunchStatus {
- void show (AltosState state, int crc_errors) {
- show("%4d sats", state.gps.nsat);
- lights.set(state.gps.locked && state.gps.nsat >= 4);
+ void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null || state.gps == null)
+ hide();
+ else {
+ show("%4d sats", state.gps.nsat);
+ lights.set(state.gps.locked && state.gps.nsat >= 4);
+ }
}
public GPSLocked (GridBagLayout layout, int y) {
super (layout, y, "GPS Locked");
@@ -248,12 +263,16 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
GPSLocked gps_locked;
class GPSReady extends LaunchStatus {
- void show (AltosState state, int crc_errors) {
- if (state.gps_ready)
- show("Ready");
- else
- show("Waiting %d", state.gps_waiting);
- lights.set(state.gps_ready);
+ void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null || state.gps == null)
+ hide();
+ else {
+ if (state.gps_ready)
+ show("Ready");
+ else
+ show("Waiting %d", state.gps_waiting);
+ lights.set(state.gps_ready);
+ }
}
public GPSReady (GridBagLayout layout, int y) {
super (layout, y, "GPS Ready");
@@ -262,6 +281,22 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
GPSReady gps_ready;
+ class ReceiverBattery extends LaunchStatus {
+ void show (AltosState state, AltosListenerState listener_state) {
+ if (listener_state == null || listener_state.battery == AltosRecord.MISSING)
+ hide();
+ else {
+ show("%4.2f V", listener_state.battery);
+ lights.set(listener_state.battery > 3.7);
+ }
+ }
+ public ReceiverBattery (GridBagLayout layout, int y) {
+ super(layout, y, "Receiver Battery");
+ }
+ }
+
+ ReceiverBattery receiver_battery;
+
String pos(double p, String pos, String neg) {
String h = pos;
if (p < 0) {
@@ -274,13 +309,17 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
}
class PadLat extends LaunchValue {
- void show (AltosState state, int crc_errors) {
- if (state.state < AltosLib.ao_flight_pad && state.gps != null) {
- show(pos(state.gps.lat,"N", "S"));
- set_label("Latitude");
- } else {
- show(pos(state.pad_lat,"N", "S"));
- set_label("Pad Latitude");
+ void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null || state.gps == null) {
+ hide();
+ } else {
+ if (state.state < AltosLib.ao_flight_pad) {
+ show(pos(state.gps.lat,"N", "S"));
+ set_label("Latitude");
+ } else {
+ show(pos(state.pad_lat,"N", "S"));
+ set_label("Pad Latitude");
+ }
}
}
public PadLat (GridBagLayout layout, int y) {
@@ -291,13 +330,17 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
PadLat pad_lat;
class PadLon extends LaunchValue {
- void show (AltosState state, int crc_errors) {
- if (state.state < AltosLib.ao_flight_pad && state.gps != null) {
- show(pos(state.gps.lon,"E", "W"));
- set_label("Longitude");
- } else {
- show(pos(state.pad_lon,"E", "W"));
- set_label("Pad Longitude");
+ void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null || state.gps == null) {
+ hide();
+ } else {
+ if (state.state < AltosLib.ao_flight_pad) {
+ show(pos(state.gps.lon,"E", "W"));
+ set_label("Longitude");
+ } else {
+ show(pos(state.pad_lon,"E", "W"));
+ set_label("Pad Longitude");
+ }
}
}
public PadLon (GridBagLayout layout, int y) {
@@ -308,16 +351,20 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
PadLon pad_lon;
class PadAlt extends LaunchValue {
- void show (AltosState state, int crc_errors) {
- if (state.state < AltosLib.ao_flight_pad && state.gps != null) {
- show("%4.0f m", state.gps.alt);
- set_label("Altitude");
- } else {
- if (state.pad_alt == AltosRecord.MISSING)
- hide();
- else {
- show("%4.0f m", state.pad_alt);
- set_label("Pad Altitude");
+ void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null)
+ hide();
+ else {
+ if (state.state < AltosLib.ao_flight_pad && state.gps != null) {
+ show("%4.0f m", state.gps.alt);
+ set_label("Altitude");
+ } else {
+ if (state.pad_alt == AltosRecord.MISSING)
+ hide();
+ else {
+ show("%4.0f m", state.pad_alt);
+ set_label("Pad Altitude");
+ }
}
}
}
@@ -335,6 +382,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
logging_ready.reset();
gps_locked.reset();
gps_ready.reset();
+ receiver_battery.reset();
pad_lat.reset();
pad_lon.reset();
pad_alt.reset();
@@ -347,34 +395,23 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
logging_ready.set_font();
gps_locked.set_font();
gps_ready.set_font();
+ receiver_battery.set_font();
pad_lat.set_font();
pad_lon.set_font();
pad_alt.set_font();
}
- public void show(AltosState state, int crc_errors) {
- battery.show(state, crc_errors);
- if (state.drogue_sense == AltosRecord.MISSING)
- apogee.hide();
- else
- apogee.show(state, crc_errors);
- if (state.main_sense == AltosRecord.MISSING)
- main.hide();
- else
- main.show(state, crc_errors);
- logging_ready.show(state, crc_errors);
- pad_alt.show(state, crc_errors);
- if (state.gps != null && state.gps.connected) {
- gps_locked.show(state, crc_errors);
- gps_ready.show(state, crc_errors);
- pad_lat.show(state, crc_errors);
- pad_lon.show(state, crc_errors);
- } else {
- gps_locked.hide();
- gps_ready.hide();
- pad_lat.hide();
- pad_lon.hide();
- }
+ public void show(AltosState state, AltosListenerState listener_state) {
+ battery.show(state, listener_state);
+ apogee.show(state, listener_state);
+ main.show(state, listener_state);
+ logging_ready.show(state, listener_state);
+ pad_alt.show(state, listener_state);
+ receiver_battery.show(state, listener_state);
+ gps_locked.show(state, listener_state);
+ gps_ready.show(state, listener_state);
+ pad_lat.show(state, listener_state);
+ pad_lon.show(state, listener_state);
}
public AltosPad() {
@@ -398,8 +435,10 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
logging_ready = new LoggingReady(layout, 3);
gps_locked = new GPSLocked(layout, 4);
gps_ready = new GPSReady(layout, 5);
- pad_lat = new PadLat(layout, 6);
- pad_lon = new PadLon(layout, 7);
- pad_alt = new PadAlt(layout, 8);
+ receiver_battery = new ReceiverBattery(layout, 6);
+ pad_lat = new PadLat(layout, 7);
+ pad_lon = new PadLon(layout, 8);
+ pad_alt = new PadAlt(layout, 9);
+ show(null, null);
}
}
diff --git a/altosui/AltosSiteMap.java b/altosui/AltosSiteMap.java
index f614eae6..5bf02e54 100644
--- a/altosui/AltosSiteMap.java
+++ b/altosui/AltosSiteMap.java
@@ -264,7 +264,7 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
initMaps(lat, lon);
scrollRocketToVisible(pt(lat, lon));
}
- public void show(final AltosState state, final int crc_errors) {
+ public void show(final AltosState state, final AltosListenerState listener_state) {
// if insufficient gps data, nothing to update
if (!state.gps.locked && state.gps.nsat < 4)
return;
@@ -294,7 +294,7 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
Point2D.Double ref, lref;
ref = translatePoint(pt, tileCoordOffset(offset));
lref = translatePoint(last_pt, tileCoordOffset(offset));
- tile.show(state, crc_errors, lref, ref);
+ tile.show(state, listener_state, lref, ref);
if (0 <= ref.x && ref.x < px_size)
if (0 <= ref.y && ref.y < px_size)
in_any = true;
@@ -307,7 +307,7 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
lref = translatePoint(last_pt, tileCoordOffset(offset));
AltosSiteMapTile tile = createTile(offset);
- tile.show(state, crc_errors, lref, ref);
+ tile.show(state, listener_state, lref, ref);
initMap(offset);
finishTileLater(tile, offset);
}
diff --git a/altosui/AltosSiteMapTile.java b/altosui/AltosSiteMapTile.java
index 10e65bcd..365e4b6c 100644
--- a/altosui/AltosSiteMapTile.java
+++ b/altosui/AltosSiteMapTile.java
@@ -56,7 +56,7 @@ public class AltosSiteMapTile extends JLayeredPane {
private boolean drawn_landed_circle = false;
private boolean drawn_boost_circle = false;
- public synchronized void show(AltosState state, int crc_errors,
+ public synchronized void show(AltosState state, AltosListenerState listener_state,
Point2D.Double last_pt, Point2D.Double pt)
{
if (0 <= state.state && state.state < stateColors.length) {