boolean last_reported;
double ground_pres;
- double ground_accel;
int n_pad_samples;
if (last_reported)
return null;
last_reported = true;
- return new AltosRecord(state);
+ AltosRecord r = new AltosRecord(state);
+ r.time = (r.tick - boost_tick) / 100.0;
+ return r;
}
record = record_iterator.next();
ground_pres += state.pres;
state.ground_pres = (int) (ground_pres / n_pad_samples);
state.flight_pres = state.ground_pres;
- ground_accel += state.accel;
- state.ground_accel = (int) (ground_accel / n_pad_samples);
- state.flight_accel = state.ground_accel;
} else {
state.flight_pres = (state.flight_pres * 15 + state.pres) / 16;
state.flight_accel = (state.flight_accel * 15 + state.accel) / 16;
tick = record.tick;
if (record.cmd == Altos.AO_LOG_FLIGHT) {
state.ground_accel = record.a;
+ state.flight_accel = record.a;
state.flight = record.b;
boost_tick = tick;
seen |= seen_flight;
}
}
records.add(record);
+
+ /* Bail after reading the 'landed' record; we're all done */
+ if (record.cmd == Altos.AO_LOG_STATE &&
+ record.a == Altos.ao_flight_landed)
+ break;
}
} catch (IOException io) {
} catch (ParseException pe) {