diff options
author | Keith Packard <keithp@keithp.com> | 2011-03-29 10:08:46 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-03-29 10:08:46 -0700 |
commit | 08e6bbef2c3529dfd468ef221c526fc9f3ed5b81 (patch) | |
tree | e2eeaf5b2c9a492101fe44ddc1fe52b2b01d83d8 | |
parent | 56d045040c49728a854741e99545766f3723da5e (diff) |
altos: ao_sample_preflight was exiting preflight mode immediately
Need to stay in pre-flight mode until we've gotten enough sensor data
to calibrate things appropriately. The conversion from a unified
ao_flight.c file was just broken here.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/ao_sample.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/ao_sample.c b/src/ao_sample.c index ef403393..84cf1e00 100644 --- a/src/ao_sample.c +++ b/src/ao_sample.c @@ -68,16 +68,17 @@ ao_sample_preflight(void) #endif ao_sample_pres_sum += ao_sample_pres; ++nsamples; - ao_preflight = FALSE; - } - ao_config_get(); + } else { + ao_config_get(); #if HAS_ACCEL - ao_ground_accel = ao_sample_accel_sum >> 9; - ao_accel_2g = ao_config.accel_minus_g - ao_config.accel_plus_g; - ao_accel_scale = to_fix32(GRAVITY * 2 * 16) / ao_accel_2g; + ao_ground_accel = ao_sample_accel_sum >> 9; + ao_accel_2g = ao_config.accel_minus_g - ao_config.accel_plus_g; + ao_accel_scale = to_fix32(GRAVITY * 2 * 16) / ao_accel_2g; #endif - ao_ground_pres = ao_sample_pres_sum >> 9; - ao_ground_height = ao_pres_to_altitude(ao_ground_pres); + ao_ground_pres = ao_sample_pres_sum >> 9; + ao_ground_height = ao_pres_to_altitude(ao_ground_pres); + ao_preflight = FALSE; + } } uint8_t |