X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fkernel%2Fao_flight.c;h=f06125cd1329f361f7e91e92afcaadc2be420b38;hb=83929cd290279963b01b2ccd52c70d61bdeff6b0;hp=50f2b68f998f3df1c7960bfb64ffb6153e15de6f;hpb=1085ec5d57e0ed5d132f2bbdac1a0b6a32c0ab4a;p=fw%2Faltos diff --git a/src/kernel/ao_flight.c b/src/kernel/ao_flight.c index 50f2b68f..f06125cd 100644 --- a/src/kernel/ao_flight.c +++ b/src/kernel/ao_flight.c @@ -269,7 +269,7 @@ ao_flight(void) * number of seconds. */ if (ao_config.apogee_lockout) { - if ((ao_sample_tick - ao_boost_tick) < + if ((int16_t) (ao_sample_tick - ao_boost_tick) < AO_SEC_TO_TICKS(ao_config.apogee_lockout)) break; } @@ -282,9 +282,11 @@ ao_flight(void) * the measured altitude reasonably closely; otherwise * we're probably transsonic. */ +#define AO_ERROR_BOUND 100 + if (ao_speed < 0 #if !HAS_ACCEL - && (ao_sample_alt >= AO_MAX_BARO_HEIGHT || ao_error_h_sq_avg < 100) + && (ao_sample_alt >= AO_MAX_BARO_HEIGHT || ao_error_h_sq_avg < AO_ERROR_BOUND) #endif ) {