projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/test: Compute and show height error tracker in ao_flight_test
[fw/altos]
/
src
/
kernel
/
ao_kalman.c
diff --git
a/src/kernel/ao_kalman.c
b/src/kernel/ao_kalman.c
index ac41085df8166db526d26c0d5a95f5f750360056..e4cc6d4b9f73676fbc93b750ececfad91b2ed332 100644
(file)
--- 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;
__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
__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)
{
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;
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);
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;
e = ao_error_h;
if (e < 0)
e = -e;