- /* all of our accelerations are negative, so subtract instead of add to get speed */
- ao_flight_vel -= (int32_t) (((ao_raw_accel + ao_raw_accel_prev) >> 1) - ao_ground_accel);
+
+ /* Update velocity
+ *
+ * The accelerometer is mounted so that
+ * acceleration yields negative values
+ * while deceleration yields positive values,
+ * so subtract instead of add.
+ */
+ ticks = ao_flight_tick - ao_flight_prev_tick;
+ ao_vel_change = (((ao_raw_accel + ao_raw_accel_prev) >> 1) - ao_ground_accel);