From f45f4b1bc90f3d9b57daded9762543d7ec40af17 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 8 Apr 2020 17:23:48 -0700 Subject: [PATCH] altos: Use computed height for avg_height when baro is missing EasyTimer doesn't have a barometer. Signed-off-by: Keith Packard --- src/kernel/ao_kalman.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kernel/ao_kalman.c b/src/kernel/ao_kalman.c index 8cb6ff61..aaf0595f 100644 --- a/src/kernel/ao_kalman.c +++ b/src/kernel/ao_kalman.c @@ -41,10 +41,8 @@ ao_v_t ao_height; ao_v_t ao_speed; ao_v_t ao_accel; ao_v_t ao_max_height; -#if HAS_BARO static ao_k_t ao_avg_height_scaled; ao_v_t ao_avg_height; -#endif ao_v_t ao_error_h; #if !HAS_ACCEL || AO_FLIGHT_TEST @@ -304,6 +302,9 @@ ao_kalman(void) ao_max_height = ao_height; #if HAS_BARO ao_avg_height_scaled = ao_avg_height_scaled - ao_avg_height + ao_sample_height; +#else + ao_avg_height_scaled = ao_avg_height_scaled - ao_avg_height + ao_height; +#endif #ifdef AO_FLIGHT_TEST if ((int16_t) (ao_sample_tick - ao_sample_prev_tick) > 50) ao_avg_height = (ao_avg_height_scaled + 1) >> 1; @@ -312,5 +313,4 @@ ao_kalman(void) else #endif ao_avg_height = (ao_avg_height_scaled + 63) >> 7; -#endif } -- 2.47.2