summaryrefslogtreecommitdiff
path: root/src/ao_flight.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-01-09 22:06:19 -0800
committerKeith Packard <keithp@keithp.com>2010-01-09 22:06:19 -0800
commit0c2533be15858774ef9381aa8c8344356fd5b971 (patch)
tree944069b9136942dc9bfde3cdcba4547e648050f8 /src/ao_flight.c
parent28346736a7799c0767e54511d9949cd61d35e471 (diff)
Force idle mode by shorting the SPI clock to ground at boot time.
This allows you to override the flight mode detection code in case the accelerometer calibration is broken somehow. Hold the SPI clock shoted to ground until the LED comes on, then remove it. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_flight.c')
-rw-r--r--src/ao_flight.c8
1 files changed, 6 insertions, 2 deletions
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