From d8e2b661e895fc59ded002a02191dcccce75f548 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 19 Jul 2014 22:35:30 -0700 Subject: [PATCH] altos: Have MicroKite just start recording at startup This avoids having MicroKite try to detect boost and has it just start recording data immediately. Signed-off-by: Keith Packard --- src/kernel/ao_microflight.c | 9 +++++++++ src/microkite/ao_pins.h | 3 ++- src/product/ao_micropeak.c | 3 ++- src/product/ao_micropeak.h | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/kernel/ao_microflight.c b/src/kernel/ao_microflight.c index df624e79..f7521f21 100644 --- a/src/kernel/ao_microflight.c +++ b/src/kernel/ao_microflight.c @@ -62,19 +62,25 @@ ao_microflight(void) h = 0; for (;;) { time += SAMPLE_SLEEP; +#if BOOST_DETECT if ((sample_count & 0x1f) == 0) ao_led_on(AO_LED_REPORT); +#endif ao_delay_until(time); ao_microsample(); +#if BOOST_DETECT if ((sample_count & 0x1f) == 0) ao_led_off(AO_LED_REPORT); +#endif pa_hist[h] = pa; h = SKIP_PA_HIST(h,1); pa_diff = pa_ground - ao_pa; +#if BOOST_DETECT /* Check for a significant pressure change */ if (pa_diff > BOOST_DETECT) break; +#endif if (sample_count < GROUND_AVG * 2) { if (sample_count < GROUND_AVG) @@ -84,6 +90,9 @@ ao_microflight(void) pa_ground = pa_sum >> GROUND_AVG_SHIFT; pa_sum = 0; sample_count = 0; +#if !BOOST_DETECT + break; +#endif } } diff --git a/src/microkite/ao_pins.h b/src/microkite/ao_pins.h index 3c56dfb8..346b63a1 100644 --- a/src/microkite/ao_pins.h +++ b/src/microkite/ao_pins.h @@ -62,8 +62,9 @@ typedef int32_t alt_t; #define AO_ALT_VALUE(x) ((x) * (alt_t) 10) -#define BOOST_DETECT 1200 /* 100m (ish) */ +#define BOOST_DETECT 0 /* none */ #define LOG_INTERVAL 200 /* 19.2 seconds */ +#define BOOST_DELAY 0 #define AO_LOG_ID AO_LOG_ID_MICROKITE diff --git a/src/product/ao_micropeak.c b/src/product/ao_micropeak.c index 10f0d192..54522d86 100644 --- a/src/product/ao_micropeak.c +++ b/src/product/ao_micropeak.c @@ -73,8 +73,9 @@ main(void) ao_report_altitude(); ao_pips(); ao_log_micro_dump(); - +#if BOOST_DELAY ao_delay(BOOST_DELAY); +#endif ao_microflight(); diff --git a/src/product/ao_micropeak.h b/src/product/ao_micropeak.h index 396b9a23..622f5a69 100644 --- a/src/product/ao_micropeak.h +++ b/src/product/ao_micropeak.h @@ -41,7 +41,9 @@ #endif /* Wait after power on before doing anything to give the user time to assemble the rocket */ +#ifndef BOOST_DELAY #define BOOST_DELAY AO_SEC_TO_TICKS(60) +#endif /* Pressure change (in Pa) to detect landing */ #define LAND_DETECT 24 /* 2m at sea level, 2.4m at 2000m */ -- 2.30.2