summaryrefslogtreecommitdiff
path: root/altosui
diff options
context:
space:
mode:
authorBdale Garbee <bdale@gag.com>2015-07-16 13:36:59 -0600
committerBdale Garbee <bdale@gag.com>2015-07-16 13:36:59 -0600
commitf4f0f044df1251d64d44bf62d25b488fd04a05c8 (patch)
tree12efee1447a67d8cf37b6f447c011708264b8266 /altosui
parentb25690062ac04a588ad4d11740597c20e516eb1a (diff)
parent570daace9caf7647a09c53d5c75593cc4c98b93b (diff)
Merge branch 'branch-1.6' into debian
Diffstat (limited to 'altosui')
-rw-r--r--altosui/Altos.java4
-rw-r--r--altosui/AltosAscent.java4
-rw-r--r--altosui/AltosCompanionInfo.java4
-rw-r--r--altosui/AltosConfig.java4
-rw-r--r--altosui/AltosConfigPyroUI.java19
-rw-r--r--altosui/AltosConfigTD.java4
-rw-r--r--altosui/AltosConfigTDUI.java4
-rw-r--r--altosui/AltosConfigUI.java92
-rw-r--r--altosui/AltosConfigureUI.java2
-rw-r--r--altosui/AltosDescent.java4
-rw-r--r--altosui/AltosFlightStatus.java4
-rw-r--r--altosui/AltosFlightStatusTableModel.java2
-rw-r--r--altosui/AltosFlightStatusUpdate.java2
-rw-r--r--altosui/AltosFlightUI.java65
-rw-r--r--altosui/AltosGraphUI.java8
-rw-r--r--altosui/AltosIdleMonitorUI.java69
-rw-r--r--altosui/AltosIgniteUI.java64
-rw-r--r--altosui/AltosIgnitor.java4
-rw-r--r--altosui/AltosLanded.java4
-rw-r--r--altosui/AltosLaunch.java2
-rw-r--r--altosui/AltosLaunchUI.java2
-rw-r--r--altosui/AltosPad.java11
-rw-r--r--altosui/AltosUI.java17
-rw-r--r--altosui/altos-windows.nsi.in12
24 files changed, 206 insertions, 201 deletions
diff --git a/altosui/Altos.java b/altosui/Altos.java
index e82931b2..4b3d17fe 100644
--- a/altosui/Altos.java
+++ b/altosui/Altos.java
@@ -20,8 +20,8 @@ package altosui;
import java.awt.*;
import libaltosJNI.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class Altos extends AltosUILib {
diff --git a/altosui/AltosAscent.java b/altosui/AltosAscent.java
index 10080efd..453246bc 100644
--- a/altosui/AltosAscent.java
+++ b/altosui/AltosAscent.java
@@ -21,8 +21,8 @@ import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosAscent extends AltosUIFlightTab {
JLabel cur, max;
diff --git a/altosui/AltosCompanionInfo.java b/altosui/AltosCompanionInfo.java
index 68dab227..28f26a62 100644
--- a/altosui/AltosCompanionInfo.java
+++ b/altosui/AltosCompanionInfo.java
@@ -19,8 +19,8 @@ package altosui;
import java.awt.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosCompanionInfo extends JTable implements AltosFlightDisplay {
private AltosFlightInfoTableModel model;
diff --git a/altosui/AltosConfig.java b/altosui/AltosConfig.java
index 3c5415d2..39ed5ca4 100644
--- a/altosui/AltosConfig.java
+++ b/altosui/AltosConfig.java
@@ -22,8 +22,8 @@ import javax.swing.*;
import java.io.*;
import java.util.concurrent.*;
import java.text.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosConfig implements ActionListener {
diff --git a/altosui/AltosConfigPyroUI.java b/altosui/AltosConfigPyroUI.java
index 61208dfe..50a25f00 100644
--- a/altosui/AltosConfigPyroUI.java
+++ b/altosui/AltosConfigPyroUI.java
@@ -17,12 +17,13 @@
package altosui;
+import java.text.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosConfigPyroUI
extends AltosUIDialog
@@ -87,9 +88,9 @@ public class AltosConfigPyroUI
if (units != null) {
try {
- double v = units.parse(value.getText(), !imperial_units);
+ double v = units.parse_locale(value.getText(), !imperial_units);
set(enabled(), v);
- } catch (NumberFormatException ne) {
+ } catch (ParseException pe) {
set(enabled(), 0.0);
}
}
@@ -129,9 +130,9 @@ public class AltosConfigPyroUI
AltosUnits units = AltosPyro.pyro_to_units(flag);
try {
if (units != null)
- return units.parse(value.getText());
- return Double.parseDouble(value.getText());
- } catch (NumberFormatException e) {
+ return units.parse_locale(value.getText());
+ return AltosParse.parse_double_locale(value.getText());
+ } catch (ParseException e) {
throw new AltosConfigDataException("\"%s\": %s\n", value.getText(), e.getMessage());
}
}
@@ -298,8 +299,8 @@ public class AltosConfigPyroUI
String v = pyro_firing_time_value.getSelectedItem().toString();
try {
- return Double.parseDouble(v);
- } catch (NumberFormatException e) {
+ return AltosParse.parse_double_locale(v);
+ } catch (ParseException e) {
throw new AltosConfigDataException("Invalid pyro firing time \"%s\"", v);
}
}
diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java
index cd20a174..112ebbc6 100644
--- a/altosui/AltosConfigTD.java
+++ b/altosui/AltosConfigTD.java
@@ -21,8 +21,8 @@ import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosConfigTD implements ActionListener {
diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java
index 52225108..857ab64d 100644
--- a/altosui/AltosConfigTDUI.java
+++ b/altosui/AltosConfigTDUI.java
@@ -21,8 +21,8 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosConfigTDUI
extends AltosUIDialog
diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java
index 54f06065..76837b31 100644
--- a/altosui/AltosConfigUI.java
+++ b/altosui/AltosConfigUI.java
@@ -21,8 +21,9 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import java.text.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosConfigUI
extends AltosUIDialog
@@ -43,6 +44,7 @@ public class AltosConfigUI
JLabel rate_label;
JLabel aprs_interval_label;
JLabel aprs_ssid_label;
+ JLabel aprs_format_label;
JLabel flight_log_max_label;
JLabel ignite_mode_label;
JLabel pad_orientation_label;
@@ -66,6 +68,7 @@ public class AltosConfigUI
AltosUIRateList rate_value;
JComboBox<String> aprs_interval_value;
JComboBox<Integer> aprs_ssid_value;
+ JComboBox<String> aprs_format_value;
JComboBox<String> flight_log_max_value;
JComboBox<String> ignite_mode_value;
JComboBox<String> pad_orientation_value;
@@ -218,11 +221,20 @@ public class AltosConfigUI
void set_aprs_ssid_tool_tip() {
if (aprs_ssid_value.isEnabled())
- aprs_interval_value.setToolTipText("Set the APRS SSID (secondary station identifier)");
- else if (aprs_interval_value.isEnabled())
- aprs_interval_value.setToolTipText("Software version doesn't support setting the APRS SSID");
+ aprs_ssid_value.setToolTipText("Set the APRS SSID (secondary station identifier)");
+ else if (aprs_ssid_value.isEnabled())
+ aprs_ssid_value.setToolTipText("Software version doesn't support setting the APRS SSID");
else
- aprs_interval_value.setToolTipText("Hardware doesn't support APRS");
+ aprs_ssid_value.setToolTipText("Hardware doesn't support APRS");
+ }
+
+ void set_aprs_format_tool_tip() {
+ if (aprs_format_value.isEnabled())
+ aprs_format_value.setToolTipText("Set the APRS format (compressed/uncompressed)");
+ else if (aprs_format_value.isEnabled())
+ aprs_format_value.setToolTipText("Software version doesn't support setting the APRS format");
+ else
+ aprs_format_value.setToolTipText("Hardware doesn't support APRS");
}
void set_flight_log_max_tool_tip() {
@@ -577,6 +589,33 @@ public class AltosConfigUI
set_aprs_ssid_tool_tip();
row++;
+ /* APRS format */
+ c = new GridBagConstraints();
+ c.gridx = 0; c.gridy = row;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.LINE_START;
+ c.insets = il;
+ c.ipady = 5;
+ aprs_format_label = new JLabel("APRS format:");
+ pane.add(aprs_format_label, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 4; c.gridy = row;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1;
+ c.anchor = GridBagConstraints.LINE_START;
+ c.insets = ir;
+ c.ipady = 5;
+ aprs_format_value = new JComboBox<String>(AltosLib.ao_aprs_format_name);
+ aprs_format_value.setEditable(false);
+ aprs_format_value.addItemListener(this);
+ aprs_format_value.setMaximumRowCount(AltosLib.ao_aprs_format_name.length);
+ pane.add(aprs_format_value, c);
+ set_aprs_format_tool_tip();
+ row++;
+
/* Callsign */
c = new GridBagConstraints();
c.gridx = 0; c.gridy = row;
@@ -938,8 +977,13 @@ public class AltosConfigUI
}
- public int main_deploy() {
- return (int) (AltosConvert.height.parse(main_deploy_value.getSelectedItem().toString()) + 0.5);
+ public int main_deploy() throws AltosConfigDataException {
+ String str = main_deploy_value.getSelectedItem().toString();
+ try {
+ return (int) (AltosConvert.height.parse_locale(str) + 0.5);
+ } catch (ParseException pe) {
+ throw new AltosConfigDataException("invalid main deploy height %s", str);
+ }
}
String get_main_deploy_label() {
@@ -968,14 +1012,21 @@ public class AltosConfigUI
String v = main_deploy_value.getSelectedItem().toString();
main_deploy_label.setText(get_main_deploy_label());
set_main_deploy_values();
- int m = (int) (AltosConvert.height.parse(v, !imperial_units) + 0.5);
- set_main_deploy(m);
+ try {
+ int m = (int) (AltosConvert.height.parse_locale(v, !imperial_units) + 0.5);
+ set_main_deploy(m);
+ } catch (ParseException pe) {
+ }
if (tracker_motion_value.isEnabled()) {
String motion = tracker_motion_value.getSelectedItem().toString();
tracker_motion_label.setText(get_tracker_motion_label());
set_tracker_motion_values();
- set_tracker_motion((int) (AltosConvert.height.parse(motion, !imperial_units) + 0.5));
+ try {
+ int m = (int) (AltosConvert.height.parse_locale(motion, !imperial_units) + 0.5);
+ set_tracker_motion(m);
+ } catch (ParseException pe) {
+ }
}
if (!was_dirty)
@@ -1234,7 +1285,12 @@ public class AltosConfigUI
}
public int tracker_motion() throws AltosConfigDataException {
- return (int) AltosConvert.height.parse(tracker_motion_value.getSelectedItem().toString());
+ String str = tracker_motion_value.getSelectedItem().toString();
+ try {
+ return (int) (AltosConvert.height.parse_locale(str) + 0.5);
+ } catch (ParseException pe) {
+ throw new AltosConfigDataException("invalid tracker motion %s", str);
+ }
}
public void set_tracker_interval(int tracker_interval) {
@@ -1313,4 +1369,16 @@ public class AltosConfigUI
Integer i = (Integer) aprs_ssid_value.getSelectedItem();
return i;
}
+
+ public void set_aprs_format(int new_aprs_format) {
+ aprs_format_value.setVisible(new_aprs_format >= 0);
+ aprs_format_label.setVisible(new_aprs_format >= 0);
+
+ aprs_format_value.setSelectedIndex(Math.max(0,new_aprs_format));
+ set_aprs_format_tool_tip();
+ }
+
+ public int aprs_format() throws AltosConfigDataException {
+ return aprs_format_value.getSelectedIndex();
+ }
}
diff --git a/altosui/AltosConfigureUI.java b/altosui/AltosConfigureUI.java
index 7bc50570..fa815762 100644
--- a/altosui/AltosConfigureUI.java
+++ b/altosui/AltosConfigureUI.java
@@ -22,7 +22,7 @@ import java.awt.event.*;
import java.beans.*;
import javax.swing.*;
import javax.swing.event.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosConfigureUI
extends AltosUIConfigure
diff --git a/altosui/AltosDescent.java b/altosui/AltosDescent.java
index 0db1a4c2..f5b92816 100644
--- a/altosui/AltosDescent.java
+++ b/altosui/AltosDescent.java
@@ -21,8 +21,8 @@ import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosDescent extends AltosUIFlightTab {
diff --git a/altosui/AltosFlightStatus.java b/altosui/AltosFlightStatus.java
index c0d3312b..815a6fa4 100644
--- a/altosui/AltosFlightStatus.java
+++ b/altosui/AltosFlightStatus.java
@@ -19,8 +19,8 @@ package altosui;
import java.awt.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosFlightStatus extends JComponent implements AltosFlightDisplay {
GridBagLayout layout;
diff --git a/altosui/AltosFlightStatusTableModel.java b/altosui/AltosFlightStatusTableModel.java
index f2031698..b5587a84 100644
--- a/altosui/AltosFlightStatusTableModel.java
+++ b/altosui/AltosFlightStatusTableModel.java
@@ -27,7 +27,7 @@ import java.util.*;
import java.text.*;
import java.util.prefs.*;
import java.util.concurrent.LinkedBlockingQueue;
-import org.altusmetrum.altoslib_6.*;
+import org.altusmetrum.altoslib_8.*;
public class AltosFlightStatusTableModel extends AbstractTableModel {
private String[] columnNames = {
diff --git a/altosui/AltosFlightStatusUpdate.java b/altosui/AltosFlightStatusUpdate.java
index 3f6494b8..9768c6d1 100644
--- a/altosui/AltosFlightStatusUpdate.java
+++ b/altosui/AltosFlightStatusUpdate.java
@@ -18,7 +18,7 @@
package altosui;
import java.awt.event.*;
-import org.altusmetrum.altoslib_6.*;
+import org.altusmetrum.altoslib_8.*;
public class AltosFlightStatusUpdate implements ActionListener {
diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java
index 424c57da..db33e0d9 100644
--- a/altosui/AltosFlightUI.java
+++ b/altosui/AltosFlightUI.java
@@ -22,8 +22,8 @@ import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
AltosVoice voice;
@@ -40,7 +40,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
AltosDescent descent;
AltosLanded landed;
AltosCompanionInfo companion;
- AltosUIMap sitemap;
+ AltosUIMapNew sitemap;
boolean has_map;
boolean has_companion;
boolean has_state;
@@ -189,12 +189,12 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
bag = getContentPane();
bag.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
setTitle(String.format("AltOS %s", reader.name));
/* Stick channel selector at top of table for telemetry monitoring */
if (serial >= 0) {
+ set_inset(3);
+
// Frequency menu
frequencies = new AltosUIFreqList(AltosUIPreferences.frequency(serial));
frequencies.set_product("Monitor");
@@ -210,14 +210,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
reader.save_frequency();
}
});
- c.gridx = 0;
- c.gridy = 0;
- c.weightx = 0;
- c.weighty = 0;
- c.insets = new Insets(3, 3, 3, 3);
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- bag.add (frequencies, c);
+ bag.add (frequencies, constraints(0, 1));
// Telemetry rate list
rates = new AltosUIRateList(AltosUIPreferences.telemetry_rate(serial));
@@ -233,14 +226,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
}
});
rates.setEnabled(reader.supports_telemetry_rate(AltosLib.ao_telemetry_rate_2400));
- c.gridx = 1;
- c.gridy = 0;
- c.weightx = 0;
- c.weighty = 0;
- c.insets = new Insets(3, 3, 3, 3);
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- bag.add (rates, c);
+ bag.add (rates, constraints(1, 1));
// Telemetry format list
if (reader.supports_telemetry(Altos.ao_telemetry_standard)) {
@@ -252,14 +238,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
reader.save_telemetry();
}
});
- c.gridx = 2;
- c.gridy = 0;
- c.weightx = 0;
- c.weighty = 0;
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- bag.add (telemetries, c);
- c.insets = new Insets(0, 0, 0, 0);
+ bag.add (telemetries, constraints(2, 1));
} else {
String version;
@@ -271,26 +250,17 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
version = "Telemetry: None";
telemetry = new JLabel(version);
- c.gridx = 2;
- c.gridy = 0;
- c.weightx = 0;
- c.weighty = 0;
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- bag.add (telemetry, c);
- c.insets = new Insets(0, 0, 0, 0);
+ bag.add (telemetry, constraints(2, 1));
}
+ next_row();
}
+ set_inset(0);
/* Flight status is always visible */
flightStatus = new AltosFlightStatus();
displays.add(flightStatus);
- c.gridx = 0;
- c.gridy = 1;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 1;
- c.gridwidth = 3;
- bag.add(flightStatus, c);
+ bag.add(flightStatus, constraints(0, 4, GridBagConstraints.HORIZONTAL));
+ next_row();
/* The rest of the window uses a tabbed pane to
* show one of the alternate data views
@@ -319,17 +289,12 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
has_companion = false;
has_state = false;
- sitemap = new AltosUIMap();
+ sitemap = new AltosUIMapNew();
displays.add(sitemap);
has_map = false;
/* Make the tabbed pane use the rest of the window space */
- c.gridx = 0;
- c.gridy = 2;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1;
- c.weighty = 1;
- bag.add(pane, c);
+ bag.add(pane, constraints(0, 4, GridBagConstraints.BOTH));
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
diff --git a/altosui/AltosGraphUI.java b/altosui/AltosGraphUI.java
index f5e339a5..6e45a092 100644
--- a/altosui/AltosGraphUI.java
+++ b/altosui/AltosGraphUI.java
@@ -23,8 +23,8 @@ import java.util.ArrayList;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
@@ -35,7 +35,7 @@ public class AltosGraphUI extends AltosUIFrame implements AltosFontListener, Alt
JTabbedPane pane;
AltosGraph graph;
AltosUIEnable enable;
- AltosUIMap map;
+ AltosUIMapNew map;
AltosState state;
AltosGraphDataSet graphDataSet;
AltosFlightStats stats;
@@ -47,7 +47,7 @@ public class AltosGraphUI extends AltosUIFrame implements AltosFontListener, Alt
for (AltosState state : states) {
if (state.gps != null && state.gps.locked && state.gps.nsat >= 4) {
if (map == null)
- map = new AltosUIMap();
+ map = new AltosUIMapNew();
map.show(state, null);
has_gps = true;
}
diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java
index 204d81ed..d54b05c5 100644
--- a/altosui/AltosIdleMonitorUI.java
+++ b/altosui/AltosIdleMonitorUI.java
@@ -24,8 +24,8 @@ import javax.swing.event.*;
import java.io.*;
import java.util.concurrent.*;
import java.util.Arrays;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDisplay, AltosIdleMonitorListener, DocumentListener {
AltosDevice device;
@@ -35,9 +35,11 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
AltosFlightStatus flightStatus;
AltosIgnitor ignitor;
AltosIdleMonitor thread;
+ AltosUIMapNew sitemap;
int serial;
boolean remote;
boolean has_ignitor;
+ boolean has_map;
void stop_display() {
if (thread != null) {
@@ -83,11 +85,26 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
has_ignitor = false;
}
}
+ if (state.gps != null && state.gps.connected) {
+ if (!has_map) {
+ pane.add("Site Map", sitemap);
+ has_map = true;
+ }
+ } else {
+ if (has_map) {
+ pane.remove(sitemap);
+ has_map = false;
+ }
+ }
+
// try {
pad.show(state, listener_state);
flightStatus.show(state, listener_state);
flightInfo.show(state, listener_state);
- ignitor.show(state, listener_state);
+ if (has_ignitor)
+ ignitor.show(state, listener_state);
+ if (has_map)
+ sitemap.show(state, listener_state);
// } catch (Exception e) {
// System.out.print("Show exception " + e);
// }
@@ -119,6 +136,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
public void changedUpdate(DocumentEvent e) {
if (callsign_value != null) {
String callsign = callsign_value.getText();
+ System.out.printf("callsign set to %s\n", callsign);
thread.set_callsign(callsign);
AltosUIPreferences.set_callsign(callsign);
}
@@ -132,30 +150,6 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
changedUpdate(e);
}
- int row = 0;
-
- public GridBagConstraints constraints (int x, int width, int fill) {
- GridBagConstraints c = new GridBagConstraints();
- Insets insets = new Insets(4, 4, 4, 4);
-
- c.insets = insets;
- c.fill = fill;
- if (width == 3)
- c.anchor = GridBagConstraints.CENTER;
- else if (x == 2)
- c.anchor = GridBagConstraints.EAST;
- else
- c.anchor = GridBagConstraints.WEST;
- c.gridx = x;
- c.gridwidth = width;
- c.gridy = row;
- return c;
- }
-
- public GridBagConstraints constraints(int x, int width) {
- return constraints(x, width, GridBagConstraints.NONE);
- }
-
void idle_exception(JFrame owner, Exception e) {
if (e instanceof FileNotFoundException) {
JOptionPane.showMessageDialog(owner,
@@ -209,11 +203,14 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
AltosSerial link;
try {
link = new AltosSerial(device);
- link.set_frame(this);
} catch (Exception ex) {
idle_exception(in_owner, ex);
return;
}
+ link.set_frame(this);
+
+ /* We let the user set the freq/callsign, so don't bother with the cancel dialog */
+ link.set_cancel_enable(false);
bag = getContentPane();
bag.setLayout(new GridBagLayout());
@@ -222,6 +219,8 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
/* Stick frequency selector at top of table for telemetry monitoring */
if (remote && serial >= 0) {
+ set_inset(3);
+
// Frequency menu
frequencies = new AltosUIFreqList(AltosUIPreferences.frequency(serial));
frequencies.addActionListener(new ActionListener() {
@@ -238,15 +237,17 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
callsign_value = new JTextField(AltosUIPreferences.callsign());
callsign_value.getDocument().addDocumentListener(this);
callsign_value.setToolTipText("Callsign sent in packet mode");
- bag.add(callsign_value, constraints(2, 1, GridBagConstraints.BOTH));
- row++;
+ bag.add(callsign_value, constraints(2, 1, GridBagConstraints.HORIZONTAL));
+ next_row();
}
+ set_inset(0);
/* Flight status is always visible */
flightStatus = new AltosFlightStatus();
- bag.add(flightStatus, constraints(0, 3, GridBagConstraints.HORIZONTAL));
- row++;
+ bag.add(flightStatus, constraints(0, 4, GridBagConstraints.HORIZONTAL));
+
+ next_row();
/* The rest of the window uses a tabbed pane to
* show one of the alternate data views
@@ -261,8 +262,10 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
ignitor = new AltosIgnitor();
+ sitemap = new AltosUIMapNew();
+
/* Make the tabbed pane use the rest of the window space */
- bag.add(pane, constraints(0, 3, GridBagConstraints.BOTH));
+ bag.add(pane, constraints(0, 4, GridBagConstraints.BOTH));
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
diff --git a/altosui/AltosIgniteUI.java b/altosui/AltosIgniteUI.java
index 944c659b..14a2b606 100644
--- a/altosui/AltosIgniteUI.java
+++ b/altosui/AltosIgniteUI.java
@@ -24,8 +24,8 @@ import java.io.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosIgniteUI
extends AltosUIDialog
@@ -50,8 +50,6 @@ public class AltosIgniteUI
LinkedBlockingQueue<String> command_queue;
- LinkedBlockingQueue<String> reply_queue;
-
class Igniter {
JRadioButton button;
JLabel status_label;
@@ -150,8 +148,7 @@ public class AltosIgniteUI
}
reply = "status";
} else if (command.equals("get_npyro")) {
- put_reply(String.format("%d", ignite.npyro()));
- continue;
+ reply = String.format("npyro %d", ignite.npyro());
} else if (command.equals("quit")) {
ignite.close();
break;
@@ -211,6 +208,9 @@ public class AltosIgniteUI
set_ignite_status();
} else if (reply.equals("fired")) {
fired();
+ } else if (reply.startsWith("npyro")) {
+ npyro = Integer.parseInt(reply.substring(6));
+ make_ui();
}
}
@@ -250,24 +250,6 @@ public class AltosIgniteUI
}
}
- void put_reply(String reply) {
- try {
- reply_queue.put(reply);
- } catch (Exception ex) {
- ignite_exception(ex);
- }
- }
-
- String get_reply() {
- String reply = "";
- try {
- reply = reply_queue.take();
- } catch (Exception ex) {
- ignite_exception(ex);
- }
- return reply;
- }
-
boolean getting_status = false;
boolean visible = false;
@@ -287,12 +269,6 @@ public class AltosIgniteUI
}
}
- int get_npyro() {
- send_command("get_npyro");
- String reply = get_reply();
- return Integer.parseInt(reply);
- }
-
boolean firing = false;
void start_fire(String which) {
@@ -310,8 +286,9 @@ public class AltosIgniteUI
void close() {
if (opened) {
send_command("quit");
- timer.stop();
}
+ if (timer != null)
+ timer.stop();
setVisible(false);
dispose();
}
@@ -383,7 +360,6 @@ public class AltosIgniteUI
private boolean open() {
command_queue = new LinkedBlockingQueue<String>();
- reply_queue = new LinkedBlockingQueue<String>();
opened = false;
device = AltosDeviceUIDialog.show(owner, Altos.product_any);
@@ -403,13 +379,7 @@ public class AltosIgniteUI
return false;
}
- public AltosIgniteUI(JFrame in_owner) {
-
- owner = in_owner;
-
- if (!open())
- return;
-
+ private void make_ui() {
group = new ButtonGroup();
Container pane = getContentPane();
@@ -422,8 +392,6 @@ public class AltosIgniteUI
timer_running = false;
timer.restart();
- owner = in_owner;
-
pane.setLayout(new GridBagLayout());
c.fill = GridBagConstraints.NONE;
@@ -443,8 +411,6 @@ public class AltosIgniteUI
y++;
- int npyro = get_npyro();
-
igniters = new Igniter[2 + npyro];
igniters[0] = new Igniter(this, "Apogee", AltosIgnite.Apogee, y++);
@@ -492,4 +458,14 @@ public class AltosIgniteUI
addWindowListener(new ConfigListener(this));
}
-} \ No newline at end of file
+
+ public AltosIgniteUI(JFrame in_owner) {
+
+ owner = in_owner;
+
+ if (!open())
+ return;
+
+ send_command("get_npyro");
+ }
+}
diff --git a/altosui/AltosIgnitor.java b/altosui/AltosIgnitor.java
index 82582a28..682afc5e 100644
--- a/altosui/AltosIgnitor.java
+++ b/altosui/AltosIgnitor.java
@@ -20,8 +20,8 @@ package altosui;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosIgnitor extends AltosUIFlightTab {
diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java
index 2237df0c..c2997b29 100644
--- a/altosui/AltosLanded.java
+++ b/altosui/AltosLanded.java
@@ -21,8 +21,8 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosLanded extends AltosUIFlightTab implements ActionListener {
diff --git a/altosui/AltosLaunch.java b/altosui/AltosLaunch.java
index 37077c42..6dc1ca02 100644
--- a/altosui/AltosLaunch.java
+++ b/altosui/AltosLaunch.java
@@ -20,7 +20,7 @@ package altosui;
import java.io.*;
import java.util.concurrent.*;
import java.awt.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosLaunch {
AltosDevice device;
diff --git a/altosui/AltosLaunchUI.java b/altosui/AltosLaunchUI.java
index 4c205d44..132001bf 100644
--- a/altosui/AltosLaunchUI.java
+++ b/altosui/AltosLaunchUI.java
@@ -23,7 +23,7 @@ import javax.swing.*;
import java.io.*;
import java.text.*;
import java.util.concurrent.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altosuilib_8.*;
class FireButton extends JButton {
protected void processMouseEvent(MouseEvent e) {
diff --git a/altosui/AltosPad.java b/altosui/AltosPad.java
index 6214fa5a..2f87b681 100644
--- a/altosui/AltosPad.java
+++ b/altosui/AltosPad.java
@@ -18,8 +18,8 @@
package altosui;
import java.util.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosPad extends AltosUIFlightTab {
@@ -103,9 +103,12 @@ public class AltosPad extends AltosUIFlightTab {
public double voltage(AltosState state) { return AltosLib.MISSING; }
- public boolean hide(double v) { return v == AltosLib.MISSING; }
public double good() { return AltosLib.ao_battery_good; }
+ public boolean hide(AltosState state, AltosListenerState listener_state, int i) {
+ return value(state, listener_state, i) == AltosLib.MISSING;
+ }
+
public double value(AltosState state, AltosListenerState listener_state, int i) {
if (listener_state == null)
return AltosLib.MISSING;
@@ -243,12 +246,12 @@ public class AltosPad extends AltosUIFlightTab {
public AltosPad() {
int y = 0;
add(new Battery(this, y++));
+ add(new ReceiverBattery(this, y++));
add(new Apogee(this, y++));
add(new Main(this, y++));
add(new LoggingReady(this, y++));
add(new GPSLocked(this, y++));
add(new GPSReady(this, y++));
- add(new ReceiverBattery(this, y++));
add(new PadLat(this, y++));
add(new PadLon(this, y++));
add(new PadAlt(this, y++));
diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java
index 0af09651..f6caa4ef 100644
--- a/altosui/AltosUI.java
+++ b/altosui/AltosUI.java
@@ -22,8 +22,8 @@ import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_6.*;
-import org.altusmetrum.altosuilib_6.*;
+import org.altusmetrum.altoslib_8.*;
+import org.altusmetrum.altosuilib_8.*;
public class AltosUI extends AltosUIFrame {
public AltosVoice voice = new AltosVoice();
@@ -295,7 +295,7 @@ public class AltosUI extends AltosUIFrame {
}
void LoadMaps() {
- new AltosUIMapPreload(AltosUI.this);
+ new AltosUIMapPreloadNew(AltosUI.this);
}
void LaunchController() {
@@ -587,16 +587,7 @@ public class AltosUI extends AltosUIFrame {
for (int i = 0; i < args.length; i++) {
if (args[i].equals("--help"))
help(0);
- else if (args[i].equals("--fetchmaps")) {
- if (args.length < i + 3) {
- help(1);
- } else {
- double lat = Double.parseDouble(args[i+1]);
- double lon = Double.parseDouble(args[i+2]);
-// AltosSiteMap.prefetchMaps(lat, lon);
- i += 2;
- }
- } else if (args[i].equals("--replay"))
+ else if (args[i].equals("--replay"))
process = process_replay;
else if (args[i].equals("--kml"))
process = process_kml;
diff --git a/altosui/altos-windows.nsi.in b/altosui/altos-windows.nsi.in
index 6d4dabfa..2f22a4a3 100644
--- a/altosui/altos-windows.nsi.in
+++ b/altosui/altos-windows.nsi.in
@@ -103,16 +103,17 @@ Section "${REG_NAME} Application"
File "freetts.jar"
File "jfreechart.jar"
File "jcommon.jar"
+ File "../icon/${WIN_APP_EXE}"
File "*.dll"
File "../icon/${WIN_APP_ICON}"
- CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${WIN_APP_ICON}"
+ CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$INSTDIR\${WIN_APP_EXE}" "" "$INSTDIR\${WIN_APP_ICON}"
SectionEnd
Section "${REG_NAME} Desktop Shortcut"
- CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${WIN_APP_ICON}"
+ CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${WIN_APP_EXE}" "" "$INSTDIR\${WIN_APP_ICON}"
SectionEnd
Section "Firmware"
@@ -153,7 +154,6 @@ Section "File Associations"
SetOutPath $INSTDIR
- File "../icon/${WIN_APP_EXE}"
File "../icon/${WIN_TELEM_EXE}"
File "../icon/${WIN_EEPROM_EXE}"
@@ -165,15 +165,13 @@ Section "File Associations"
DeleteRegKey HKCR ".telem\${PROG_ID_EEPROM}"
DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_EEPROM}"
- SearchPath $1 "javaw.exe"
-
; .eeprom elements
WriteRegStr HKCR "${PROG_ID_EEPROM}" "" "Altus Metrum Log File"
WriteRegStr HKCR "${PROG_ID_EEPROM}" "FriendlyTypeName" "Altus Metrum Log File"
WriteRegStr HKCR "${PROG_ID_EEPROM}\CurVer" "" "${PROG_ID_EEPROM}"
WriteRegStr HKCR "${PROG_ID_EEPROM}\DefaultIcon" "" '"$INSTDIR\${WIN_EEPROM_EXE}",-101'
- WriteRegExpandStr HKCR "${PROG_ID_EEPROM}\shell\open\command" "" '"$1" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"'
+ WriteRegExpandStr HKCR "${PROG_ID_EEPROM}\shell\open\command" "" '"$INSTDIR\${WIN_APP_EXE}" "%1"'
WriteRegStr HKCR ".eeprom" "" "${PROG_ID_EEPROM}"
WriteRegStr HKCR ".eeprom" "PerceivedType" "Altus Metrum Log File"
@@ -188,7 +186,7 @@ Section "File Associations"
WriteRegStr HKCR "${PROG_ID_TELEM}" "FriendlyTypeName" "Altus Metrum Telemetry File"
WriteRegStr HKCR "${PROG_ID_TELEM}\CurVer" "" "${PROG_ID_TELEM}"
WriteRegStr HKCR "${PROG_ID_TELEM}\DefaultIcon" "" '"$INSTDIR\${WIN_TELEM_EXE}",-101'
- WriteRegExpandStr HKCR "${PROG_ID_TELEM}\shell\open\command" "" '"$1" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"'
+ WriteRegExpandStr HKCR "${PROG_ID_TELEM}\shell\open\command" "" '"$INSTDIR\${WIN_APP_EXE}" "%1"'
WriteRegStr HKCR ".telem" "" "${PROG_ID_TELEM}"
WriteRegStr HKCR ".telem" "PerceivedType" "Altus Metrum Telemetry File"