vtx: fix VTX_SETTINGS_POWER_COUNT and add dummy entries to saPowerNames
[inav.git] / src / main / build / debug.h
blob0bb74bac1acd4f36ea73dbbca5aa68f10bf171f0
1 /*
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/>.
18 #pragma once
20 #include <stddef.h>
21 #include <stdint.h>
22 #include <stdbool.h>
24 #include "platform.h"
26 #define DEBUG32_VALUE_COUNT 8
27 extern int32_t debug[DEBUG32_VALUE_COUNT];
28 extern uint8_t debugMode;
30 #define DEBUG_SET(mode, index, value) {if (debugMode == (mode)) {debug[(index)] = (value);}}
32 #define DEBUG_SECTION_TIMES
34 #ifdef DEBUG_SECTION_TIMES
35 #include "common/time.h"
36 extern timeUs_t sectionTimes[2][4];
38 #define TIME_SECTION_BEGIN(index) { \
39 extern timeUs_t sectionTimes[2][4]; \
40 sectionTimes[0][index] = micros(); \
43 #define TIME_SECTION_END(index) { \
44 extern timeUs_t sectionTimes[2][4]; \
45 sectionTimes[1][index] = micros(); \
46 debug[index] = sectionTimes[1][index] - sectionTimes[0][index]; \
48 #else
50 #define TIME_SECTION_BEGIN(index) {}
51 #define TIME_SECTION_END(index) {}
53 #endif
55 typedef enum {
56 DEBUG_NONE,
57 DEBUG_AGL,
58 DEBUG_FLOW_RAW,
59 DEBUG_FLOW,
60 DEBUG_ALWAYS,
61 DEBUG_SAG_COMP_VOLTAGE,
62 DEBUG_VIBE,
63 DEBUG_CRUISE,
64 DEBUG_REM_FLIGHT_TIME,
65 DEBUG_SMARTAUDIO,
66 DEBUG_ACC,
67 DEBUG_NAV_YAW,
68 DEBUG_PCF8574,
69 DEBUG_DYNAMIC_GYRO_LPF,
70 DEBUG_AUTOLEVEL,
71 DEBUG_ALTITUDE,
72 DEBUG_AUTOTRIM,
73 DEBUG_AUTOTUNE,
74 DEBUG_RATE_DYNAMICS,
75 DEBUG_LANDING,
76 DEBUG_POS_EST,
77 DEBUG_ADAPTIVE_FILTER,
78 DEBUG_HEADTRACKING,
79 DEBUG_GPS,
80 DEBUG_LULU,
81 DEBUG_SBUS2,
82 DEBUG_COUNT // also update debugModeNames in cli.c
83 } debugType_e;
85 #ifdef SITL_BUILD
86 #define SD(X) (X)
87 #else
88 #define SD(X)
89 #endif