summaryrefslogtreecommitdiff
path: root/src/kernel/ao_kalman.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2018-07-02 14:21:48 -0700
committerKeith Packard <keithp@keithp.com>2018-07-02 14:25:10 -0700
commite56e1dc20b3bf18073766da4e26e97d9e1d419fc (patch)
tree8f0ba66307c16def0bdc406e192daebed93551a8 /src/kernel/ao_kalman.c
parentc263fde769da380d55d223cebe3c9b6e8f19cb29 (diff)
altos/test: Compute and show height error tracker in ao_flight_test
Enable the computation of ao_error_h_sq_avg in ao_flight_test even when an accelerometer is present to allow review of that data. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel/ao_kalman.c')
-rw-r--r--src/kernel/ao_kalman.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/kernel/ao_kalman.c b/src/kernel/ao_kalman.c
index ac41085d..e4cc6d4b 100644
--- a/src/kernel/ao_kalman.c
+++ b/src/kernel/ao_kalman.c
@@ -45,7 +45,11 @@ static __pdata ao_k_t ao_avg_height_scaled;
__xdata ao_v_t ao_avg_height;
__pdata ao_v_t ao_error_h;
-#if !HAS_ACCEL
+#if !HAS_ACCEL || AO_FLIGHT_TEST
+#define AO_ERROR_H_SQ_AVG 1
+#endif
+
+#if AO_ERROR_H_SQ_AVG
__pdata ao_v_t ao_error_h_sq_avg;
#endif
@@ -85,7 +89,7 @@ ao_kalman_predict(void)
static void
ao_kalman_err_height(void)
{
-#if !HAS_ACCEL
+#if AO_ERROR_H_SQ_AVG
ao_v_t e;
#endif
ao_v_t height_distrust;
@@ -95,7 +99,7 @@ ao_kalman_err_height(void)
ao_error_h = ao_sample_height - (ao_v_t) (ao_k_height >> 16);
-#if !HAS_ACCEL
+#if AO_ERROR_H_SQ_AVG
e = ao_error_h;
if (e < 0)
e = -e;