Bumping the rocket can cause a brief period of high acceleration, which may
cause a mistaken boost detection. Require both a high acceleration and
reasonable velocity to trigger boost phase.
Signed-off-by: Keith Packard <keithp@keithp.com>
#define ACCEL_VEL_MACH VEL_MPS_TO_COUNT(200)
#define ACCEL_VEL_APOGEE VEL_MPS_TO_COUNT(2)
#define ACCEL_VEL_MAIN VEL_MPS_TO_COUNT(100)
#define ACCEL_VEL_MACH VEL_MPS_TO_COUNT(200)
#define ACCEL_VEL_APOGEE VEL_MPS_TO_COUNT(2)
#define ACCEL_VEL_MAIN VEL_MPS_TO_COUNT(100)
+#define ACCEL_VEL_BOOST VEL_MPS_TO_COUNT(5)
/*
* Barometer calibration
/*
* Barometer calibration
+ * accelerometer: > 2g AND velocity > 5m/s
* OR
* barometer: > 20m vertical motion
*
* OR
* barometer: > 20m vertical motion
*
* the barometer, but we use both to make sure this
* transition is detected
*/
* the barometer, but we use both to make sure this
* transition is detected
*/
- if (ao_flight_accel < ao_ground_accel - ACCEL_BOOST ||
+ if ((ao_flight_accel < ao_ground_accel - ACCEL_BOOST &&
+ ao_flight_vel > ACCEL_VEL_BOOST) ||
ao_flight_pres < ao_ground_pres - BARO_LAUNCH)
{
ao_flight_state = ao_flight_boost;
ao_flight_pres < ao_ground_pres - BARO_LAUNCH)
{
ao_flight_state = ao_flight_boost;