X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosDataPointReader.java;h=c3aabb0c674721299d5202bfa0b0d5bb131db1a9;hp=7704310b6f676ba9e3abfb5eae0a7ee6a9e6e2e6;hb=c3314dae2d3df82e188daf6ba8520cce833592c6;hpb=f01096c4b42f9a4720ed0414826c2a283a992545 diff --git a/altosui/AltosDataPointReader.java b/altosui/AltosDataPointReader.java index 7704310b..c3aabb0c 100644 --- a/altosui/AltosDataPointReader.java +++ b/altosui/AltosDataPointReader.java @@ -14,10 +14,18 @@ class AltosDataPointReader implements Iterable { Iterator iter; AltosState state; AltosRecord record; + boolean has_gps; + boolean has_accel; + boolean has_ignite; - public AltosDataPointReader(Iterable reader) { + final static int MISSING = AltosRecord.MISSING; + + public AltosDataPointReader(AltosRecordIterable reader) { this.iter = reader.iterator(); this.state = null; + has_accel = reader.has_accel(); + has_gps = reader.has_gps(); + has_ignite = reader.has_ignite(); } private void read_next_record() @@ -44,13 +52,14 @@ class AltosDataPointReader implements Iterable { public double acceleration() { return record.acceleration(); } public double pressure() { return record.raw_pressure(); } public double altitude() { return record.raw_altitude(); } - public double height() { return record.raw_height(); } + public double height() { return record.raw_height(); } public double accel_speed() { return record.accel_speed(); } public double baro_speed() { return state.baro_speed; } public double temperature() { return record.temperature(); } public double battery_voltage() { return record.battery_voltage(); } public double drogue_voltage() { return record.drogue_voltage(); } public double main_voltage() { return record.main_voltage(); } + public boolean has_accel() { return has_accel; } }; } @@ -60,10 +69,14 @@ class AltosDataPointReader implements Iterable { throw new UnsupportedOperationException(); } public boolean hasNext() { + if (record != null && record.state == Altos.ao_flight_landed) + return false; return iter.hasNext(); } public AltosDataPoint next() { - read_next_record(); + do { + read_next_record(); + } while (record.time < -1.0 && hasNext()); return current_dp(); } };