summaryrefslogtreecommitdiff
path: root/altosui
diff options
context:
space:
mode:
Diffstat (limited to 'altosui')
-rw-r--r--altosui/AltosConfigPyroUI.java19
-rw-r--r--altosui/AltosConfigTD.java12
-rw-r--r--altosui/AltosPad.java35
3 files changed, 45 insertions, 21 deletions
diff --git a/altosui/AltosConfigPyroUI.java b/altosui/AltosConfigPyroUI.java
index dd4fb505..64336c8e 100644
--- a/altosui/AltosConfigPyroUI.java
+++ b/altosui/AltosConfigPyroUI.java
@@ -285,9 +285,13 @@ public class AltosConfigPyroUI
"0.050", "0.100", "0.250", "0.500", "1.0", "2.0"
};
+ boolean initializing;
+
public void set_pyro_firing_time(double new_pyro_firing_time) {
+ initializing = true;
pyro_firing_time_value.setSelectedItem(Double.toString(new_pyro_firing_time));
pyro_firing_time_value.setEnabled(new_pyro_firing_time >= 0);
+ initializing = false;
}
public double get_pyro_firing_time() throws AltosConfigDataException {
@@ -301,23 +305,28 @@ public class AltosConfigPyroUI
}
public void set_dirty() {
- owner.set_dirty();
+ if (!initializing)
+ owner.set_dirty();
}
public void itemStateChanged(ItemEvent e) {
- owner.set_dirty();
+ if (!initializing)
+ owner.set_dirty();
}
public void changedUpdate(DocumentEvent e) {
- owner.set_dirty();
+ if (!initializing)
+ owner.set_dirty();
}
public void insertUpdate(DocumentEvent e) {
- owner.set_dirty();
+ if (!initializing)
+ owner.set_dirty();
}
public void removeUpdate(DocumentEvent e) {
- owner.set_dirty();
+ if (!initializing)
+ owner.set_dirty();
}
public void units_changed(boolean imperial_units) {
diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java
index 4389e49b..9020ed9d 100644
--- a/altosui/AltosConfigTD.java
+++ b/altosui/AltosConfigTD.java
@@ -223,8 +223,10 @@ public class AltosConfigTD implements ActionListener {
if (!config_version.get().equals("0.0"))
break;
been_there = true;
- config.serial_line.printf("C\n ");
- config.serial_line.flush_input();
+ if (config != null && config.serial_line != null) {
+ config.serial_line.printf("C\n ");
+ config.serial_line.flush_input();
+ }
}
} catch (InterruptedException ie) {
}
@@ -277,8 +279,10 @@ public class AltosConfigTD implements ActionListener {
}
void abort() {
- serial_line.close();
- serial_line = null;
+ if (serial_line != null) {
+ serial_line.close();
+ serial_line = null;
+ }
JOptionPane.showMessageDialog(owner,
String.format("Connection to \"%s\" failed",
device.toShortString()),
diff --git a/altosui/AltosPad.java b/altosui/AltosPad.java
index 5c33fd16..eb0c5644 100644
--- a/altosui/AltosPad.java
+++ b/altosui/AltosPad.java
@@ -117,6 +117,17 @@ public class AltosPad extends AltosUIFlightTab {
}
}
+ boolean report_pad(AltosState state) {
+ if ((state.state == AltosLib.ao_flight_stateless ||
+ state.state < AltosLib.ao_flight_pad) &&
+ state.gps != null &&
+ state.gps.lat != AltosLib.MISSING)
+ {
+ return false;
+ }
+ return true;
+ }
+
class PadLat extends AltosUIIndicator {
double last_lat = AltosLib.MISSING - 1;
@@ -126,12 +137,12 @@ public class AltosPad extends AltosUIFlightTab {
String label = null;
if (state != null) {
- if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.lat != AltosLib.MISSING) {
- lat = state.gps.lat;
- label = "Latitude";
- } else {
+ if (report_pad(state)) {
lat = state.pad_lat;
label = "Pad Latitude";
+ } else {
+ lat = state.gps.lat;
+ label = "Latitude";
}
}
if (lat != last_lat) {
@@ -163,12 +174,12 @@ public class AltosPad extends AltosUIFlightTab {
String label = null;
if (state != null) {
- if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.lon != AltosLib.MISSING) {
- lon = state.gps.lon;
- label = "Longitude";
- } else {
+ if (report_pad(state)) {
lon = state.pad_lon;
label = "Pad Longitude";
+ } else {
+ lon = state.gps.lon;
+ label = "Longitude";
}
}
if (lon != last_lon) {
@@ -200,12 +211,12 @@ public class AltosPad extends AltosUIFlightTab {
String label = null;
if (state != null) {
- if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.alt != AltosLib.MISSING) {
- alt = state.gps.alt;
- label = "Altitude";
- } else {
+ if (report_pad(state)) {
alt = state.pad_alt;
label = "Pad Altitude";
+ } else {
+ alt = state.gps.alt;
+ label = "Altitude";
}
}
if (alt != last_alt) {