summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-05-10 22:57:19 -0700
committerKeith Packard <keithp@keithp.com>2009-05-10 22:57:19 -0700
commit97cecb517cd7bf75e1219c76a93bfe6964c07052 (patch)
tree1f8f2ab9d09e27aecfc00c0727844bd0f52f807a
parent98806b1ff3f41484663d61ff430e9e2764c7b5e6 (diff)
Increase the initial accel/baro average to 1000 samples
To get an accurate baseline of the launchpad state, take a longer average of the two sensors as the unit boots up. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--ao_flight.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ao_flight.c b/ao_flight.c
index 06d4ba3d..43fd98b2 100644
--- a/ao_flight.c
+++ b/ao_flight.c
@@ -136,7 +136,7 @@ __xdata int32_t ao_raw_accel_sum, ao_raw_pres_sum;
void
ao_flight(void)
{
- __pdata static uint8_t nsamples = 0;
+ __pdata static uint16_t nsamples = 0;
ao_flight_adc = ao_adc_head;
ao_raw_accel_prev = 0;
@@ -194,10 +194,10 @@ ao_flight(void)
/* startup state:
*
- * Collect 100 samples of acceleration and pressure
+ * Collect 1000 samples of acceleration and pressure
* data and average them to find the resting values
*/
- if (nsamples < 100) {
+ if (nsamples < 1000) {
ao_raw_accel_sum += ao_raw_accel;
ao_raw_pres_sum += ao_raw_pres;
++nsamples;