micropeak: Add command line export option
[fw/altos] / micropeak / MicroData.java
index 2afd3cd7b3c9240f5a1baf6134526aeeb1d13b4e..fdfb2dc4e67fef8354b2130eb69e0bfb25ba4d37 100644 (file)
@@ -221,6 +221,10 @@ public class MicroData {
                return alt;
        }
 
+       public double pressure(int i) {
+               return pressures[i];
+       }
+
        public double height(int i) {
                return altitude(i) - ground_altitude;
        }
@@ -259,6 +263,15 @@ public class MicroData {
                f.write('\n');
        }
 
+       public void export (Writer f) throws IOException {
+               PrintWriter     pw = new PrintWriter(f);
+               pw.printf("  Time, Press, Height,  Speed,  Accel\n");
+               for (MicroDataPoint point : points()) {
+                       pw.printf("%6.3f,%6.0f,%7.1f,%7.2f,%7.2f\n",
+                                 point.time, point.pressure, point.height, point.speed, point.accel);
+               }
+       }
+
        public void set_name(String name) {
                this.name = name;
        }