From d1527a5457210eb914312cf8857bfb88982a8462 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 6 Jul 2014 12:35:13 -0700 Subject: Add support for the "kite" micropeak variant This uses a 100m 'launch detect' altitude and logs data every 19.2s instead of every .192s. Signed-off-by: Keith Packard --- src/kernel/ao_microflight.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/kernel/ao_microflight.c') diff --git a/src/kernel/ao_microflight.c b/src/kernel/ao_microflight.c index f680e400..df624e79 100644 --- a/src/kernel/ao_microflight.c +++ b/src/kernel/ao_microflight.c @@ -43,10 +43,12 @@ void ao_microflight(void) { int16_t sample_count; + int16_t log_count; uint16_t time; uint32_t pa_interval_min, pa_interval_max; int32_t pa_diff; - uint8_t h, i; + uint8_t h; + uint8_t i; uint8_t accel_lock = 0; uint32_t pa_sum = 0; @@ -93,7 +95,10 @@ ao_microflight(void) } /* Log the remaining samples so we get a complete history since leaving the ground */ - for (; i != h; i = SKIP_PA_HIST(i,2)) { +#if LOG_INTERVAL < NUM_PA_HIST + for (; i != h; i = SKIP_PA_HIST(i,2)) +#endif + { pa = pa_hist[i]; ao_log_micro_data(); } @@ -101,6 +106,7 @@ ao_microflight(void) /* Now sit around until the pressure is stable again and record the max */ sample_count = 0; + log_count = 0; pa_min = ao_pa; pa_interval_min = ao_pa; pa_interval_max = ao_pa; @@ -112,8 +118,11 @@ ao_microflight(void) ao_microsample(); if ((sample_count & 3) == 0) ao_led_off(AO_LED_REPORT); - if (sample_count & 1) + if (log_count == LOG_INTERVAL - 1) { ao_log_micro_data(); + log_count = 0; + } else + log_count++; /* If accelerating upwards, don't look for min pressure */ if (ao_pa_accel < ACCEL_LOCK_PA) -- cgit v1.2.3 From d8e2b661e895fc59ded002a02191dcccce75f548 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 19 Jul 2014 22:35:30 -0700 Subject: 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(-) (limited to 'src/kernel/ao_microflight.c') 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 */ -- cgit v1.2.3