altos: Use only accel for boost detect without baro
authorKeith Packard <keithp@keithp.com>
Sun, 11 Oct 2020 05:26:38 +0000 (22:26 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 11 Oct 2020 05:26:38 +0000 (22:26 -0700)
Without baro, speed will integrate accel 'forever' and cause speed to
be wildly inaccurate at boost time. Would be awesome to reset speed to
zero at some point.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/kernel/ao_flight.c

index 4ffbcf4b43715d2b732898cc94b4f94732819298..e895904c720bc91645ac6c8a31474ba9af8b0f0a 100644 (file)
@@ -201,10 +201,12 @@ ao_flight(void)
 
                        break;
 
+#if 0
                case ao_flight_idle:
                case ao_flight_invalid:
                        printf("+g %d ga %d sa %d accel %ld speed %ld\n", ao_config.accel_plus_g, ao_ground_accel, ao_sample_accel, ao_accel, ao_speed);
                        break;
+#endif
 
                case ao_flight_pad:
                        /* pad to boost:
@@ -222,8 +224,10 @@ ao_flight(void)
                         */
                        if (ao_height > AO_M_TO_HEIGHT(20)
 #if HAS_ACCEL
-                           || (ao_accel > AO_MSS_TO_ACCEL(20) &&
-                               ao_speed > AO_MS_TO_SPEED(5))
+                           || (ao_accel > AO_MSS_TO_ACCEL(20)
+#if HAS_BARO
+                               && ao_speed > AO_MS_TO_SPEED(5))
+#endif
 #endif
                                )
                        {