From: Keith Packard Date: Wed, 8 May 2013 02:29:06 +0000 (-0700) Subject: altos: Sanity check barometer before going to pad mode X-Git-Tag: 1.2.1~59 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;ds=sidebyside;h=887209b61ac3012d0fd2206cf1016c44f59cb432;p=fw%2Faltos altos: Sanity check barometer before going to pad mode Make sure the barometer is reporting some sensible value before letting TM try to fly the rocket. Signed-off-by: Keith Packard --- diff --git a/src/core/ao_flight.c b/src/core/ao_flight.c index 64c95063..9d9d4c6e 100644 --- a/src/core/ao_flight.c +++ b/src/core/ao_flight.c @@ -94,7 +94,9 @@ ao_flight(void) if (ao_config.accel_plus_g == 0 || ao_config.accel_minus_g == 0 || ao_ground_accel < ao_config.accel_plus_g - ACCEL_NOSE_UP || - ao_ground_accel > ao_config.accel_minus_g + ACCEL_NOSE_UP) + ao_ground_accel > ao_config.accel_minus_g + ACCEL_NOSE_UP || + ao_ground_height < -1000 || + ao_ground_height > 7000) { /* Detected an accel value outside -1.5g to 1.5g * (or uncalibrated values), so we go into invalid mode