projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altosui: Find actual landing time when computing stats (trac #23)
[fw/altos]
/
altosui
/
AltosUI.java
diff --git
a/altosui/AltosUI.java
b/altosui/AltosUI.java
index 13cda63746488fa3f6669be9e29ca20fbf49db71..89f66c0604521bf89e3de6c10d25586345bd2658 100644
(file)
--- a/
altosui/AltosUI.java
+++ b/
altosui/AltosUI.java
@@
-30,7
+30,7
@@
import java.util.concurrent.*;
import libaltosJNI.*;
import libaltosJNI.*;
-public class AltosUI extends
J
Frame {
+public class AltosUI extends
Altos
Frame {
public AltosVoice voice = new AltosVoice();
public static boolean load_library(Frame frame) {
public AltosVoice voice = new AltosVoice();
public static boolean load_library(Frame frame) {
@@
-52,8
+52,7
@@
public class AltosUI extends JFrame {
new AltosFlightUI(voice, reader, device.getSerial());
} catch (FileNotFoundException ee) {
JOptionPane.showMessageDialog(AltosUI.this,
new AltosFlightUI(voice, reader, device.getSerial());
} catch (FileNotFoundException ee) {
JOptionPane.showMessageDialog(AltosUI.this,
- String.format("Cannot open device \"%s\"",
- device.toShortString()),
+ ee.getMessage(),
"Cannot open target device",
JOptionPane.ERROR_MESSAGE);
} catch (AltosSerialInUseException si) {
"Cannot open target device",
JOptionPane.ERROR_MESSAGE);
} catch (AltosSerialInUseException si) {
@@
-123,50
+122,56
@@
public class AltosUI extends JFrame {
ConnectToDevice();
}
});
ConnectToDevice();
}
});
+ b.setToolTipText("Connect to TeleDongle and monitor telemetry");
b = addButton(1, 0, "Save Flight Data");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SaveFlightData();
}
});
b = addButton(1, 0, "Save Flight Data");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SaveFlightData();
}
});
+ b.setToolTipText("Download and/or delete flight data from an altimeter");
b = addButton(2, 0, "Replay Flight");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Replay();
}
});
b = addButton(2, 0, "Replay Flight");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Replay();
}
});
+ b.setToolTipText("Watch an old flight in real-time");
b = addButton(3, 0, "Graph Data");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GraphData();
}
});
b = addButton(3, 0, "Graph Data");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GraphData();
}
});
+ b.setToolTipText("Present flight data in a graph and table of statistics");
b = addButton(4, 0, "Export Data");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ExportData();
}
});
b = addButton(4, 0, "Export Data");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ExportData();
}
});
+ b.setToolTipText("Convert flight data for a spreadsheet or GoogleEarth");
b = addButton(0, 1, "Configure Altimeter");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ConfigureTeleMetrum();
}
});
b = addButton(0, 1, "Configure Altimeter");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ConfigureTeleMetrum();
}
});
-
+ b.setToolTipText("Set flight, storage and communication parameters");
b = addButton(1, 1, "Configure AltosUI");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ConfigureAltosUI();
}
});
b = addButton(1, 1, "Configure AltosUI");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ConfigureAltosUI();
}
});
-
+ b.setToolTipText("Global AltosUI settings");
b = addButton(2, 1, "Flash Image");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FlashImage();
}
});
b = addButton(2, 1, "Flash Image");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FlashImage();
}
});
+ b.setToolTipText("Replace the firmware in any AltusMetrum product");
b = addButton(3, 1, "Fire Igniter");
b.addActionListener(new ActionListener() {
b = addButton(3, 1, "Fire Igniter");
b.addActionListener(new ActionListener() {
@@
-174,35
+179,42
@@
public class AltosUI extends JFrame {
FireIgniter();
}
});
FireIgniter();
}
});
-
+ b.setToolTipText("Remote control of igniters for deployment testing");
b = addButton(4, 1, "Quit");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
b = addButton(4, 1, "Quit");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
-
-
+ b.setToolTipText("Close all active windows and terminate AltosUI");
b = addButton(0, 2, "Scan Channels");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ScanChannels();
}
});
b = addButton(0, 2, "Scan Channels");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ScanChannels();
}
});
-
+ b.setToolTipText("Find what channel an altimeter is sending telemetry on");
b = addButton(1, 2, "Load Maps");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
LoadMaps();
}
});
b = addButton(1, 2, "Load Maps");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
LoadMaps();
}
});
-
+ b.setToolTipText("Download satellite images for off-line flight monitoring");
b = addButton(2, 2, "Monitor Idle");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
IdleMonitor();
}
});
b = addButton(2, 2, "Monitor Idle");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
IdleMonitor();
}
});
+ b.setToolTipText("Check flight readiness of altimeter in idle mode");
+
+ b = addButton(3, 2, "Launch Controller");
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ LaunchController();
+ }
+ });
setTitle("AltOS");
setTitle("AltOS");
@@
-266,6
+278,10
@@
public class AltosUI extends JFrame {
new AltosSiteMapPreload(AltosUI.this);
}
new AltosSiteMapPreload(AltosUI.this);
}
+ void LaunchController() {
+ new AltosLaunchUI(AltosUI.this);
+ }
+
/*
* Replay a flight from telemetry data
*/
/*
* Replay a flight from telemetry data
*/
@@
-339,7
+355,7
@@
public class AltosUI extends JFrame {
else
return new AltosTelemetryIterable(in);
} catch (FileNotFoundException fe) {
else
return new AltosTelemetryIterable(in);
} catch (FileNotFoundException fe) {
- System.out.printf("
Cannot open '%s'\n", filename
);
+ System.out.printf("
%s\n", fe.getMessage()
);
return null;
}
}
return null;
}
}
@@
-349,7
+365,7
@@
public class AltosUI extends JFrame {
try {
return new AltosCSV(file);
} catch (FileNotFoundException fe) {
try {
return new AltosCSV(file);
} catch (FileNotFoundException fe) {
- System.out.printf("
Cannot open '%s'\n", filename
);
+ System.out.printf("
%s\n", fe.getMessage()
);
return null;
}
}
return null;
}
}
@@
-359,7
+375,7
@@
public class AltosUI extends JFrame {
try {
return new AltosKML(file);
} catch (FileNotFoundException fe) {
try {
return new AltosKML(file);
} catch (FileNotFoundException fe) {
- System.out.printf("
Cannot open '%s'\n", filename
);
+ System.out.printf("
%s\n", fe.getMessage()
);
return null;
}
}
return null;
}
}
@@
-407,17
+423,17
@@
public class AltosUI extends JFrame {
}
}
}
}
- static AltosRecordIterable record_iterable
_file(String filenam
e) {
+ static AltosRecordIterable record_iterable
(File fil
e) {
FileInputStream in;
try {
FileInputStream in;
try {
- in = new FileInputStream(file
name
);
+ in = new FileInputStream(file);
} catch (Exception e) {
} catch (Exception e) {
- System.out.printf("Failed to open file '%s'\n", file
name
);
+ System.out.printf("Failed to open file '%s'\n", file);
return null;
}
AltosRecordIterable recs;
AltosReplayReader reader;
return null;
}
AltosRecordIterable recs;
AltosReplayReader reader;
- if (file
name
.endsWith("eeprom")) {
+ if (file
.getName()
.endsWith("eeprom")) {
recs = new AltosEepromIterable(in);
} else {
recs = new AltosTelemetryIterable(in);
recs = new AltosEepromIterable(in);
} else {
recs = new AltosTelemetryIterable(in);
@@
-425,6
+441,10
@@
public class AltosUI extends JFrame {
return recs;
}
return recs;
}
+ static AltosRecordIterable record_iterable_file(String filename) {
+ return record_iterable (new File(filename));
+ }
+
static AltosReplayReader replay_file(String filename) {
AltosRecordIterable recs = record_iterable_file(filename);
if (recs == null)
static AltosReplayReader replay_file(String filename) {
AltosRecordIterable recs = record_iterable_file(filename);
if (recs == null)
@@
-450,9
+470,9
@@
public class AltosUI extends JFrame {
}
static void process_summary(String filename) {
}
static void process_summary(String filename) {
- AltosRe
playReader reader = replay
_file(filename);
+ AltosRe
cordIterable iterable = record_iterable
_file(filename);
try {
try {
- AltosFlightStats stats = new AltosFlightStats(
reader
);
+ AltosFlightStats stats = new AltosFlightStats(
iterable
);
if (stats.serial > 0)
System.out.printf("Serial: %5d\n", stats.serial);
if (stats.flight > 0)
if (stats.serial > 0)
System.out.printf("Serial: %5d\n", stats.serial);
if (stats.flight > 0)
@@
-502,6
+522,10
@@
public class AltosUI extends JFrame {
}
public static void main(final String[] args) {
}
public static void main(final String[] args) {
+ try {
+ UIManager.setLookAndFeel(AltosPreferences.look_and_feel());
+ } catch (Exception e) {
+ }
/* Handle batch-mode */
if (args.length == 0) {
AltosUI altosui = new AltosUI();
/* Handle batch-mode */
if (args.length == 0) {
AltosUI altosui = new AltosUI();