summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-05-07 19:29:06 -0700
committerKeith Packard <keithp@keithp.com>2013-05-07 20:08:01 -0700
commit887209b61ac3012d0fd2206cf1016c44f59cb432 (patch)
treea9dc066963f7edcc47ecb8eb9e90b39808d64ef3 /src
parent802ca114ca064a9dd557a82e992653b145f8e660 (diff)
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 <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/ao_flight.c4
1 files changed, 3 insertions, 1 deletions
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