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/>.
38 TABLE_GPS_RESCUE_SANITY_CHECK
,
39 TABLE_GPS_RESCUE_ALT_MODE
,
42 TABLE_BLACKBOX_DEVICE
,
44 TABLE_BLACKBOX_SAMPLE_RATE
,
57 TABLE_GYRO_HARDWARE_LPF
,
66 TABLE_MOTOR_PWM_PROTOCOL
,
70 TABLE_FAILSAFE_SWITCH_MODE
,
72 #ifdef USE_CAMERA_CONTROL
73 TABLE_CAMERA_CONTROL_MODE
,
79 #ifdef USE_RX_FRSKY_SPI
80 TABLE_RX_FRSKY_SPI_A1_SOURCE
,
82 #ifdef USE_RANGEFINDER
83 TABLE_RANGEFINDER_HARDWARE
,
85 #ifdef USE_GYRO_OVERFLOW_CHECK
86 TABLE_GYRO_OVERFLOW_CHECK
,
98 TABLE_THROTTLE_LIMIT_TYPE
,
99 #if defined(USE_VIDEO_SYSTEM)
102 #if defined(USE_ITERM_RELAX)
104 TABLE_ITERM_RELAX_TYPE
,
106 #ifdef USE_ACRO_TRAINER
107 TABLE_ACRO_TRAINER_DEBUG
,
108 #endif // USE_ACRO_TRAINER
109 #ifdef USE_RC_SMOOTHING_FILTER
110 TABLE_RC_SMOOTHING_DEBUG
,
111 #endif // USE_RC_SMOOTHING_FILTER
112 #ifdef USE_VTX_COMMON
113 TABLE_VTX_LOW_POWER_DISARM
,
119 #ifdef USE_LAUNCH_CONTROL
120 TABLE_LAUNCH_CONTROL_MODE
,
127 TABLE_LEDSTRIP_COLOR
,
129 TABLE_GYRO_FILTER_DEBUG
,
130 TABLE_POSITION_ALT_SOURCE
,
132 TABLE_FEEDFORWARD_AVERAGING
,
133 TABLE_DSHOT_BITBANGED_TIMER
,
134 TABLE_OSD_DISPLAYPORT_DEVICE
,
136 TABLE_OSD_LOGO_ON_ARMING
,
139 TABLE_SIMPLIFIED_TUNING_PIDS_MODE
,
141 TABLE_CMS_BACKGROUND
,
143 #ifdef USE_RX_EXPRESSLRS
148 } lookupTableIndex_e
;
150 typedef struct lookupTableEntry_s
{
151 const char * const *values
;
152 const uint8_t valueCount
;
153 } lookupTableEntry_t
;
156 #define VALUE_TYPE_OFFSET 0
157 #define VALUE_SECTION_OFFSET 3
158 #define VALUE_MODE_OFFSET 5
161 // value type, bits 0-2
162 VAR_UINT8
= (0 << VALUE_TYPE_OFFSET
),
163 VAR_INT8
= (1 << VALUE_TYPE_OFFSET
),
164 VAR_UINT16
= (2 << VALUE_TYPE_OFFSET
),
165 VAR_INT16
= (3 << VALUE_TYPE_OFFSET
),
166 VAR_UINT32
= (4 << VALUE_TYPE_OFFSET
),
168 // value section, bits 3-4
169 MASTER_VALUE
= (0 << VALUE_SECTION_OFFSET
),
170 PROFILE_VALUE
= (1 << VALUE_SECTION_OFFSET
),
171 PROFILE_RATE_VALUE
= (2 << VALUE_SECTION_OFFSET
),
172 HARDWARE_VALUE
= (3 << VALUE_SECTION_OFFSET
), // Part of the master section, but used for the hardware definition
174 // value mode, bits 5-7
175 MODE_DIRECT
= (0 << VALUE_MODE_OFFSET
),
176 MODE_LOOKUP
= (1 << VALUE_MODE_OFFSET
),
177 MODE_ARRAY
= (2 << VALUE_MODE_OFFSET
),
178 MODE_BITSET
= (3 << VALUE_MODE_OFFSET
),
179 MODE_STRING
= (4 << VALUE_MODE_OFFSET
),
183 #define VALUE_TYPE_MASK (0x07)
184 #define VALUE_SECTION_MASK (0x18)
185 #define VALUE_MODE_MASK (0xE0)
187 typedef struct cliMinMaxConfig_s
{
192 typedef struct cliMinMaxUnsignedConfig_s
{
195 } cliMinMaxUnsignedConfig_t
;
197 typedef struct cliLookupTableConfig_s
{
198 const lookupTableIndex_e tableIndex
;
199 } cliLookupTableConfig_t
;
201 typedef struct cliArrayLengthConfig_s
{
202 const uint8_t length
;
203 } cliArrayLengthConfig_t
;
205 typedef struct cliStringLengthConfig_s
{
206 const uint8_t minlength
;
207 const uint8_t maxlength
;
209 } cliStringLengthConfig_t
;
211 #define STRING_FLAGS_NONE (0)
212 #define STRING_FLAGS_WRITEONCE (1 << 0)
215 cliLookupTableConfig_t lookup
; // used for MODE_LOOKUP excl. VAR_UINT32
216 cliMinMaxConfig_t minmax
; // used for MODE_DIRECT with signed parameters
217 cliMinMaxUnsignedConfig_t minmaxUnsigned
; // used for MODE_DIRECT with unsigned parameters
218 cliArrayLengthConfig_t array
; // used for MODE_ARRAY
219 cliStringLengthConfig_t string
; // used for MODE_STRING
220 uint8_t bitpos
; // used for MODE_BITSET
221 uint32_t u32Max
; // used for MODE_DIRECT with VAR_UINT32
224 typedef struct clivalue_s
{
226 const uint8_t type
; // see cliValueFlag_e
227 const cliValueConfig_t config
;
231 } __attribute__((packed
)) clivalue_t
;
234 extern const lookupTableEntry_t lookupTables
[];
235 extern const uint16_t valueTableEntryCount
;
237 extern const clivalue_t valueTable
[];
238 //extern const uint8_t lookupTablesEntryCount;
240 extern const char * const lookupTableGyroHardware
[];
242 extern const char * const lookupTableAccHardware
[];
243 //extern const uint8_t lookupTableAccHardwareEntryCount;
245 extern const char * const lookupTableBaroHardware
[];
246 //extern const uint8_t lookupTableBaroHardwareEntryCount;
248 extern const char * const lookupTableMagHardware
[];
249 //extern const uint8_t lookupTableMagHardwareEntryCount;
251 extern const char * const lookupTableRangefinderHardware
[];
253 extern const char * const lookupTableLedstripColors
[];
255 extern const char * const lookupTableRescueAltitudeMode
[];
257 extern const char * const lookupTableItermRelax
[];
259 extern const char * const lookupTableItermRelaxType
[];
261 extern const char * const lookupTableOsdDisplayPortDevice
[];
263 extern const char * const lookupTableFeedforwardAveraging
[];
265 extern const char * const lookupTableOffOn
[];
267 extern const char * const lookupTableSimplifiedTuningPidsMode
[];
269 extern const char * const lookupTableCMSMenuBackgroundType
[];