- Speed speed;
-
- class Accel extends LandedValue {
- void show (AltosState state, int crc_errors) {
- show("%6.0f m/s²", state.max_acceleration);
- }
- public Accel (GridBagLayout layout, int y) {
- super (layout, y, "Maximum Acceleration");
+ JButton graph;
+ AltosFlightReader reader;
+
+ public void actionPerformed(ActionEvent e) {
+ String cmd = e.getActionCommand();
+
+ if (cmd.equals("graph")) {
+ File file = reader.backing_file();
+ if (file != null) {
+ String filename = file.getName();
+ try {
+ AltosStateIterable states = null;
+ if (filename.endsWith("eeprom")) {
+ FileInputStream in = new FileInputStream(file);
+ states = new AltosEepromFile(in);
+ } else if (filename.endsWith("telem")) {
+ FileInputStream in = new FileInputStream(file);
+ states = new AltosTelemetryFile(in);
+ } else {
+ throw new FileNotFoundException(filename);
+ }
+ try {
+ new AltosGraphUI(states, file);
+ } catch (InterruptedException ie) {
+ } catch (IOException ie) {
+ }
+ } catch (FileNotFoundException fe) {
+ JOptionPane.showMessageDialog(null,
+ fe.getMessage(),
+ "Cannot open file",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }