From: Keith Packard Date: Mon, 2 Jul 2018 21:21:48 +0000 (-0700) Subject: altos/test: Compute and show height error tracker in ao_flight_test X-Git-Tag: 1.8.6~1^2~16 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=e56e1dc20b3bf18073766da4e26e97d9e1d419fc 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 --- 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; diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c index 8fe3b5df..746a6814 100644 --- a/src/test/ao_flight_test.c +++ b/src/test/ao_flight_test.c @@ -305,7 +305,7 @@ struct ao_task { #define AO_MS_TO_TICKS(ms) ((ms) / 10) #define AO_SEC_TO_TICKS(s) ((s) * 100) -#define AO_FLIGHT_TEST +#define AO_FLIGHT_TEST 1 int ao_flight_debug; @@ -438,10 +438,6 @@ static uint16_t pyros_fired; static struct ao_mpu6000_sample ao_ground_mpu6000; #endif -#if HAS_ACCEL -int ao_error_h_sq_avg; -#endif - void ao_test_exit(void) {