Add DUAL_GYRO_SCALED debug mode to capture raw scaled roll/pitch from each gyro
[betaflight.git] / src / main / build / debug.h
blob6126f5e210bb637119f9b3cb5c9986610f969941
1 /*
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)
8 * any later version.
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/>.
21 #pragma once
23 #define DEBUG16_VALUE_COUNT 4
24 extern int16_t debug[DEBUG16_VALUE_COUNT];
25 extern uint8_t debugMode;
27 #define DEBUG_SET(mode, index, value) {if (debugMode == (mode)) {debug[(index)] = (value);}}
29 #define DEBUG_SECTION_TIMES
31 #ifdef DEBUG_SECTION_TIMES
32 extern uint32_t sectionTimes[2][4];
34 #define TIME_SECTION_BEGIN(index) { \
35 extern uint32_t sectionTimes[2][4]; \
36 sectionTimes[0][index] = micros(); \
39 #define TIME_SECTION_END(index) { \
40 extern uint32_t sectionTimes[2][4]; \
41 sectionTimes[1][index] = micros(); \
42 debug[index] = sectionTimes[1][index] - sectionTimes[0][index]; \
44 #else
46 #define TIME_SECTION_BEGIN(index) {}
47 #define TIME_SECTION_END(index) {}
49 #endif
51 typedef enum {
52 DEBUG_NONE,
53 DEBUG_CYCLETIME,
54 DEBUG_BATTERY,
55 DEBUG_GYRO_FILTERED,
56 DEBUG_ACCELEROMETER,
57 DEBUG_PIDLOOP,
58 DEBUG_GYRO_SCALED,
59 DEBUG_RC_INTERPOLATION,
60 DEBUG_ANGLERATE,
61 DEBUG_ESC_SENSOR,
62 DEBUG_SCHEDULER,
63 DEBUG_STACK,
64 DEBUG_ESC_SENSOR_RPM,
65 DEBUG_ESC_SENSOR_TMP,
66 DEBUG_ALTITUDE,
67 DEBUG_FFT,
68 DEBUG_FFT_TIME,
69 DEBUG_FFT_FREQ,
70 DEBUG_RX_FRSKY_SPI,
71 DEBUG_RX_SFHSS_SPI,
72 DEBUG_GYRO_RAW,
73 DEBUG_DUAL_GYRO,
74 DEBUG_DUAL_GYRO_RAW,
75 DEBUG_DUAL_GYRO_COMBINE,
76 DEBUG_DUAL_GYRO_DIFF,
77 DEBUG_MAX7456_SIGNAL,
78 DEBUG_MAX7456_SPICLOCK,
79 DEBUG_SBUS,
80 DEBUG_FPORT,
81 DEBUG_RANGEFINDER,
82 DEBUG_RANGEFINDER_QUALITY,
83 DEBUG_LIDAR_TF,
84 DEBUG_ADC_INTERNAL,
85 DEBUG_RUNAWAY_TAKEOFF,
86 DEBUG_SDIO,
87 DEBUG_CURRENT_SENSOR,
88 DEBUG_USB,
89 DEBUG_SMARTAUDIO,
90 DEBUG_RTH,
91 DEBUG_ITERM_RELAX,
92 DEBUG_ACRO_TRAINER,
93 DEBUG_RC_SMOOTHING,
94 DEBUG_RX_SIGNAL_LOSS,
95 DEBUG_RC_SMOOTHING_RATE,
96 DEBUG_ANTI_GRAVITY,
97 DEBUG_DYN_LPF,
98 DEBUG_RX_SPEKTRUM_SPI,
99 DEBUG_DSHOT_RPM_TELEMETRY,
100 DEBUG_RPM_FILTER,
101 DEBUG_D_MIN,
102 DEBUG_AC_CORRECTION,
103 DEBUG_AC_ERROR,
104 DEBUG_DUAL_GYRO_SCALED,
105 DEBUG_COUNT
106 } debugType_e;
108 extern const char * const debugModeNames[DEBUG_COUNT];