altos/stm32f4: Align stack to 8 bytes
[fw/altos] / micropeak / MicroExport.java
index 219184da9472cb9de1cdd446371d2cc041609f26..a98140ba5970ed1dd86a20d2aa087564cd501d81 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -23,14 +24,20 @@ import java.util.ArrayList;
 import java.awt.*;
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
-import org.altusmetrum.AltosLib.*;
-import org.altusmetrum.altosuilib.*;
+import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altosuilib_13.*;
 
 public class MicroExport extends JFileChooser {
 
        JFrame          frame;
        MicroData       data;
 
+       public static void export(File file, MicroData data) throws FileNotFoundException, IOException {
+               FileWriter fw = new FileWriter(file);
+               data.export(fw);
+               fw.close();
+       }
+
        public boolean runDialog() {
                int     ret;
 
@@ -76,14 +83,7 @@ public class MicroExport extends JFileChooser {
                                }
                        }
                        try {
-                               FileWriter fw = new FileWriter(file);
-                               PrintWriter pw = new PrintWriter(fw);
-                               pw.printf("  Time, Press, Height,  Speed,  Accel\n");
-                               for (MicroDataPoint point : data.points()) {
-                                       pw.printf("%6.3f,%6.0f,%7.1f,%7.2f,%7.2f\n",
-                                                 point.time, point.pressure, point.height, point.speed, point.accel);
-                               }
-                               fw.close();
+                               export(file, data);
                                return true;
                        } catch (FileNotFoundException fe) {
                                JOptionPane.showMessageDialog(frame,