altos/test: Adjust CRC error rate after FEC fix
[fw/altos] / src / kernel / ao_log.h
1 /*
2  * Copyright © 2012 Keith Packard <keithp@keithp.com>
3  *
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.
8  *
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.
13  *
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.
17  */
18
19 #ifndef _AO_LOG_H_
20 #define _AO_LOG_H_
21
22 #include <ao_flight.h>
23
24 /*
25  * ao_log.c
26  */
27
28 /* We record flight numbers in the first record of
29  * the log. Tasks may wait for this to be initialized
30  * by sleeping on this variable.
31  */
32 extern uint16_t ao_flight_number;
33 extern uint8_t  ao_log_mutex;
34 extern uint32_t ao_log_current_pos;
35 extern uint32_t ao_log_end_pos;
36 extern uint32_t ao_log_start_pos;
37 extern uint8_t  ao_log_running;
38 extern enum ao_flight_state ao_log_state;
39
40 /* required functions from the underlying log system */
41
42 #define AO_LOG_FORMAT_UNKNOWN           0       /* unknown; altosui will have to guess */
43 #define AO_LOG_FORMAT_FULL              1       /* 8 byte typed log records */
44 #define AO_LOG_FORMAT_TINY              2       /* two byte state/baro records */
45 #define AO_LOG_FORMAT_TELEMETRY         3       /* 32 byte ao_telemetry records */
46 #define AO_LOG_FORMAT_TELESCIENCE       4       /* 32 byte typed telescience records */
47 #define AO_LOG_FORMAT_TELEMEGA_OLD      5       /* 32 byte typed telemega records */
48 #define AO_LOG_FORMAT_EASYMINI1         6       /* 16-byte MS5607 baro only, 3.0V supply */
49 #define AO_LOG_FORMAT_TELEMETRUM        7       /* 16-byte typed telemetrum records */
50 #define AO_LOG_FORMAT_TELEMINI2         8       /* 16-byte MS5607 baro only, 3.3V supply, cc1111 SoC */
51 #define AO_LOG_FORMAT_TELEGPS           9       /* 32 byte telegps records */
52 #define AO_LOG_FORMAT_TELEMEGA          10      /* 32 byte typed telemega records with 32 bit gyro cal */
53 #define AO_LOG_FORMAT_DETHERM           11      /* 16-byte MS5607 baro only, no ADC */
54 #define AO_LOG_FORMAT_TELEMINI3         12      /* 16-byte MS5607 baro only, 3.3V supply, stm32f042 SoC */
55 #define AO_LOG_FORMAT_TELEFIRETWO       13      /* 32-byte test stand data */
56 #define AO_LOG_FORMAT_EASYMINI2         14      /* 16-byte MS5607 baro only, 3.3V supply, stm32f042 SoC */
57 #define AO_LOG_FORMAT_TELEMEGA_3        15      /* 32 byte typed telemega records with 32 bit gyro cal and mpu9250 */
58 #define AO_LOG_FORMAT_EASYMEGA_2        16      /* 32 byte typed telemega records with 32 bit gyro cal, mpu9250 rotated 90° and adxl375 */
59 #define AO_LOG_FORMAT_TELESTATIC        17      /* 32 byte typed telestatic records */
60 #define AO_LOG_FORMAT_MICROPEAK2        18      /* 2-byte baro values with header */
61 #define AO_LOG_FORMAT_TELEMEGA_4        19      /* 32 byte typed telemega records with 32 bit gyro cal and Bmx160 */
62 #define AO_LOG_FORMAT_EASYMOTOR         20      /* 16 byte typed easymotor records with pressure sensor and adxl375 */
63 #define AO_LOG_FORMAT_TELEMEGA_5        21      /* 32 byte typed telemega records with 32 bit gyro cal, mpu6000 and mmc5983 */
64 #define AO_LOG_FORMAT_NONE              127     /* No log at all */
65
66 /* Return the flight number from the given log slot, 0 if none, -slot on failure */
67
68 int32_t
69 ao_log_flight(uint8_t slot);
70
71 /* Checksum the loaded log record */
72 uint8_t
73 ao_log_check_data(void);
74
75 /* Check to see if the loaded log record is empty */
76 uint8_t
77 ao_log_check_clear(void);
78
79 /* Check if there is valid log data at the specified location */
80 #define AO_LOG_VALID    1
81 #define AO_LOG_EMPTY    0
82 #define AO_LOG_INVALID  -1
83
84 int8_t
85 ao_log_check(uint32_t pos);
86
87 /* Flush the log */
88 void
89 ao_log_flush(void);
90
91 /* Logging thread main routine */
92 void
93 ao_log(void);
94
95 /* functions provided in ao_log.c */
96
97 /* Figure out the current flight number */
98 uint8_t
99 ao_log_scan(void);
100
101 /* Start logging to eeprom */
102 void
103 ao_log_start(void);
104
105 /* Stop logging */
106 void
107 ao_log_stop(void);
108
109 /* Initialize the logging system */
110 void
111 ao_log_init(void);
112
113 /* Write out the current flight number to the erase log */
114 void
115 ao_log_write_erase(uint8_t pos);
116
117 /* Returns true if there are any logs stored in eeprom */
118 uint8_t
119 ao_log_present(void);
120
121 /* Returns true if there is no more storage space available */
122 uint8_t
123 ao_log_full(void);
124
125 /*
126  * ao_log_big.c
127  */
128
129 /*
130  * The data log is recorded in the eeprom as a sequence
131  * of data packets.
132  *
133  * Each packet starts with a 4-byte header that has the
134  * packet type, the packet checksum and the tick count. Then
135  * they all contain 2 16 bit values which hold packet-specific
136  * data.
137  *
138  * For each flight, the first packet
139  * is FLIGHT packet, indicating the serial number of the
140  * device and a unique number marking the number of flights
141  * recorded by this device.
142  *
143  * During flight, data from the accelerometer and barometer
144  * are recorded in SENSOR packets, using the raw 16-bit values
145  * read from the A/D converter.
146  *
147  * Also during flight, but at a lower rate, the deployment
148  * sensors are recorded in DEPLOY packets. The goal here is to
149  * detect failure in the deployment circuits.
150  *
151  * STATE packets hold state transitions as the flight computer
152  * transitions through different stages of the flight.
153  */
154 #define AO_LOG_FLIGHT           'F'
155 #define AO_LOG_SENSOR           'A'
156 #define AO_LOG_TEMP_VOLT        'T'
157 #define AO_LOG_DEPLOY           'D'
158 #define AO_LOG_STATE            'S'
159 #define AO_LOG_GPS_TIME         'G'
160 #define AO_LOG_GPS_LAT          'N'
161 #define AO_LOG_GPS_LON          'W'
162 #define AO_LOG_GPS_ALT          'H'
163 #define AO_LOG_GPS_SAT          'V'
164 #define AO_LOG_GPS_DATE         'Y'
165 #define AO_LOG_GPS_POS          'P'
166
167 #define AO_LOG_POS_NONE         (~0UL)
168
169 struct ao_log_record {
170         char                    type;                           /* 0 */
171         uint8_t                 csum;                           /* 1 */
172         uint16_t                tick;                           /* 2 */
173         union {
174                 struct {
175                         int16_t         ground_accel;           /* 4 */
176                         uint16_t        flight;                 /* 6 */
177                 } flight;
178                 struct {
179                         int16_t         accel;                  /* 4 */
180                         int16_t         pres;                   /* 6 */
181                 } sensor;
182                 struct {
183                         int16_t         temp;
184                         int16_t         v_batt;
185                 } temp_volt;
186                 struct {
187                         int16_t         drogue;
188                         int16_t         main;
189                 } deploy;
190                 struct {
191                         uint16_t        state;
192                         uint16_t        reason;
193                 } state;
194                 struct {
195                         uint8_t         hour;
196                         uint8_t         minute;
197                         uint8_t         second;
198                         uint8_t         flags;
199                 } gps_time;
200                 int32_t         gps_latitude;
201                 int32_t         gps_longitude;
202                 struct {
203                         uint16_t        altitude_low;
204                         int16_t         altitude_high;
205                 } gps_altitude;
206                 struct {
207                         uint16_t        svid;
208                         uint8_t         unused;
209                         uint8_t         c_n;
210                 } gps_sat;
211                 struct {
212                         uint8_t         year;
213                         uint8_t         month;
214                         uint8_t         day;
215                         uint8_t         extra;
216                 } gps_date;
217                 struct {
218                         uint16_t        d0;
219                         uint16_t        d1;
220                 } anon;
221         } u;
222 };
223
224 struct ao_log_mega {
225         char                    type;                   /* 0 */
226         uint8_t                 csum;                   /* 1 */
227         uint16_t                tick;                   /* 2 */
228         union {                                         /* 4 */
229                 /* AO_LOG_FLIGHT */
230                 struct {
231                         uint16_t        flight;                 /* 4 */
232                         int16_t         ground_accel;           /* 6 */
233                         int32_t         ground_pres;            /* 8 */
234                         int16_t         ground_accel_along;     /* 12 */
235                         int16_t         ground_accel_across;    /* 14 */
236                         int16_t         ground_accel_through;   /* 16 */
237                         int16_t         pad_18;                 /* 18 */
238                         int32_t         ground_roll;            /* 20 */
239                         int32_t         ground_pitch;           /* 24 */
240                         int32_t         ground_yaw;             /* 28 */
241                 } flight;                                       /* 32 */
242                 struct {
243                         uint16_t        flight;                 /* 4 */
244                         int16_t         ground_accel;           /* 6 */
245                         int32_t         ground_pres;            /* 8 */
246                         int16_t         ground_accel_along;     /* 12 */
247                         int16_t         ground_accel_across;    /* 14 */
248                         int16_t         ground_accel_through;   /* 16 */
249                         int16_t         ground_roll;            /* 18 */
250                         int16_t         ground_pitch;           /* 20 */
251                         int16_t         ground_yaw;             /* 22 */
252                 } flight_old;                                   /* 24 */
253                 /* AO_LOG_STATE */
254                 struct {
255                         uint16_t        state;
256                         uint16_t        reason;
257                 } state;
258                 /* AO_LOG_SENSOR */
259                 struct {
260                         uint32_t        pres;           /* 4 */
261                         uint32_t        temp;           /* 8 */
262                         union {
263                                 struct {
264                                         int16_t         accel_along;    /* 12 */
265                                         int16_t         accel_across;   /* 14 */
266                                         int16_t         accel_through;  /* 16 */
267                                         int16_t         gyro_roll;      /* 18 */
268                                         int16_t         gyro_pitch;     /* 20 */
269                                         int16_t         gyro_yaw;       /* 22 */
270                                         int16_t         mag_along;      /* 24 */
271                                         int16_t         mag_across;     /* 26 */
272                                         int16_t         mag_through;    /* 28 */
273                                 };
274                                 struct {
275                                         int16_t         accel_x;        /* 12 */
276                                         int16_t         accel_y;        /* 14 */
277                                         int16_t         accel_z;        /* 16 */
278                                         int16_t         gyro_x;         /* 18 */
279                                         int16_t         gyro_y;         /* 20 */
280                                         int16_t         gyro_z;         /* 22 */
281                                         int16_t         mag_x;          /* 24 */
282                                         int16_t         mag_z;          /* 26 */
283                                         int16_t         mag_y;          /* 28 */
284                                 };
285                         };
286                         int16_t         accel;          /* 30 */
287                 } sensor;       /* 32 */
288                 /* AO_LOG_TEMP_VOLT */
289                 struct {
290                         int16_t         v_batt;         /* 4 */
291                         int16_t         v_pbatt;        /* 6 */
292                         int16_t         n_sense;        /* 8 */
293                         int16_t         sense[10];      /* 10 */
294                         uint16_t        pyro;           /* 30 */
295                 } volt;                                 /* 32 */
296                 /* AO_LOG_GPS_TIME */
297                 struct {
298                         int32_t         latitude;       /* 4 */
299                         int32_t         longitude;      /* 8 */
300                         uint16_t        altitude_low;   /* 12 */
301                         uint8_t         hour;           /* 14 */
302                         uint8_t         minute;         /* 15 */
303                         uint8_t         second;         /* 16 */
304                         uint8_t         flags;          /* 17 */
305                         uint8_t         year;           /* 18 */
306                         uint8_t         month;          /* 19 */
307                         uint8_t         day;            /* 20 */
308                         uint8_t         course;         /* 21 */
309                         uint16_t        ground_speed;   /* 22 */
310                         int16_t         climb_rate;     /* 24 */
311                         uint8_t         pdop;           /* 26 */
312                         uint8_t         hdop;           /* 27 */
313                         uint8_t         vdop;           /* 28 */
314                         uint8_t         mode;           /* 29 */
315                         int16_t         altitude_high;  /* 30 */
316                 } gps;  /* 32 */
317                 /* AO_LOG_GPS_SAT */
318                 struct {
319                         uint16_t        channels;       /* 4 */
320                         struct {
321                                 uint8_t svid;
322                                 uint8_t c_n;
323                         } sats[12];                     /* 6 */
324                 } gps_sat;                              /* 30 */
325         } u;
326 };
327
328 #define AO_LOG_MEGA_GPS_ALTITUDE(l)     ((int32_t) ((l)->u.gps.altitude_high << 16) | ((l)->u.gps.altitude_low))
329 #define AO_LOG_MEGA_SET_GPS_ALTITUDE(l,a)       (((l)->u.gps.mode |= AO_GPS_MODE_ALTITUDE_24), \
330                                                  ((l)->u.gps.altitude_high = (a) >> 16), \
331                                                  (l)->u.gps.altitude_low = (a))
332
333 struct ao_log_firetwo {
334         char                    type;                   /* 0 */
335         uint8_t                 csum;                   /* 1 */
336         uint16_t                tick;                   /* 2 */
337         union {                                         /* 4 */
338                 /* AO_LOG_FLIGHT */
339                 struct {
340                         uint16_t        flight;         /* 4 */
341                 } flight;       /* 6 */
342                 /* AO_LOG_STATE */
343                 struct {
344                         uint16_t        state;          /* 4 */
345                         uint16_t        reason;         /* 6 */
346                 } state;        /* 8 */
347                 /* AO_LOG_SENSOR */
348                 struct {
349                         uint16_t        pressure;       /* 4 */
350                         uint16_t        thrust;         /* 6 */
351                         uint16_t        thermistor[4];  /* 8 */
352                 } sensor;       /* 24 */
353                 uint8_t         align[28];              /* 4 */
354         } u;    /* 32 */
355 };
356
357 struct ao_log_telestatic {
358         char                    type;                   /* 0 */
359         uint8_t                 csum;                   /* 1 */
360         uint16_t                tick;                   /* 2 */
361         union {                                         /* 4 */
362                 /* AO_LOG_FLIGHT */
363                 struct {
364                         uint16_t        flight;         /* 4 */
365                 } flight;       /* 6 */
366                 /* AO_LOG_STATE */
367                 struct {
368                         uint16_t        state;          /* 4 */
369                         uint16_t        reason;         /* 6 */
370                 } state;        /* 8 */
371                 /* AO_LOG_SENSOR */
372                 struct {
373                         uint32_t        pressure;       /* 4 */
374                         uint32_t        pressure2;      /* 8 */
375                         uint32_t        thrust;         /* 12 */
376                         uint32_t        mass;           /* 16 */
377                         uint16_t        t_low;          /* 20 */
378                         uint16_t        t_high[4];      /* 22 */
379                 } sensor;       /* 30 */
380                 uint8_t         align[28];              /* 4 */
381         } u;    /* 32 */
382 };
383
384 struct ao_log_metrum {
385         char                    type;                   /* 0 */
386         uint8_t                 csum;                   /* 1 */
387         uint16_t                tick;                   /* 2 */
388         union {                                         /* 4 */
389                 /* AO_LOG_FLIGHT */
390                 struct {
391                         uint16_t        flight;         /* 4 */
392                         int16_t         ground_accel;   /* 6 */
393                         int32_t         ground_pres;    /* 8 */
394                         uint32_t        ground_temp;    /* 12 */
395                 } flight;       /* 16 */
396                 /* AO_LOG_STATE */
397                 struct {
398                         uint16_t        state;          /* 4 */
399                         uint16_t        reason;         /* 6 */
400                 } state;        /* 8 */
401                 /* AO_LOG_SENSOR */
402                 struct {
403                         uint32_t        pres;           /* 4 */
404                         uint32_t        temp;           /* 8 */
405                         int16_t         accel;          /* 12 */
406                 } sensor;       /* 14 */
407                 /* AO_LOG_TEMP_VOLT */
408                 struct {
409                         int16_t         v_batt;         /* 4 */
410                         int16_t         sense_a;        /* 6 */
411                         int16_t         sense_m;        /* 8 */
412                 } volt;         /* 10 */
413                 /* AO_LOG_GPS_POS */
414                 struct {
415                         int32_t         latitude;       /* 4 */
416                         int32_t         longitude;      /* 8 */
417                         uint16_t        altitude_low;   /* 12 */
418                         int16_t         altitude_high;  /* 14 */
419                 } gps;          /* 16 */
420                 /* AO_LOG_GPS_TIME */
421                 struct {
422                         uint8_t         hour;           /* 4 */
423                         uint8_t         minute;         /* 5 */
424                         uint8_t         second;         /* 6 */
425                         uint8_t         flags;          /* 7 */
426                         uint8_t         year;           /* 8 */
427                         uint8_t         month;          /* 9 */
428                         uint8_t         day;            /* 10 */
429                         uint8_t         pdop;           /* 11 */
430                 } gps_time;     /* 12 */
431                 /* AO_LOG_GPS_SAT (up to three packets) */
432                 struct {
433                         uint8_t channels;               /* 4 */
434                         uint8_t more;                   /* 5 */
435                         struct {
436                                 uint8_t svid;
437                                 uint8_t c_n;
438                         } sats[4];                      /* 6 */
439                 } gps_sat;                              /* 14 */
440                 uint8_t         raw[12];                /* 4 */
441         } u;    /* 16 */
442 };
443
444 struct ao_log_mini {
445         char            type;                           /* 0 */
446         uint8_t         csum;                           /* 1 */
447         uint16_t        tick;                           /* 2 */
448         union {                                         /* 4 */
449                 /* AO_LOG_FLIGHT */
450                 struct {
451                         uint16_t        flight;         /* 4 */
452                         uint16_t        r6;
453                         int32_t         ground_pres;    /* 8 */
454                 } flight;
455                 /* AO_LOG_STATE */
456                 struct {
457                         uint16_t        state;          /* 4 */
458                         uint16_t        reason;         /* 6 */
459                 } state;
460                 /* AO_LOG_SENSOR */
461                 struct {
462                         uint8_t         pres[3];        /* 4 */
463                         uint8_t         temp[3];        /* 7 */
464                         int16_t         sense_a;        /* 10 */
465                         int16_t         sense_m;        /* 12 */
466                         int16_t         v_batt;         /* 14 */
467                 } sensor;                               /* 16 */
468         } u;                                            /* 16 */
469 };                                                      /* 16 */
470
471 #define ao_log_pack24(dst,value) do {           \
472                 (dst)[0] = (uint8_t) (value);   \
473                 (dst)[1] = (uint8_t) ((value) >> 8);    \
474                 (dst)[2] = (uint8_t) ((value) >> 16);   \
475         } while (0)
476
477 struct ao_log_gps {
478         char                    type;                   /* 0 */
479         uint8_t                 csum;                   /* 1 */
480         uint16_t                tick;                   /* 2 */
481         union {                                         /* 4 */
482                 /* AO_LOG_FLIGHT */
483                 struct {
484                         uint16_t        flight;                 /* 4 */
485                         int16_t         start_altitude;         /* 6 */
486                         int32_t         start_latitude;         /* 8 */
487                         int32_t         start_longitude;        /* 12 */
488                 } flight;                                       /* 16 */
489                 /* AO_LOG_GPS_TIME */
490                 struct {
491                         int32_t         latitude;       /* 4 */
492                         int32_t         longitude;      /* 8 */
493                         uint16_t        altitude_low;   /* 12 */
494                         uint8_t         hour;           /* 14 */
495                         uint8_t         minute;         /* 15 */
496                         uint8_t         second;         /* 16 */
497                         uint8_t         flags;          /* 17 */
498                         uint8_t         year;           /* 18 */
499                         uint8_t         month;          /* 19 */
500                         uint8_t         day;            /* 20 */
501                         uint8_t         course;         /* 21 */
502                         uint16_t        ground_speed;   /* 22 */
503                         int16_t         climb_rate;     /* 24 */
504                         uint8_t         pdop;           /* 26 */
505                         uint8_t         hdop;           /* 27 */
506                         uint8_t         vdop;           /* 28 */
507                         uint8_t         mode;           /* 29 */
508                         int16_t         altitude_high;  /* 30 */
509                 } gps;  /* 31 */
510                 /* AO_LOG_GPS_SAT */
511                 struct {
512                         uint16_t        channels;       /* 4 */
513                         struct {
514                                 uint8_t svid;
515                                 uint8_t c_n;
516                         } sats[12];                     /* 6 */
517                 } gps_sat;                              /* 30 */
518         } u;
519 };
520
521 struct ao_log_motor {
522         char                    type;                   /* 0 */
523         uint8_t                 csum;                   /* 1 */
524         uint16_t                tick;                   /* 2 */
525         union {                                         /* 4 */
526                 /* AO_LOG_FLIGHT */
527                 struct {
528                         uint16_t        flight;                 /* 4 */
529                         int16_t         ground_accel;           /* 6 */
530                         int16_t         ground_accel_along;     /* 8 */
531                         int16_t         ground_accel_across;    /* 10 */
532                         int16_t         ground_accel_through;   /* 12 */
533                         int16_t         ground_motor_pressure;  /* 14 */
534                 } flight;                                       /* 16 */
535                 /* AO_LOG_STATE */
536                 struct {
537                         uint16_t        state;                  /* 4 */
538                         uint16_t        reason;                 /* 6 */
539                 } state;
540                 /* AO_LOG_SENSOR */
541                 struct {
542                         uint16_t        pressure;               /* 4 */
543                         uint16_t        v_batt;                 /* 6 */
544                         int16_t         accel;                  /* 8 */
545                         int16_t         accel_across;           /* 10 */
546                         int16_t         accel_along;            /* 12 */
547                         int16_t         accel_through;          /* 14 */
548                 } sensor;                                       /* 16 */
549         } u;
550 };
551
552 #if AO_LOG_FORMAT == AO_LOG_FOMAT_TELEMEGA_OLD || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_3 || AO_LOG_FORMAT == AO_LOG_FORMAT_EASYMEGA_2 || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_4 || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_5
553 typedef struct ao_log_mega ao_log_type;
554 #endif
555
556 #if AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMETRUM
557 typedef struct ao_log_metrum ao_log_type;
558 #endif
559
560 #if AO_LOG_FORMAT == AO_LOG_FORMAT_TELEFIRETWO
561 typedef struct ao_log_firetwo ao_log_type;
562 #endif
563
564 #if AO_LOG_FORMAT == AO_LOG_FORMAT_EASYMINI1 || AO_LOG_FORMAT == AO_LOG_FORMAT_EASYMINI2 || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMINI2 || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMINI3
565 typedef struct ao_log_mini ao_log_type;
566 #endif
567
568 #if AO_LOG_FORMAT == AO_LOG_FORMAT_EASYMOTOR
569 typedef struct ao_log_motor ao_log_type;
570 #endif 
571
572 #if AO_LOG_FORMAT == AO_LOG_FORMAT_TELEGPS
573 typedef struct ao_log_gps ao_log_type;
574 #endif
575
576 #if AO_LOG_FORMAT == AO_LOG_FORMAT_FULL
577 typedef struct ao_log_record ao_log_type;
578 #endif
579
580 #if AO_LOG_FORMAT == AO_LOG_FORMAT_TINY
581 #define AO_LOG_UNCOMMON 1
582 #endif
583
584 #if AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMETRY
585 #define AO_LOG_UNCOMMON 1
586 #endif
587
588 #if AO_LOG_FORMAT == AO_LOG_FORMAT_TELESCIENCE
589 #define AO_LOG_UNCOMMON 1
590 #endif
591
592 #if AO_LOG_FORMAT == AO_LOG_FORMAT_MICROPEAK2
593 #define AO_LOG_UNCOMMON 1
594 #endif
595
596 #ifndef AO_LOG_UNCOMMON
597 extern ao_log_type ao_log_data;
598
599 #define AO_LOG_SIZE sizeof(ao_log_type)
600
601 /* Write a record to the eeprom log */
602
603 uint8_t
604 ao_log_write(ao_log_type *log);
605 #endif
606
607 void
608 ao_log_flush(void);
609
610 void
611 ao_gps_report_metrum_init(void);
612
613 #endif /* _AO_LOG_H_ */