+ 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_accel > ao_config.accel_minus_g + ACCEL_NOSE_UP)
+ {
+ /* Detected an accel value outside -1.5g to 1.5g
+ * (or uncalibrated values), so we go into invalid mode
+ */
+ ao_flight_state = ao_flight_invalid;
+ /* Allow packet mode in invalid flight state,
+ * Still need to be able to fix the problem!
+ */
+ ao_packet_slave_start();
+
+ } else if (ao_flight_accel < ao_config.accel_plus_g + ACCEL_NOSE_UP &&
+ !ao_flight_force_idle)
+ {
+ /* Set pad mode - we can fly! */
+ ao_flight_state = ao_flight_pad;