summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
aa6d87a)
Adding two 16 bit integers together can wrap around to negative numbers,
this resulted in velocity values which never decreased, making the switch
from coast to apogee state not occur.
Signed-off-by: Keith Packard <keithp@keithp.com>
* so subtract instead of add.
*/
ticks = ao_flight_tick - ao_flight_prev_tick;
* 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);
+ ao_vel_change = (((ao_raw_accel >> 1) + (ao_raw_accel_prev >> 1)) - ao_ground_accel);
ao_raw_accel_prev = ao_raw_accel;
/* one is a common interval */
ao_raw_accel_prev = ao_raw_accel;
/* one is a common interval */