Don't wait for the flight computer to have detected boost--that's
often several samples after boost actually occurred, which can leave a
bunch of acceleration out of the speed computation.
Signed-off-by: Keith Packard <keithp@keithp.com>
double ground_pres;
int gps_tick;
int boost_tick;
double ground_pres;
int gps_tick;
int boost_tick;
EepromState() {
seen = 0;
EepromState() {
seen = 0;
state.flight_pres = state.ground_pres;
} else {
state.flight_pres = (state.flight_pres * 15 + state.pres) / 16;
state.flight_pres = state.ground_pres;
} else {
state.flight_pres = (state.flight_pres * 15 + state.pres) / 16;
- state.flight_accel = (state.flight_accel * 15 + state.accel) / 16;
- state.flight_vel += (state.accel_plus_g - state.accel);
+ state.flight_accel = (state.flight_accel * 15 + state.accel) / 16;
+ if ((eeprom.seen & seen_sensor) == 0)
+ eeprom.sensor_tick = record.tick - 1;
+ state.flight_vel += (state.accel_plus_g - state.accel) * (record.tick - eeprom.sensor_tick);
eeprom.seen |= seen_sensor;
eeprom.seen |= seen_sensor;
+ eeprom.sensor_tick = record.tick;
has_accel = true;
break;
case Altos.AO_LOG_PRESSURE:
has_accel = true;
break;
case Altos.AO_LOG_PRESSURE: