summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2018-05-07 08:51:36 -0700
committerKeith Packard <keithp@keithp.com>2018-05-07 09:21:56 -0700
commitcc83d57454ed07e4828b4413e5af6ae2ecfe2e5a (patch)
tree9002f5d40e54ab38e88b1ed22f65dd227ae1c15c /src
parent49aafcbb6c0f3ecda4b668776be74a04a5654377 (diff)
altos: Eliminate height requirement for coast detect
We had required a minimum altitude of 100m to transition from boost to coast. With small motors in a heavy multi-staged rocket, this can fail to detect coast in time to light the second motor. Also, this would fail to deploy recovery systems if the flight failed before reaching 100m. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r--src/kernel/ao_flight.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/kernel/ao_flight.c b/src/kernel/ao_flight.c
index cb02c454..7b3cb9fa 100644
--- a/src/kernel/ao_flight.c
+++ b/src/kernel/ao_flight.c
@@ -233,7 +233,7 @@ ao_flight(void)
* deceleration, or by waiting until the maximum burn duration
* (15 seconds) has past.
*/
- if ((ao_accel < AO_MSS_TO_ACCEL(-2.5) && ao_height > AO_M_TO_HEIGHT(100)) ||
+ if ((ao_accel < AO_MSS_TO_ACCEL(-2.5)) ||
(int16_t) (ao_sample_tick - ao_boost_tick) > BOOST_TICKS_MAX)
{
#if HAS_ACCEL
@@ -310,7 +310,7 @@ ao_flight(void)
#if HAS_ACCEL
else {
check_re_boost:
- ao_coast_avg_accel = ao_coast_avg_accel - (ao_coast_avg_accel >> 6) + (ao_accel >> 6);
+ ao_coast_avg_accel = ao_coast_avg_accel + ((ao_accel - ao_coast_avg_accel) >> 5);
if (ao_coast_avg_accel > AO_MSS_TO_ACCEL(20)) {
ao_boost_tick = ao_sample_tick;
ao_flight_state = ao_flight_boost;