2 * Copyright © 2012 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 #ifndef _AO_MICROPEAK_H_
19 #define _AO_MICROPEAK_H_
21 #define FILTER_SHIFT 3
22 #define SAMPLE_SLEEP AO_MS_TO_TICKS(96)
24 /* 16 sample, or about two seconds worth */
25 #define GROUND_AVG_SHIFT 4
26 #define GROUND_AVG (1 << GROUND_AVG_SHIFT)
28 /* Pressure change (in Pa) to detect boost */
29 #define BOOST_DETECT 120 /* 10m at sea level, 12m at 2000m */
31 /* Wait after power on before doing anything to give the user time to assemble the rocket */
32 #define BOOST_DELAY AO_SEC_TO_TICKS(30)
34 /* Pressure change (in Pa) to detect landing */
35 #define LAND_DETECT 12 /* 1m at sea level, 1.2m at 2000m */
37 /* Current sensor pressure value */
40 /* IIR filtered pressure value */
41 extern uint32_t pa_avg;
43 /* Average pressure value on ground */
44 extern uint32_t pa_ground;
46 /* Minimum recorded filtered pressure value */
47 extern uint32_t pa_min;
49 /* Pressure values converted to altitudes */
50 extern alt_t ground_alt, max_alt;
52 /* max_alt - ground_alt */
53 extern alt_t ao_max_height;