2 * Copyright © 2013 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; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 #ifndef AO_FLIGHT_TEST
30 #ifndef USE_STORAGE_CONFIG
31 #define USE_STORAGE_CONFIG 1
34 #ifndef USE_EEPROM_CONFIG
35 #define USE_EEPROM_CONFIG 0
38 #ifndef FLIGHT_LOG_APPEND
39 #define FLIGHT_LOG_APPEND 0
42 #if USE_STORAGE_CONFIG
44 #include <ao_storage.h>
46 #define ao_config_setup() ao_storage_setup()
47 #define ao_config_erase() ao_storage_erase(ao_storage_config, ao_storage_block)
48 #define ao_config_write(pos,bytes, len) ao_storage_write(ao_storage_config+(pos), bytes, len)
49 #define ao_config_read(pos,bytes, len) ao_storage_read(ao_storage_config+(pos), bytes, len)
50 #define ao_config_flush() ao_storage_flush()
56 #include <ao_eeprom.h>
58 #define ao_config_setup()
59 #define ao_config_erase()
60 #define ao_config_write(pos,bytes, len) ao_eeprom_write(pos, bytes, len)
61 #define ao_config_read(pos,bytes, len) ao_eeprom_read(pos, bytes, len)
62 #define ao_config_flush()
66 #define AO_CONFIG_MAJOR 1
67 #define AO_CONFIG_MINOR 26
69 /* All cc1200 devices support limiting TX power to 10mW */
70 #if !defined(HAS_RADIO_10MW) && defined(AO_CC1200_SPI)
71 #define HAS_RADIO_10MW 1
76 extern uint8_t ao_config_aes_seq;
82 int16_t accel_plus_g; /* changed for minor version 2 */
83 uint8_t _legacy_radio_channel;
84 char callsign[AO_MAX_CALLSIGN + 1];
85 uint8_t apogee_delay; /* minor version 1 */
86 int16_t accel_minus_g; /* minor version 2 */
87 uint32_t radio_cal; /* minor version 3 */
88 uint32_t flight_log_max; /* minor version 4 */
89 uint8_t ignite_mode; /* minor version 5 */
90 uint8_t pad_orientation; /* minor version 6 */
91 uint32_t radio_setting; /* minor version 7 */
92 uint8_t radio_enable; /* minor version 8 */
93 uint8_t aes_key[AO_AES_LEN]; /* minor version 9 */
94 uint32_t frequency; /* minor version 10 */
95 uint16_t apogee_lockout; /* minor version 11 */
97 struct ao_pyro pyro[AO_PYRO_NUM]; /* minor version 12 */
99 uint16_t aprs_interval; /* minor version 13 */
101 uint8_t radio_power; /* minor version 14 */
104 uint8_t radio_amp; /* minor version 14 */
107 int16_t accel_zero_along; /* minor version 15 */
108 int16_t accel_zero_across; /* minor version 15 */
109 int16_t accel_zero_through; /* minor version 15 */
112 uint8_t mid_beep; /* minor version 16 */
115 uint16_t tracker_motion; /* minor version 17 */
116 uint8_t tracker_interval; /* minor version 17 */
119 uint16_t pyro_time; /* minor version 18 */
122 uint8_t aprs_ssid; /* minor version 19 */
125 uint8_t radio_rate; /* minor version 20 */
127 #if HAS_RADIO_FORWARD
128 uint32_t send_frequency; /* minor version 21 */
131 uint8_t aprs_format; /* minor version 22 */
133 #if HAS_FIXED_PAD_BOX
134 uint8_t pad_box; /* minor version 22 */
135 uint8_t pad_idle; /* minor version 23 */
138 uint8_t aprs_offset; /* minor version 24 */
141 uint8_t radio_10mw; /* minor version 25 */
143 uint8_t report_feet; /* minor version 26 */
146 struct ao_config_1_24 {
149 uint16_t main_deploy;
150 int16_t accel_plus_g; /* changed for minor version 2 */
151 uint8_t _legacy_radio_channel;
152 char callsign[AO_MAX_CALLSIGN + 1];
153 uint8_t apogee_delay; /* minor version 1 */
154 int16_t accel_minus_g; /* minor version 2 */
155 uint32_t radio_cal; /* minor version 3 */
156 uint32_t flight_log_max; /* minor version 4 */
157 uint8_t ignite_mode; /* minor version 5 */
158 uint8_t pad_orientation; /* minor version 6 */
159 uint32_t radio_setting; /* minor version 7 */
160 uint8_t radio_enable; /* minor version 8 */
161 uint8_t aes_key[AO_AES_LEN]; /* minor version 9 */
162 uint32_t frequency; /* minor version 10 */
163 uint16_t apogee_lockout; /* minor version 11 */
165 struct ao_pyro_1_24 pyro[AO_PYRO_NUM]; /* minor version 12 */
167 uint16_t aprs_interval; /* minor version 13 */
169 uint8_t radio_power; /* minor version 14 */
172 uint8_t radio_amp; /* minor version 14 */
175 int16_t accel_zero_along; /* minor version 15 */
176 int16_t accel_zero_across; /* minor version 15 */
177 int16_t accel_zero_through; /* minor version 15 */
180 uint8_t mid_beep; /* minor version 16 */
183 uint16_t tracker_motion; /* minor version 17 */
184 uint8_t tracker_interval; /* minor version 17 */
187 uint16_t pyro_time; /* minor version 18 */
190 uint8_t aprs_ssid; /* minor version 19 */
193 uint8_t radio_rate; /* minor version 20 */
195 #if HAS_RADIO_FORWARD
196 uint32_t send_frequency; /* minor version 21 */
199 uint8_t aprs_format; /* minor version 22 */
201 #if HAS_FIXED_PAD_BOX
202 uint8_t pad_box; /* minor version 22 */
203 uint8_t pad_idle; /* minor version 23 */
206 uint8_t aprs_offset; /* minor version 24 */
210 #define AO_APRS_FORMAT_COMPRESSED 0
211 #define AO_APRS_FORMAT_UNCOMPRESSED 1
212 #define AO_CONFIG_DEFAULT_APRS_FORMAT AO_APRS_FORMAT_COMPRESSED
214 #if HAS_RADIO_FORWARD
215 extern uint32_t ao_send_radio_setting;
218 #define AO_IGNITE_MODE_DUAL 0
219 #define AO_IGNITE_MODE_APOGEE 1
220 #define AO_IGNITE_MODE_MAIN 2
221 #define AO_IGNITE_MODE_BOOSTER 3
223 #define AO_RADIO_ENABLE_CORE 1
224 #define AO_RADIO_DISABLE_TELEMETRY 2
225 #define AO_RADIO_DISABLE_RDF 4
227 #define AO_PAD_ORIENTATION_ANTENNA_UP 0
228 #define AO_PAD_ORIENTATION_ANTENNA_DOWN 1
230 #ifndef AO_CONFIG_MAX_SIZE
231 #define AO_CONFIG_MAX_SIZE 128
234 /* Make sure AO_CONFIG_MAX_SIZE is big enough */
235 typedef uint8_t config_check_space[(int) (AO_CONFIG_MAX_SIZE - sizeof (struct ao_config))];
237 extern struct ao_config ao_config;
238 extern uint8_t ao_config_loaded;
241 _ao_config_edit_start(void);
244 _ao_config_edit_finish(void);
253 ao_config_set_radio(void);
256 ao_config_log_fix_append(void);
259 ao_config_init(void);
261 #endif /* _AO_CONFIG_H_ */