2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
23 typedef enum FlightLogFieldCondition
{
24 FLIGHT_LOG_FIELD_CONDITION_ALWAYS
= 0,
25 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_1
,
26 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_2
,
27 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_3
,
28 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_4
,
29 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_5
,
30 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_6
,
31 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_7
,
32 FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_8
,
33 FLIGHT_LOG_FIELD_CONDITION_TRICOPTER
,
35 FLIGHT_LOG_FIELD_CONDITION_MAG
,
36 FLIGHT_LOG_FIELD_CONDITION_BARO
,
37 FLIGHT_LOG_FIELD_CONDITION_VBAT
,
38 FLIGHT_LOG_FIELD_CONDITION_AMPERAGE_ADC
,
39 FLIGHT_LOG_FIELD_CONDITION_RANGEFINDER
,
40 FLIGHT_LOG_FIELD_CONDITION_RSSI
,
42 FLIGHT_LOG_FIELD_CONDITION_PID
,
43 FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_0
,
44 FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_1
,
45 FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_2
,
47 FLIGHT_LOG_FIELD_CONDITION_RC_COMMANDS
,
48 FLIGHT_LOG_FIELD_CONDITION_SETPOINT
,
50 FLIGHT_LOG_FIELD_CONDITION_NOT_LOGGING_EVERY_FRAME
,
52 FLIGHT_LOG_FIELD_CONDITION_GYRO
,
53 FLIGHT_LOG_FIELD_CONDITION_ACC
,
54 FLIGHT_LOG_FIELD_CONDITION_DEBUG_LOG
,
56 FLIGHT_LOG_FIELD_CONDITION_NEVER
,
58 FLIGHT_LOG_FIELD_CONDITION_FIRST
= FLIGHT_LOG_FIELD_CONDITION_ALWAYS
,
59 FLIGHT_LOG_FIELD_CONDITION_LAST
= FLIGHT_LOG_FIELD_CONDITION_NEVER
60 } FlightLogFieldCondition
;
62 typedef enum FlightLogFieldSelect_e
{ // no more than 32
63 FLIGHT_LOG_FIELD_SELECT_PID
= 0,
64 FLIGHT_LOG_FIELD_SELECT_RC_COMMANDS
,
65 FLIGHT_LOG_FIELD_SELECT_SETPOINT
,
66 FLIGHT_LOG_FIELD_SELECT_BATTERY
,
67 FLIGHT_LOG_FIELD_SELECT_MAG
,
68 FLIGHT_LOG_FIELD_SELECT_ALTITUDE
,
69 FLIGHT_LOG_FIELD_SELECT_RSSI
,
70 FLIGHT_LOG_FIELD_SELECT_GYRO
,
71 FLIGHT_LOG_FIELD_SELECT_ACC
,
72 FLIGHT_LOG_FIELD_SELECT_DEBUG_LOG
,
73 FLIGHT_LOG_FIELD_SELECT_MOTOR
,
74 FLIGHT_LOG_FIELD_SELECT_GPS
,
75 FLIGHT_LOG_FIELD_SELECT_COUNT
76 } FlightLogFieldSelect_e
;
78 typedef enum FlightLogFieldPredictor
{
80 FLIGHT_LOG_FIELD_PREDICTOR_0
= 0,
82 //Predict that the field is the same as last frame:
83 FLIGHT_LOG_FIELD_PREDICTOR_PREVIOUS
= 1,
85 //Predict that the slope between this field and the previous item is the same as that between the past two history items:
86 FLIGHT_LOG_FIELD_PREDICTOR_STRAIGHT_LINE
= 2,
88 //Predict that this field is the same as the average of the last two history items:
89 FLIGHT_LOG_FIELD_PREDICTOR_AVERAGE_2
= 3,
91 //Predict that this field is minthrottle
92 FLIGHT_LOG_FIELD_PREDICTOR_MINTHROTTLE
= 4,
94 //Predict that this field is the same as motor 0
95 FLIGHT_LOG_FIELD_PREDICTOR_MOTOR_0
= 5,
97 //This field always increments
98 FLIGHT_LOG_FIELD_PREDICTOR_INC
= 6,
100 //Predict this GPS co-ordinate is the GPS home co-ordinate (or no prediction if that coordinate is not set)
101 FLIGHT_LOG_FIELD_PREDICTOR_HOME_COORD
= 7,
104 FLIGHT_LOG_FIELD_PREDICTOR_1500
= 8,
106 //Predict vbatref, the reference ADC level stored in the header
107 FLIGHT_LOG_FIELD_PREDICTOR_VBATREF
= 9,
109 //Predict the last time value written in the main stream
110 FLIGHT_LOG_FIELD_PREDICTOR_LAST_MAIN_FRAME_TIME
= 10,
112 //Predict that this field is the minimum motor output
113 FLIGHT_LOG_FIELD_PREDICTOR_MINMOTOR
= 11
115 } FlightLogFieldPredictor
;
117 typedef enum FlightLogFieldEncoding
{
118 FLIGHT_LOG_FIELD_ENCODING_SIGNED_VB
= 0, // Signed variable-byte
119 FLIGHT_LOG_FIELD_ENCODING_UNSIGNED_VB
= 1, // Unsigned variable-byte
120 FLIGHT_LOG_FIELD_ENCODING_NEG_14BIT
= 3, // Unsigned variable-byte but we negate the value before storing, value is 14 bits
121 FLIGHT_LOG_FIELD_ENCODING_TAG8_8SVB
= 6,
122 FLIGHT_LOG_FIELD_ENCODING_TAG2_3S32
= 7,
123 FLIGHT_LOG_FIELD_ENCODING_TAG8_4S16
= 8,
124 FLIGHT_LOG_FIELD_ENCODING_NULL
= 9, // Nothing is written to the file, take value to be zero
125 FLIGHT_LOG_FIELD_ENCODING_TAG2_3SVARIABLE
= 10
126 } FlightLogFieldEncoding
;
128 typedef enum FlightLogFieldSign
{
129 FLIGHT_LOG_FIELD_UNSIGNED
= 0,
130 FLIGHT_LOG_FIELD_SIGNED
= 1
131 } FlightLogFieldSign
;
133 typedef struct flightLogEvent_syncBeep_s
{
135 } flightLogEvent_syncBeep_t
;
137 typedef struct flightLogEvent_disarm_s
{
139 } flightLogEvent_disarm_t
;
141 typedef struct flightLogEvent_flightMode_s
{ // New Event Data type
144 } flightLogEvent_flightMode_t
;
146 typedef struct flightLogEvent_inflightAdjustment_s
{
149 uint8_t adjustmentFunction
;
151 } flightLogEvent_inflightAdjustment_t
;
153 typedef struct flightLogEvent_loggingResume_s
{
154 uint32_t logIteration
;
155 uint32_t currentTime
;
156 } flightLogEvent_loggingResume_t
;
158 #define FLIGHT_LOG_EVENT_INFLIGHT_ADJUSTMENT_FUNCTION_FLOAT_VALUE_FLAG 128
160 typedef union flightLogEventData_u
{
161 flightLogEvent_syncBeep_t syncBeep
;
162 flightLogEvent_flightMode_t flightMode
; // New event data
163 flightLogEvent_disarm_t disarm
;
164 flightLogEvent_inflightAdjustment_t inflightAdjustment
;
165 flightLogEvent_loggingResume_t loggingResume
;
166 } flightLogEventData_t
;
168 typedef struct flightLogEvent_s
{
169 FlightLogEvent event
;
170 flightLogEventData_t data
;