2 * This file is part of Cleanflight.
4 * Cleanflight 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 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
20 typedef enum FlightLogFieldCondition
{
21 FLIGHT_LOG_FIELD_CONDITION_ALWAYS
= 0,
22 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_1
,
23 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_2
,
24 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_3
,
25 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_4
,
26 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_5
,
27 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_6
,
28 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_7
,
29 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_8
,
30 FLIGHT_LOG_FIELD_CONDITION_TRICOPTER
,
32 FLIGHT_LOG_FIELD_CONDITION_MAG
,
33 FLIGHT_LOG_FIELD_CONDITION_BARO
,
34 FLIGHT_LOG_FIELD_CONDITION_VBAT
,
35 FLIGHT_LOG_FIELD_CONDITION_AMPERAGE_ADC
,
36 FLIGHT_LOG_FIELD_CONDITION_RANGEFINDER
,
37 FLIGHT_LOG_FIELD_CONDITION_RSSI
,
39 FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_0
,
40 FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_1
,
41 FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_2
,
43 FLIGHT_LOG_FIELD_CONDITION_NOT_LOGGING_EVERY_FRAME
,
45 FLIGHT_LOG_FIELD_CONDITION_ACC
,
46 FLIGHT_LOG_FIELD_CONDITION_DEBUG
,
48 FLIGHT_LOG_FIELD_CONDITION_NEVER
,
50 FLIGHT_LOG_FIELD_CONDITION_FIRST
= FLIGHT_LOG_FIELD_CONDITION_ALWAYS
,
51 FLIGHT_LOG_FIELD_CONDITION_LAST
= FLIGHT_LOG_FIELD_CONDITION_NEVER
52 } FlightLogFieldCondition
;
54 typedef enum FlightLogFieldPredictor
{
56 FLIGHT_LOG_FIELD_PREDICTOR_0
= 0,
58 //Predict that the field is the same as last frame:
59 FLIGHT_LOG_FIELD_PREDICTOR_PREVIOUS
= 1,
61 //Predict that the slope between this field and the previous item is the same as that between the past two history items:
62 FLIGHT_LOG_FIELD_PREDICTOR_STRAIGHT_LINE
= 2,
64 //Predict that this field is the same as the average of the last two history items:
65 FLIGHT_LOG_FIELD_PREDICTOR_AVERAGE_2
= 3,
67 //Predict that this field is minthrottle
68 FLIGHT_LOG_FIELD_PREDICTOR_MINTHROTTLE
= 4,
70 //Predict that this field is the same as motor 0
71 FLIGHT_LOG_FIELD_PREDICTOR_MOTOR_0
= 5,
73 //This field always increments
74 FLIGHT_LOG_FIELD_PREDICTOR_INC
= 6,
76 //Predict this GPS co-ordinate is the GPS home co-ordinate (or no prediction if that coordinate is not set)
77 FLIGHT_LOG_FIELD_PREDICTOR_HOME_COORD
= 7,
80 FLIGHT_LOG_FIELD_PREDICTOR_1500
= 8,
82 //Predict vbatref, the reference ADC level stored in the header
83 FLIGHT_LOG_FIELD_PREDICTOR_VBATREF
= 9,
85 //Predict the last time value written in the main stream
86 FLIGHT_LOG_FIELD_PREDICTOR_LAST_MAIN_FRAME_TIME
= 10,
88 //Predict that this field is the minimum motor output
89 FLIGHT_LOG_FIELD_PREDICTOR_MINMOTOR
= 11
91 } FlightLogFieldPredictor
;
93 typedef enum FlightLogFieldEncoding
{
94 FLIGHT_LOG_FIELD_ENCODING_SIGNED_VB
= 0, // Signed variable-byte
95 FLIGHT_LOG_FIELD_ENCODING_UNSIGNED_VB
= 1, // Unsigned variable-byte
96 FLIGHT_LOG_FIELD_ENCODING_NEG_14BIT
= 3, // Unsigned variable-byte but we negate the value before storing, value is 14 bits
97 FLIGHT_LOG_FIELD_ENCODING_TAG8_8SVB
= 6,
98 FLIGHT_LOG_FIELD_ENCODING_TAG2_3S32
= 7,
99 FLIGHT_LOG_FIELD_ENCODING_TAG8_4S16
= 8,
100 FLIGHT_LOG_FIELD_ENCODING_NULL
= 9, // Nothing is written to the file, take value to be zero
101 FLIGHT_LOG_FIELD_ENCODING_TAG2_3SVARIABLE
= 10
102 } FlightLogFieldEncoding
;
104 typedef enum FlightLogFieldSign
{
105 FLIGHT_LOG_FIELD_UNSIGNED
= 0,
106 FLIGHT_LOG_FIELD_SIGNED
= 1
107 } FlightLogFieldSign
;
109 typedef struct flightLogEvent_syncBeep_s
{
111 } flightLogEvent_syncBeep_t
;
113 typedef struct flightLogEvent_flightMode_s
{ // New Event Data type
116 } flightLogEvent_flightMode_t
;
118 typedef struct flightLogEvent_inflightAdjustment_s
{
121 uint8_t adjustmentFunction
;
123 } flightLogEvent_inflightAdjustment_t
;
125 typedef struct flightLogEvent_loggingResume_s
{
126 uint32_t logIteration
;
127 uint32_t currentTime
;
128 } flightLogEvent_loggingResume_t
;
130 #define FLIGHT_LOG_EVENT_INFLIGHT_ADJUSTMENT_FUNCTION_FLOAT_VALUE_FLAG 128
132 typedef union flightLogEventData_u
{
133 flightLogEvent_syncBeep_t syncBeep
;
134 flightLogEvent_flightMode_t flightMode
; // New event data
135 flightLogEvent_inflightAdjustment_t inflightAdjustment
;
136 flightLogEvent_loggingResume_t loggingResume
;
137 } flightLogEventData_t
;
139 typedef struct flightLogEvent_s
{
140 FlightLogEvent event
;
141 flightLogEventData_t data
;