summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-04-07 18:35:26 -0700
committerKeith Packard <keithp@keithp.com>2012-04-07 18:35:26 -0700
commit20066268d8d1853055d0afe108584db34b425fcb (patch)
tree2412149940ec339cb875e8d16b0e0d526b01c0c1
parentd35c4df12a3d8e2dab5d41f8d918ff4237f91e46 (diff)
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 <keithp@keithp.com>
-rw-r--r--altosui/AltosEepromIterable.java8
1 files changed, 6 insertions, 2 deletions
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: