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 #ifdef USE_DSHOT_TELEMETRY
36 FLIGHT_LOG_FIELD_CONDITION_MOTOR_1_HAS_RPM
,
37 FLIGHT_LOG_FIELD_CONDITION_MOTOR_2_HAS_RPM
,
38 FLIGHT_LOG_FIELD_CONDITION_MOTOR_3_HAS_RPM
,
39 FLIGHT_LOG_FIELD_CONDITION_MOTOR_4_HAS_RPM
,
40 FLIGHT_LOG_FIELD_CONDITION_MOTOR_5_HAS_RPM
,
41 FLIGHT_LOG_FIELD_CONDITION_MOTOR_6_HAS_RPM
,
42 FLIGHT_LOG_FIELD_CONDITION_MOTOR_7_HAS_RPM
,
43 FLIGHT_LOG_FIELD_CONDITION_MOTOR_8_HAS_RPM
,
47 FLIGHT_LOG_FIELD_CONDITION_SERVOS
,
50 FLIGHT_LOG_FIELD_CONDITION_MAG
,
51 FLIGHT_LOG_FIELD_CONDITION_BARO
,
52 FLIGHT_LOG_FIELD_CONDITION_VBAT
,
53 FLIGHT_LOG_FIELD_CONDITION_AMPERAGE_ADC
,
54 FLIGHT_LOG_FIELD_CONDITION_RANGEFINDER
,
55 FLIGHT_LOG_FIELD_CONDITION_RSSI
,
57 FLIGHT_LOG_FIELD_CONDITION_PID
,
58 FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_0
,
59 FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_1
,
60 FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_2
,
63 FLIGHT_LOG_FIELD_CONDITION_NONZERO_WING_S_0
,
64 FLIGHT_LOG_FIELD_CONDITION_NONZERO_WING_S_1
,
65 FLIGHT_LOG_FIELD_CONDITION_NONZERO_WING_S_2
,
68 FLIGHT_LOG_FIELD_CONDITION_RC_COMMANDS
,
69 FLIGHT_LOG_FIELD_CONDITION_SETPOINT
,
71 FLIGHT_LOG_FIELD_CONDITION_NOT_LOGGING_EVERY_FRAME
,
73 FLIGHT_LOG_FIELD_CONDITION_GYRO
,
74 FLIGHT_LOG_FIELD_CONDITION_GYROUNFILT
,
75 FLIGHT_LOG_FIELD_CONDITION_ACC
,
76 FLIGHT_LOG_FIELD_CONDITION_DEBUG_LOG
,
77 FLIGHT_LOG_FIELD_CONDITION_ATTITUDE
,
78 FLIGHT_LOG_FIELD_CONDITION_NEVER
,
80 FLIGHT_LOG_FIELD_CONDITION_FIRST
= FLIGHT_LOG_FIELD_CONDITION_ALWAYS
,
81 FLIGHT_LOG_FIELD_CONDITION_LAST
= FLIGHT_LOG_FIELD_CONDITION_NEVER
82 } FlightLogFieldCondition
;
84 typedef enum FlightLogFieldSelect_e
{ // no more than 32
85 FLIGHT_LOG_FIELD_SELECT_PID
= 0,
86 FLIGHT_LOG_FIELD_SELECT_RC_COMMANDS
,
87 FLIGHT_LOG_FIELD_SELECT_SETPOINT
,
88 FLIGHT_LOG_FIELD_SELECT_BATTERY
,
89 FLIGHT_LOG_FIELD_SELECT_MAG
,
90 FLIGHT_LOG_FIELD_SELECT_ALTITUDE
,
91 FLIGHT_LOG_FIELD_SELECT_RSSI
,
92 FLIGHT_LOG_FIELD_SELECT_GYRO
,
93 FLIGHT_LOG_FIELD_SELECT_ATTITUDE
,
94 FLIGHT_LOG_FIELD_SELECT_ACC
,
95 FLIGHT_LOG_FIELD_SELECT_DEBUG_LOG
,
96 FLIGHT_LOG_FIELD_SELECT_MOTOR
,
97 FLIGHT_LOG_FIELD_SELECT_GPS
,
98 FLIGHT_LOG_FIELD_SELECT_RPM
,
99 FLIGHT_LOG_FIELD_SELECT_GYROUNFILT
,
100 FLIGHT_LOG_FIELD_SELECT_SERVO
,
101 FLIGHT_LOG_FIELD_SELECT_COUNT
102 } FlightLogFieldSelect_e
;
104 typedef enum FlightLogFieldPredictor
{
106 FLIGHT_LOG_FIELD_PREDICTOR_0
= 0,
108 //Predict that the field is the same as last frame:
109 FLIGHT_LOG_FIELD_PREDICTOR_PREVIOUS
= 1,
111 //Predict that the slope between this field and the previous item is the same as that between the past two history items:
112 FLIGHT_LOG_FIELD_PREDICTOR_STRAIGHT_LINE
= 2,
114 //Predict that this field is the same as the average of the last two history items:
115 FLIGHT_LOG_FIELD_PREDICTOR_AVERAGE_2
= 3,
117 //Predict that this field is minthrottle
118 FLIGHT_LOG_FIELD_PREDICTOR_MINTHROTTLE
= 4,
120 //Predict that this field is the same as motor 0
121 FLIGHT_LOG_FIELD_PREDICTOR_MOTOR_0
= 5,
123 //This field always increments
124 FLIGHT_LOG_FIELD_PREDICTOR_INC
= 6,
126 //Predict this GPS co-ordinate is the GPS home co-ordinate (or no prediction if that coordinate is not set)
127 FLIGHT_LOG_FIELD_PREDICTOR_HOME_COORD
= 7,
130 FLIGHT_LOG_FIELD_PREDICTOR_1500
= 8,
132 //Predict vbatref, the reference ADC level stored in the header
133 FLIGHT_LOG_FIELD_PREDICTOR_VBATREF
= 9,
135 //Predict the last time value written in the main stream
136 FLIGHT_LOG_FIELD_PREDICTOR_LAST_MAIN_FRAME_TIME
= 10,
138 //Predict that this field is the minimum motor output
139 FLIGHT_LOG_FIELD_PREDICTOR_MINMOTOR
= 11
141 } FlightLogFieldPredictor
;
143 typedef enum FlightLogFieldEncoding
{
144 FLIGHT_LOG_FIELD_ENCODING_SIGNED_VB
= 0, // Signed variable-byte
145 FLIGHT_LOG_FIELD_ENCODING_UNSIGNED_VB
= 1, // Unsigned variable-byte
146 FLIGHT_LOG_FIELD_ENCODING_NEG_14BIT
= 3, // Unsigned variable-byte but we negate the value before storing, value is 14 bits
147 FLIGHT_LOG_FIELD_ENCODING_TAG8_8SVB
= 6,
148 FLIGHT_LOG_FIELD_ENCODING_TAG2_3S32
= 7,
149 FLIGHT_LOG_FIELD_ENCODING_TAG8_4S16
= 8,
150 FLIGHT_LOG_FIELD_ENCODING_NULL
= 9, // Nothing is written to the file, take value to be zero
151 FLIGHT_LOG_FIELD_ENCODING_TAG2_3SVARIABLE
= 10
152 } FlightLogFieldEncoding
;
154 typedef enum FlightLogFieldSign
{
155 FLIGHT_LOG_FIELD_UNSIGNED
= 0,
156 FLIGHT_LOG_FIELD_SIGNED
= 1
157 } FlightLogFieldSign
;
159 typedef struct flightLogEvent_syncBeep_s
{
161 } flightLogEvent_syncBeep_t
;
163 typedef struct flightLogEvent_disarm_s
{
165 } flightLogEvent_disarm_t
;
167 typedef struct flightLogEvent_flightMode_s
{ // New Event Data type
170 } flightLogEvent_flightMode_t
;
172 typedef struct flightLogEvent_inflightAdjustment_s
{
175 uint8_t adjustmentFunction
;
177 } flightLogEvent_inflightAdjustment_t
;
179 typedef struct flightLogEvent_loggingResume_s
{
180 uint32_t logIteration
;
181 uint32_t currentTime
;
182 } flightLogEvent_loggingResume_t
;
184 #define FLIGHT_LOG_EVENT_INFLIGHT_ADJUSTMENT_FUNCTION_FLOAT_VALUE_FLAG 128
186 typedef union flightLogEventData_u
{
187 flightLogEvent_syncBeep_t syncBeep
;
188 flightLogEvent_flightMode_t flightMode
; // New event data
189 flightLogEvent_disarm_t disarm
;
190 flightLogEvent_inflightAdjustment_t inflightAdjustment
;
191 flightLogEvent_loggingResume_t loggingResume
;
192 } flightLogEventData_t
;
194 typedef struct flightLogEvent_s
{
195 FlightLogEvent event
;
196 flightLogEventData_t data
;