extern __pdata int16_t ao_ground_accel;
extern __pdata int16_t ao_min_pres;
extern __pdata uint16_t ao_launch_time;
+extern __xdata uint8_t ao_flight_force_idle;
/* Flight thread */
void
__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
/* 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
{
ao_clock_init();
+
/* Turn on the red LED until the system is stable */
ao_led_init(AO_LED_RED);
ao_led_on(AO_LED_RED);
+ /* A hack -- look at the SPI clock pin, if it's sitting at
+ * ground, then we force the computer to idle mode instead of
+ * flight mode
+ */
+ if (P1_3 == 0) {
+ ao_flight_force_idle = 1;
+ while (P1_3 == 0)
+ ;
+ }
ao_timer_init();
ao_adc_init();
ao_beep_init();