From: Keith Packard Date: Sun, 8 Apr 2012 01:35:26 +0000 (-0700) Subject: altosui: Integrate accel speed from very start of eeprom record X-Git-Tag: 1.0.9.5~75 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=20066268d8d1853055d0afe108584db34b425fcb altosui: Integrate accel speed from very start of eeprom record 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 --- diff --git a/altosui/AltosEepromIterable.java b/altosui/AltosEepromIterable.java index d8205816..6fdaf8e0 100644 --- a/altosui/AltosEepromIterable.java +++ b/altosui/AltosEepromIterable.java @@ -99,6 +99,7 @@ public class AltosEepromIterable extends AltosRecordIterable { double ground_pres; int gps_tick; int boost_tick; + int sensor_tick; EepromState() { seen = 0; @@ -128,10 +129,13 @@ public class AltosEepromIterable extends AltosRecordIterable { 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.sensor_tick = record.tick; has_accel = true; break; case Altos.AO_LOG_PRESSURE: