X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fao_flight.c;h=e0fd97f2464b901a61649037e61a9848e46b819e;hb=0c2533be15858774ef9381aa8c8344356fd5b971;hp=f57573d0547b15baf2e804441837dc122db03ab3;hpb=1c654a9369294c9b8066c33f91161d8005b96680;p=fw%2Faltos diff --git a/src/ao_flight.c b/src/ao_flight.c index f57573d0..e0fd97f2 100644 --- a/src/ao_flight.c +++ b/src/ao_flight.c @@ -50,6 +50,8 @@ __data uint8_t ao_flight_adc; __pdata int16_t ao_raw_accel, ao_raw_accel_prev, ao_raw_pres; __pdata int16_t ao_accel_2g; +__xdata uint8_t ao_flight_force_idle; + /* Accelerometer calibration * * We're sampling the accelerometer through a resistor divider which @@ -221,8 +223,10 @@ ao_flight(void) /* Go to pad state if the nose is pointing up */ ao_config_get(); - if (ao_config.accel_plus_g != 0 && ao_config.accel_minus_g != 0 && - ao_flight_accel < ao_config.accel_plus_g + ACCEL_NOSE_UP) + if (ao_config.accel_plus_g != 0 && + ao_config.accel_minus_g != 0 && + ao_flight_accel < ao_config.accel_plus_g + ACCEL_NOSE_UP && + !ao_flight_force_idle) { /* Disable the USB controller in flight mode * to save power