altoslib: Reset transient AltosCalData values before processing data
[fw/altos] / altoslib / AltosTelemetryFile.java
index 0b0e6a484c18a077a0bcdecc95b3c425c1acd5a9..a4792f118938b4d0283954d7bd1d8ae8919bb158 100644 (file)
@@ -46,7 +46,7 @@ class AltosTelemetryNullListener extends AltosDataListener {
        public void set_accel(double along, double across, double through) { }
        public void set_mag(double along, double across, double through) { }
        public void set_pyro_voltage(double volts) { }
-       public void set_ignitor_voltage(double[] voltage) { }
+       public void set_igniter_voltage(double[] voltage) { }
        public void set_pyro_fired(int pyro_mask) { }
        public void set_companion(AltosCompanion companion) { }
 
@@ -78,7 +78,7 @@ class AltosTelemetryNullListener extends AltosDataListener {
                /*
                 * TelemetryLocation
                 */
-               if (AltosLib.has_gps(cal_data.device_type) && cal_data.gps_ground_altitude == AltosLib.MISSING)
+               if (AltosLib.has_gps(cal_data.device_type) && cal_data.gps_pad == null)
                        return false;
 
                return true;
@@ -111,7 +111,6 @@ public class AltosTelemetryFile implements AltosRecordSet {
                                if (l.cal_data_complete())
                                        break;
                        }
-                       System.out.printf("Telemetry boost tick %d\n", cal_data.boost_tick);
                }
                return cal_data;
        }
@@ -119,15 +118,21 @@ public class AltosTelemetryFile implements AltosRecordSet {
        public void capture_series(AltosDataListener listener) {
                AltosCalData    cal_data = cal_data();
 
+               cal_data.reset();
                for (AltosTelemetry telem : telems) {
                        int tick = telem.tick();
                        cal_data.set_tick(tick);
-                       if (cal_data.time() >= -1)
+
+                       /* Try to pick up at least one pre-boost value */
+                       if (cal_data.time() >= -2)
                                telem.provide_data(listener, cal_data);
+                       if (listener.state == AltosLib.ao_flight_landed)
+                               break;
                }
+               listener.finish();
        }
 
-       public AltosTelemetryFile(FileInputStream input) {
+       public AltosTelemetryFile(FileInputStream input) throws IOException {
                telems = new AltosTelemetryIterable(input);
        }
 }