summaryrefslogtreecommitdiff
path: root/src/kernel/ao_sample.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-08-26 19:16:47 -0700
committerKeith Packard <keithp@keithp.com>2017-08-27 17:40:40 -0700
commitea6fe21d78744d7e6225a56c369d54f7cd956767 (patch)
tree643d3d5cd7eac4f4dd8c1b178f3bf637a85ea319 /src/kernel/ao_sample.h
parent12ef994a24eb996458092dc35c671d6b824b1576 (diff)
altos: Don't eliminate baro above mach speed, just trust it less
Instead of completely eliminating the baro sensor above mach speed, just derate it a bit so that the accel will dominate for speed computation and keep the device from false-triggering across mach transitions. When we completely ignored the baro sensor above mach, and the flight spent considerable time in that speed range, then the estimated height could be far from the real value. When the estimated speed dropped back down and the baro values were brought back into the computation, then the resulting rapid shift in estimated speed could trigger accidental apogee detection. By mixing in a bit of baro data even above mach, we keep the estimated height closer to the baro value and prevent this error, at least in flights measured so far. The flight known to have this problem is: 2015-09-26-serial-2093-flight-0012.eeprom Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel/ao_sample.h')
-rw-r--r--src/kernel/ao_sample.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/kernel/ao_sample.h b/src/kernel/ao_sample.h
index da40187b..f89d6a4c 100644
--- a/src/kernel/ao_sample.h
+++ b/src/kernel/ao_sample.h
@@ -95,7 +95,12 @@ typedef int16_t ao_v_t;
/*
* Above this speed, baro measurements are unreliable
*/
-#define AO_MAX_BARO_SPEED 200
+#define AO_MAX_BARO_SPEED 248
+
+/* The maximum amount (in a range of 0-256) to de-rate the
+ * baro sensor data based on speed.
+ */
+#define AO_MAX_SPEED_DISTRUST 160
#define ACCEL_NOSE_UP (ao_accel_2g >> 2)