Various fixes around Companion trainer mode (#7116)
[opentx.git] / radio / src / dataconstants.h
blobc747b39bbf2e6f3f5dbc59a9918a3fd1aa527ce7
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _DATACONSTANTS_H_
22 #define _DATACONSTANTS_H_
24 #include "board.h"
26 #define NUM_STICKS 4
28 #if defined(EXPORT)
29 #define LUA_EXPORT(...) LEXP(__VA_ARGS__)
30 #define LUA_EXPORT_MULTIPLE(...) LEXP_MULTIPLE(__VA_ARGS__)
31 #define LUA_EXPORT_EXTRA(...) LEXP_EXTRA(__VA_ARGS__)
32 #else
33 #define LUA_EXPORT(...)
34 #define LUA_EXPORT_MULTIPLE(...)
35 #define LUA_EXPORT_EXTRA(...)
36 #endif
38 #if defined(PCBHORUS)
39 #define MAX_MODELS 60
40 #define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
41 #define MAX_FLIGHT_MODES 9
42 #define MAX_MIXERS 64
43 #define MAX_EXPOS 64
44 #define MAX_LOGICAL_SWITCHES 64
45 #define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
46 #define MAX_SCRIPTS 9
47 #define MAX_INPUTS 32
48 #define MAX_TRAINER_CHANNELS 16
49 #define MAX_TELEMETRY_SENSORS 60
50 #define MAX_CUSTOM_SCREENS 5
51 #elif defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX9E)
52 #define MAX_MODELS 60
53 #define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
54 #define MAX_FLIGHT_MODES 9
55 #define MAX_MIXERS 64
56 #define MAX_EXPOS 64
57 #define MAX_LOGICAL_SWITCHES 64
58 #define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
59 #define MAX_SCRIPTS 7
60 #define MAX_INPUTS 32
61 #define MAX_TRAINER_CHANNELS 16
62 #define MAX_TELEMETRY_SENSORS 60
63 #elif defined(PCBTARANIS)
64 #define MAX_MODELS 60
65 #define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
66 #define MAX_FLIGHT_MODES 9
67 #define MAX_MIXERS 64
68 #define MAX_EXPOS 64
69 #define MAX_LOGICAL_SWITCHES 64
70 #define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
71 #define MAX_SCRIPTS 7
72 #define MAX_INPUTS 32
73 #define MAX_TRAINER_CHANNELS 16
74 #define MAX_TELEMETRY_SENSORS 40
75 #elif defined(PCBSKY9X)
76 #define MAX_MODELS 60
77 #define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
78 #define MAX_FLIGHT_MODES 9
79 #define MAX_MIXERS 64
80 #define MAX_EXPOS 32
81 #define MAX_LOGICAL_SWITCHES 64
82 #define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
83 #define MAX_INPUTS 32
84 #define MAX_TRAINER_CHANNELS 16
85 #define MAX_TELEMETRY_SENSORS 40
86 #else
87 #warning "Unknown board!"
88 #endif
90 #define MAX_TIMERS 3
91 #define NUM_CAL_PPM 4
93 enum CurveType {
94 CURVE_TYPE_STANDARD,
95 CURVE_TYPE_CUSTOM,
96 CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM
99 #define MIN_POINTS_PER_CURVE 3
100 #define MAX_POINTS_PER_CURVE 17
102 #if defined(PCBHORUS)
103 #define LEN_MODEL_NAME 15
104 #define LEN_TIMER_NAME 8
105 #define LEN_FLIGHT_MODE_NAME 10
106 #define LEN_BITMAP_NAME 14
107 #define LEN_EXPOMIX_NAME 6
108 #define LEN_CHANNEL_NAME 6
109 #define LEN_INPUT_NAME 4
110 #define LEN_CURVE_NAME 3
111 #define LEN_FUNCTION_NAME 6
112 #define MAX_CURVES 32
113 #define MAX_CURVE_POINTS 512
114 #elif LCD_W == 212
115 #define LEN_MODEL_NAME 12
116 #define LEN_TIMER_NAME 8
117 #define LEN_FLIGHT_MODE_NAME 10
118 #define LEN_BITMAP_NAME 10
119 #define LEN_EXPOMIX_NAME 6
120 #define LEN_CHANNEL_NAME 6
121 #define LEN_INPUT_NAME 4
122 #define LEN_CURVE_NAME 3
123 #define LEN_FUNCTION_NAME 8
124 #define MAX_CURVES 32
125 #define MAX_CURVE_POINTS 512
126 #else
127 #define LEN_MODEL_NAME 10
128 #define LEN_TIMER_NAME 3
129 #define LEN_FLIGHT_MODE_NAME 6
130 #define LEN_EXPOMIX_NAME 6
131 #define LEN_CHANNEL_NAME 4
132 #define LEN_INPUT_NAME 3
133 #define LEN_CURVE_NAME 3
134 #define LEN_FUNCTION_NAME 6
135 #define MAX_CURVES 32
136 #define MAX_CURVE_POINTS 512
137 #endif
139 #if defined(PCBTARANIS) || defined(PCBSKY9X) || defined(PCBHORUS)
140 #define NUM_MODULES 2
141 #else
142 #define NUM_MODULES 1
143 #endif
145 #define XPOTS_MULTIPOS_COUNT 6
147 #if defined(COLORLCD)
148 enum MainViews {
149 VIEW_BLANK,
150 VIEW_TIMERS_ALTITUDE,
151 VIEW_CHANNELS,
152 VIEW_TELEM1,
153 VIEW_TELEM2,
154 VIEW_TELEM3,
155 VIEW_TELEM4,
156 VIEW_COUNT
158 #elif LCD_W >= 212
159 enum MainViews {
160 VIEW_TIMERS,
161 VIEW_INPUTS,
162 VIEW_SWITCHES,
163 VIEW_COUNT
165 #else
166 enum MainViews {
167 VIEW_OUTPUTS_VALUES,
168 VIEW_OUTPUTS_BARS,
169 VIEW_INPUTS,
170 VIEW_TIMER2,
171 VIEW_COUNT
173 #endif
175 enum BeeperMode {
176 e_mode_quiet = -2,
177 e_mode_alarms,
178 e_mode_nokeys,
179 e_mode_all
182 #if defined(PCBTARANIS) || defined(PCBHORUS)
183 enum ModuleIndex {
184 INTERNAL_MODULE,
185 EXTERNAL_MODULE,
186 SPORT_MODULE,
188 enum TrainerMode {
189 TRAINER_MODE_MASTER_TRAINER_JACK,
190 TRAINER_MODE_SLAVE,
191 #if defined(PCBTARANIS)
192 TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE,
193 TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
194 TRAINER_MODE_MASTER_BATTERY_COMPARTMENT,
195 #endif
196 TRAINER_MODE_MASTER_BLUETOOTH,
197 TRAINER_MODE_SLAVE_BLUETOOTH,
198 TRAINER_MODE_MULTI,
200 #elif defined(PCBSKY9X)
201 enum ModuleIndex {
202 EXTERNAL_MODULE,
203 EXTRA_MODULE,
204 SPORT_MODULE
206 #endif
208 #if defined(RADIO_T16)
209 #define TRAINER_MODE_MAX() TRAINER_MODE_MULTI
210 #elif defined(BLUETOOTH)
211 #define TRAINER_MODE_MAX() TRAINER_MODE_SLAVE_BLUETOOTH
212 #elif defined(PCBX7) || defined(PCBXLITE)
213 #define TRAINER_MODE_MAX() TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE
214 #else
215 #define TRAINER_MODE_MAX() HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE
216 #endif
218 #if defined(HARDWARE_INTERNAL_MODULE)
219 #define IS_INTERNAL_MODULE_ENABLED() (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_NONE)
220 #else
221 #define IS_INTERNAL_MODULE_ENABLED() (false)
222 #endif
224 #define IS_EXTERNAL_MODULE_ENABLED() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_NONE)
226 #if defined(HARDWARE_INTERNAL_MODULE)
227 #define IS_MODULE_ENABLED(moduleIdx) (moduleIdx==INTERNAL_MODULE ? IS_INTERNAL_MODULE_ENABLED() : moduleIdx==EXTERNAL_MODULE ? IS_EXTERNAL_MODULE_ENABLED() : false)
228 #else
229 #define IS_MODULE_ENABLED(moduleIdx) (moduleIdx==EXTERNAL_MODULE ? IS_EXTERNAL_MODULE_ENABLED() : false)
230 #endif
232 enum UartModes {
233 #if defined(CLI) || defined(DEBUG)
234 UART_MODE_DEBUG,
235 #else
236 UART_MODE_NONE,
237 #endif
238 UART_MODE_TELEMETRY_MIRROR,
239 UART_MODE_TELEMETRY,
240 UART_MODE_SBUS_TRAINER,
241 UART_MODE_LUA,
242 UART_MODE_COUNT,
243 UART_MODE_MAX = UART_MODE_COUNT-1
246 #if defined(PCBHORUS)
247 #define LEN_SWITCH_NAME 3
248 #define LEN_ANA_NAME 3
249 #define LEN_MODEL_FILENAME 16
250 #define LEN_BLUETOOTH_NAME 10
251 #else
252 #define LEN_SWITCH_NAME 3
253 #define LEN_ANA_NAME 3
254 #define LEN_BLUETOOTH_NAME 10
255 #endif
257 enum TelemetryProtocol
259 PROTOCOL_TELEMETRY_FIRST,
260 PROTOCOL_TELEMETRY_FRSKY_SPORT = PROTOCOL_TELEMETRY_FIRST,
261 PROTOCOL_TELEMETRY_FRSKY_D,
262 PROTOCOL_TELEMETRY_FRSKY_D_SECONDARY,
263 PROTOCOL_TELEMETRY_CROSSFIRE,
264 PROTOCOL_TELEMETRY_SPEKTRUM,
265 PROTOCOL_TELEMETRY_FLYSKY_IBUS,
266 PROTOCOL_TELEMETRY_HITEC,
267 PROTOCOL_TELEMETRY_HOTT,
268 PROTOCOL_TELEMETRY_MULTIMODULE,
269 PROTOCOL_TELEMETRY_LAST=PROTOCOL_TELEMETRY_MULTIMODULE,
270 PROTOCOL_TELEMETRY_LUA
273 #define TELEM_LABEL_LEN 4
274 enum TelemetryUnit {
275 UNIT_RAW,
276 UNIT_VOLTS,
277 UNIT_AMPS,
278 UNIT_MILLIAMPS,
279 UNIT_KTS,
280 UNIT_METERS_PER_SECOND,
281 UNIT_FEET_PER_SECOND,
282 UNIT_KMH,
283 UNIT_SPEED = UNIT_KMH,
284 UNIT_MPH,
285 UNIT_METERS,
286 UNIT_DIST = UNIT_METERS,
287 UNIT_FEET,
288 UNIT_CELSIUS,
289 UNIT_TEMPERATURE = UNIT_CELSIUS,
290 UNIT_FAHRENHEIT,
291 UNIT_PERCENT,
292 UNIT_MAH,
293 UNIT_WATTS,
294 UNIT_MILLIWATTS,
295 UNIT_DB,
296 UNIT_RPMS,
297 UNIT_G,
298 UNIT_DEGREE,
299 UNIT_RADIANS,
300 UNIT_MILLILITERS,
301 UNIT_FLOZ,
302 UNIT_MILLILITERS_PER_MINUTE,
303 UNIT_MAX = UNIT_MILLILITERS_PER_MINUTE,
304 UNIT_SPARE1,
305 UNIT_SPARE2,
306 UNIT_SPARE3,
307 UNIT_SPARE4,
308 UNIT_SPARE5,
309 UNIT_SPARE6,
310 UNIT_SPARE7,
311 UNIT_SPARE8,
312 UNIT_SPARE9,
313 UNIT_SPARE10,
314 UNIT_HOURS,
315 UNIT_MINUTES,
316 UNIT_SECONDS,
317 // FrSky format used for these fields, could be another format in the future
318 UNIT_FIRST_VIRTUAL,
319 UNIT_CELLS = UNIT_FIRST_VIRTUAL,
320 UNIT_DATETIME,
321 UNIT_GPS,
322 UNIT_BITFIELD,
323 UNIT_TEXT,
324 // Internal units (not stored in sensor unit)
325 UNIT_GPS_LONGITUDE,
326 UNIT_GPS_LATITUDE,
327 UNIT_DATETIME_YEAR,
328 UNIT_DATETIME_DAY_MONTH,
329 UNIT_DATETIME_HOUR_MIN,
330 UNIT_DATETIME_SEC
333 #if LCD_W >= 212
334 #define NUM_LINE_ITEMS 3
335 #else
336 #define NUM_LINE_ITEMS 2
337 #endif
339 #if defined(PCBTARANIS)
340 #define MAX_TELEM_SCRIPT_INPUTS 8
341 #endif
343 enum TelemetryScreenType {
344 TELEMETRY_SCREEN_TYPE_NONE,
345 TELEMETRY_SCREEN_TYPE_VALUES,
346 TELEMETRY_SCREEN_TYPE_BARS,
347 TELEMETRY_SCREEN_TYPE_SCRIPT,
348 #if defined(LUA)
349 TELEMETRY_SCREEN_TYPE_MAX = TELEMETRY_SCREEN_TYPE_SCRIPT
350 #else
351 TELEMETRY_SCREEN_TYPE_MAX = TELEMETRY_SCREEN_TYPE_BARS
352 #endif
354 #define MAX_TELEMETRY_SCREENS 4
355 #define TELEMETRY_SCREEN_TYPE(screenIndex) TelemetryScreenType((g_model.screensType >> (2*(screenIndex))) & 0x03)
356 #define IS_BARS_SCREEN(screenIndex) (TELEMETRY_SCREEN_TYPE(screenIndex) == TELEMETRY_SCREEN_TYPE_BARS)
358 constexpr int16_t FAILSAFE_CHANNEL_HOLD = 2000;
359 constexpr int16_t FAILSAFE_CHANNEL_NOPULSE = 2001;
361 #define LEN_SCRIPT_FILENAME 6
362 #define LEN_SCRIPT_NAME 6
363 #define MAX_SCRIPT_INPUTS 6
364 #define MAX_SCRIPT_OUTPUTS 6
366 enum PotsWarnMode {
367 POTS_WARN_OFF,
368 POTS_WARN_MANUAL,
369 POTS_WARN_AUTO
372 #define LEN_GVAR_NAME 3
373 #define GVAR_MAX 1024
374 #define GVAR_MIN -GVAR_MAX
376 #define RESERVE_RANGE_FOR_GVARS 10
377 // even we do not spend space in EEPROM for 10 GVARS, we reserve the space inside the range of values, like offset, weight, etc.
379 #define MAX_GVARS 9
381 enum SwitchSources {
382 SWSRC_NONE = 0,
384 SWSRC_FIRST_SWITCH,
386 #if defined(STORAGE_SWITCH_A)
387 SWSRC_SA0 = SWSRC_FIRST_SWITCH,
388 SWSRC_SA1,
389 SWSRC_SA2,
390 #endif
392 #if defined(STORAGE_SWITCH_B)
393 SWSRC_SB0,
394 SWSRC_SB1,
395 SWSRC_SB2,
396 #endif
398 #if defined(STORAGE_SWITCH_C)
399 SWSRC_SC0,
400 SWSRC_SC1,
401 SWSRC_SC2,
402 #endif
404 #if defined(STORAGE_SWITCH_D)
405 SWSRC_SD0,
406 SWSRC_SD1,
407 SWSRC_SD2,
408 #endif
410 #if defined(STORAGE_SWITCH_E)
411 SWSRC_SE0,
412 SWSRC_SE1,
413 SWSRC_SE2,
414 #endif
416 #if defined(STORAGE_SWITCH_F)
417 SWSRC_SF0,
418 SWSRC_SF1,
419 SWSRC_SF2,
420 #endif
422 #if defined(STORAGE_SWITCH_G)
423 SWSRC_SG0,
424 SWSRC_SG1,
425 SWSRC_SG2,
426 #endif
428 #if defined(STORAGE_SWITCH_H)
429 SWSRC_SH0,
430 SWSRC_SH1,
431 SWSRC_SH2,
432 #endif
434 #if defined(STORAGE_SWITCH_I)
435 SWSRC_SI0,
436 SWSRC_SI1,
437 SWSRC_SI2,
438 #endif
440 #if defined(STORAGE_SWITCH_J)
441 SWSRC_SJ0,
442 SWSRC_SJ1,
443 SWSRC_SJ2,
444 #endif
446 #if defined(STORAGE_SWITCH_K)
447 SWSRC_SK0,
448 SWSRC_SK1,
449 SWSRC_SK2,
450 #endif
452 #if defined(STORAGE_SWITCH_L)
453 SWSRC_SL0,
454 SWSRC_SL1,
455 SWSRC_SL2,
456 #endif
458 #if defined(STORAGE_SWITCH_M)
459 SWSRC_SM0,
460 SWSRC_SM1,
461 SWSRC_SM2,
462 #endif
464 #if defined(STORAGE_SWITCH_N)
465 SWSRC_SN0,
466 SWSRC_SN1,
467 SWSRC_SN2,
468 #endif
470 #if defined(STORAGE_SWITCH_O)
471 SWSRC_SO0,
472 SWSRC_SO1,
473 SWSRC_SO2,
474 #endif
476 #if defined(STORAGE_SWITCH_P)
477 SWSRC_SP0,
478 SWSRC_SP1,
479 SWSRC_SP2,
480 #endif
482 #if defined(STORAGE_SWITCH_Q)
483 SWSRC_SQ0,
484 SWSRC_SQ1,
485 SWSRC_SQ2,
486 #endif
488 #if defined(STORAGE_SWITCH_R)
489 SWSRC_SR0,
490 SWSRC_SR1,
491 SWSRC_SR2,
492 #endif
494 #if defined(PCBSKY9X)
495 SWSRC_ID0 = SWSRC_FIRST_SWITCH,
496 SWSRC_ID1,
497 SWSRC_ID2,
498 SWSRC_THR,
499 SWSRC_RUD,
500 SWSRC_ELE,
501 SWSRC_AIL,
502 SWSRC_GEA,
503 SWSRC_TRN,
504 SWSRC_TRAINER = SWSRC_TRN,
505 SWSRC_LAST_SWITCH = SWSRC_TRN,
506 #else
507 SWSRC_LAST_SWITCH = SWSRC_FIRST_SWITCH + STORAGE_NUM_SWITCHES_POSITIONS - 1,
508 #endif
510 #if NUM_XPOTS > 0
511 SWSRC_FIRST_MULTIPOS_SWITCH,
512 SWSRC_LAST_MULTIPOS_SWITCH = SWSRC_FIRST_MULTIPOS_SWITCH + (NUM_XPOTS * XPOTS_MULTIPOS_COUNT) - 1,
513 #endif
515 SWSRC_FIRST_TRIM,
516 SWSRC_TrimRudLeft = SWSRC_FIRST_TRIM,
517 SWSRC_TrimRudRight,
518 SWSRC_TrimEleDown,
519 SWSRC_TrimEleUp,
521 #if NUM_TRIMS > 2
522 SWSRC_TrimThrDown,
523 SWSRC_TrimThrUp,
524 SWSRC_TrimAilLeft,
525 SWSRC_TrimAilRight,
526 #endif
528 #if NUM_TRIMS > 4
529 SWSRC_TrimT5Down,
530 SWSRC_TrimT5Up,
531 SWSRC_TrimT6Down,
532 SWSRC_TrimT6Up,
533 #endif
535 #if defined(PCBSKY9X)
536 SWSRC_REa,
537 #endif
539 SWSRC_FIRST_LOGICAL_SWITCH,
540 SWSRC_SW1 = SWSRC_FIRST_LOGICAL_SWITCH,
541 SWSRC_SW2,
542 // ...
543 SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
545 SWSRC_ON,
546 SWSRC_ONE,
548 SWSRC_FIRST_FLIGHT_MODE,
549 SWSRC_LAST_FLIGHT_MODE = SWSRC_FIRST_FLIGHT_MODE+MAX_FLIGHT_MODES-1,
551 SWSRC_TELEMETRY_STREAMING,
553 SWSRC_FIRST_SENSOR,
554 SWSRC_LAST_SENSOR = SWSRC_FIRST_SENSOR+MAX_TELEMETRY_SENSORS-1,
556 SWSRC_RADIO_ACTIVITY,
558 #if defined(DEBUG_LATENCY)
559 SWSRC_LATENCY_TOGGLE,
560 #endif
562 SWSRC_COUNT,
564 SWSRC_OFF = -SWSRC_ON,
566 SWSRC_LAST = SWSRC_COUNT-1,
567 SWSRC_FIRST = -SWSRC_LAST,
569 SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_COUNT-1,
570 SWSRC_LAST_IN_MIXES = SWSRC_COUNT-1,
572 SWSRC_FIRST_IN_LOGICAL_SWITCHES = -SWSRC_LAST_IN_LOGICAL_SWITCHES,
573 SWSRC_FIRST_IN_MIXES = -SWSRC_LAST_IN_MIXES,
575 SWSRC_INVERT = SWSRC_COUNT+1,
578 #if NUM_SWITCHES >= 8
579 #define SWSRC_TRAINER SWSRC_SH2
580 #else
581 #define SWSRC_TRAINER SWSRC_LAST_SWITCH,
582 #endif
584 #define SWSRC_LAST_TRIM (SWSRC_FIRST_TRIM + 2*NUM_TRIMS - 1)
586 enum MixSources {
587 MIXSRC_NONE,
589 MIXSRC_FIRST_INPUT, LUA_EXPORT_MULTIPLE("input", "Input [I%d]", MAX_INPUTS)
590 MIXSRC_LAST_INPUT = MIXSRC_FIRST_INPUT+MAX_INPUTS-1,
592 #if defined(LUA_INPUTS)
593 MIXSRC_FIRST_LUA, LUA_EXPORT_MULTIPLE("lua", "Lua mix output %d", MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS)
594 MIXSRC_LAST_LUA = MIXSRC_FIRST_LUA+(MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS)-1,
595 #endif
597 MIXSRC_FIRST_STICK,
598 MIXSRC_Rud = MIXSRC_FIRST_STICK, LUA_EXPORT("rud", "Rudder")
599 MIXSRC_Ele, LUA_EXPORT("ele", "Elevator")
600 MIXSRC_Thr, LUA_EXPORT("thr", "Throttle")
601 MIXSRC_Ail, LUA_EXPORT("ail", "Aileron")
603 MIXSRC_FIRST_POT,
604 #if defined(PCBHORUS)
605 MIXSRC_S1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer S1")
606 MIXSRC_6POS, LUA_EXPORT("6pos", "Multipos Switch")
607 MIXSRC_S2, LUA_EXPORT("s2", "Potentiometer S2")
608 #if defined(PCBX10)
609 MIXSRC_EXT1, LUA_EXPORT("ext1", "Ext 1")
610 MIXSRC_EXT2, LUA_EXPORT("ext2", "Ext 2")
611 #endif
612 MIXSRC_FIRST_SLIDER,
613 #if defined(PCBX12S)
614 MIXSRC_S3 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("s3", "Slider S3")
615 MIXSRC_S4, LUA_EXPORT("s4", "Slider S4")
616 MIXSRC_LS, LUA_EXPORT("ls", "Left rear slider")
617 MIXSRC_RS, LUA_EXPORT("rs", "Right rear slider")
618 #else
619 MIXSRC_LS = MIXSRC_FIRST_SLIDER, LUA_EXPORT("ls", "Left slider")
620 MIXSRC_RS, LUA_EXPORT("rs", "Right slider")
621 #endif
622 MIXSRC_LAST_POT = MIXSRC_RS,
623 #elif defined(PCBX9E)
624 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
625 MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
626 MIXSRC_POT3, LUA_EXPORT("s3", "Potentiometer 3")
627 MIXSRC_POT4, LUA_EXPORT("s4", "Potentiometer 4 (X9E only)")
628 MIXSRC_FIRST_SLIDER,
629 MIXSRC_SLIDER1 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("ls", "Left slider")
630 MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
631 MIXSRC_SLIDER3, LUA_EXPORT("lcs", "Left center slider (X9E only)")
632 MIXSRC_SLIDER4, LUA_EXPORT("rcs", "Right center slider (X9E only)")
633 MIXSRC_LAST_POT = MIXSRC_SLIDER4,
634 #elif defined(PCBX7) || defined(PCBXLITE)
635 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
636 MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
637 MIXSRC_LAST_POT = MIXSRC_POT2,
638 #elif defined(PCBX9LITE)
639 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
640 MIXSRC_LAST_POT = MIXSRC_POT1,
641 #elif defined(PCBTARANIS)
642 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
643 MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
644 MIXSRC_POT3, LUA_EXPORT("s3", "Potentiometer 3")
645 MIXSRC_FIRST_SLIDER,
646 MIXSRC_SLIDER1 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("ls", "Left slider")
647 MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
648 MIXSRC_LAST_POT = MIXSRC_SLIDER2,
649 #else
650 MIXSRC_P1 = MIXSRC_FIRST_POT,
651 MIXSRC_P2,
652 MIXSRC_P3,
653 MIXSRC_LAST_POT = MIXSRC_P3,
654 #endif
656 #if defined(PCBHORUS)
657 MIXSRC_MOUSE1, LUA_EXPORT("jsx", "Joystick X")
658 MIXSRC_MOUSE2, LUA_EXPORT("jsy", "Joystick Y")
659 #endif
661 #if defined(GYRO)
662 MIXSRC_GYRO1, LUA_EXPORT("gyrx", "Gyro X")
663 MIXSRC_GYRO2, LUA_EXPORT("gyry", "Gyro Y")
664 #endif
666 MIXSRC_MAX,
668 MIXSRC_FIRST_HELI,
669 MIXSRC_CYC1 = MIXSRC_FIRST_HELI, LUA_EXPORT("cyc1", "Cyclic 1")
670 MIXSRC_CYC2, LUA_EXPORT("cyc2", "Cyclic 2")
671 MIXSRC_CYC3, LUA_EXPORT("cyc3", "Cyclic 3")
673 MIXSRC_FIRST_TRIM,
674 MIXSRC_TrimRud = MIXSRC_FIRST_TRIM, LUA_EXPORT("trim-rud", "Rudder trim")
675 MIXSRC_TrimEle, LUA_EXPORT("trim-ele", "Elevator trim")
676 MIXSRC_TrimThr, LUA_EXPORT("trim-thr", "Throttle trim")
677 MIXSRC_TrimAil, LUA_EXPORT("trim-ail", "Aileron trim")
678 #if defined(PCBHORUS)
679 MIXSRC_TrimT5, LUA_EXPORT("trim-t5", "Aux trim T5")
680 MIXSRC_TrimT6, LUA_EXPORT("trim-t6", "Aux trim T6")
681 MIXSRC_LAST_TRIM = MIXSRC_TrimT6,
682 #else
683 MIXSRC_LAST_TRIM = MIXSRC_TrimAil,
684 #endif
686 MIXSRC_FIRST_SWITCH,
688 #if defined(HARDWARE_SWITCH_A)
689 MIXSRC_SA = MIXSRC_FIRST_SWITCH, LUA_EXPORT("sa", "Switch A")
690 MIXSRC_SB, LUA_EXPORT("sb", "Switch B")
691 MIXSRC_SC, LUA_EXPORT("sc", "Switch C")
692 #endif
693 #if defined(HARDWARE_SWITCH_D)
694 MIXSRC_SD, LUA_EXPORT("sd", "Switch D")
695 #elif defined(STORAGE_SWITCH_D)
696 MIXSRC_SD,
697 #endif
698 #if defined(HARDWARE_SWITCH_E)
699 MIXSRC_SE, LUA_EXPORT("se", "Switch E")
700 #elif defined(STORAGE_SWITCH_E)
701 MIXSRC_SE,
702 #endif
703 #if defined(HARDWARE_SWITCH_F)
704 MIXSRC_SF, LUA_EXPORT("sf", "Switch F")
705 #elif defined(STORAGE_SWITCH_F)
706 MIXSRC_SF,
707 #endif
708 #if defined(HARDWARE_SWITCH_G)
709 MIXSRC_SG, LUA_EXPORT("sg", "Switch G")
710 #elif defined(STORAGE_SWITCH_G)
711 MIXSRC_SG,
712 #endif
713 #if defined(HARDWARE_SWITCH_H)
714 MIXSRC_SH, LUA_EXPORT("sh", "Switch H")
715 #elif defined(STORAGE_SWITCH_H)
716 MIXSRC_SH,
717 #endif
718 #if defined(HARDWARE_SWITCH_I)
719 MIXSRC_SI, LUA_EXPORT("si", "Switch I")
720 #elif defined(STORAGE_SWITCH_I)
721 MIXSRC_SI,
722 #endif
723 #if defined(HARDWARE_SWITCH_J)
724 MIXSRC_SJ, LUA_EXPORT("sj", "Switch J")
725 #elif defined(STORAGE_SWITCH_J)
726 MIXSRC_SJ,
727 #endif
728 #if defined(HARDWARE_SWITCH_K)
729 MIXSRC_SK, LUA_EXPORT("sk", "Switch K")
730 MIXSRC_SL, LUA_EXPORT("sl", "Switch L")
731 MIXSRC_SM, LUA_EXPORT("sm", "Switch M")
732 MIXSRC_SN, LUA_EXPORT("sn", "Switch N")
733 MIXSRC_SO, LUA_EXPORT("so", "Switch O")
734 MIXSRC_SP, LUA_EXPORT("sp", "Switch P")
735 MIXSRC_SQ, LUA_EXPORT("sq", "Switch Q")
736 MIXSRC_SR, LUA_EXPORT("sr", "Switch R")
737 #endif
738 #if defined(PCBSKY9X)
739 MIXSRC_3POS = MIXSRC_FIRST_SWITCH,
740 MIXSRC_THR,
741 MIXSRC_RUD,
742 MIXSRC_ELE,
743 MIXSRC_AIL,
744 MIXSRC_GEA,
745 MIXSRC_TRN,
746 #endif
747 MIXSRC_FIRST_LOGICAL_SWITCH,
748 MIXSRC_SW1 = MIXSRC_FIRST_LOGICAL_SWITCH, LUA_EXPORT_MULTIPLE("ls", "Logical switch L%d", MAX_LOGICAL_SWITCHES)
749 MIXSRC_LAST_LOGICAL_SWITCH = MIXSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
751 MIXSRC_FIRST_TRAINER, LUA_EXPORT_MULTIPLE("trn", "Trainer input %d", MAX_TRAINER_CHANNELS)
752 MIXSRC_LAST_TRAINER = MIXSRC_FIRST_TRAINER+MAX_TRAINER_CHANNELS-1,
754 MIXSRC_FIRST_CH,
755 MIXSRC_CH1 = MIXSRC_FIRST_CH, LUA_EXPORT_MULTIPLE("ch", "Channel CH%d", MAX_OUTPUT_CHANNELS)
756 MIXSRC_CH2,
757 MIXSRC_CH3,
758 MIXSRC_CH4,
759 MIXSRC_CH5,
760 MIXSRC_CH6,
761 MIXSRC_CH7,
762 MIXSRC_CH8,
763 MIXSRC_CH9,
764 MIXSRC_CH10,
765 MIXSRC_CH11,
766 MIXSRC_CH12,
767 MIXSRC_CH13,
768 MIXSRC_CH14,
769 MIXSRC_CH15,
770 MIXSRC_CH16,
771 MIXSRC_LAST_CH = MIXSRC_CH1+MAX_OUTPUT_CHANNELS-1,
773 MIXSRC_FIRST_GVAR,
774 MIXSRC_GVAR1 = MIXSRC_FIRST_GVAR, LUA_EXPORT_MULTIPLE("gvar", "Global variable %d", MAX_GVARS)
775 MIXSRC_LAST_GVAR = MIXSRC_FIRST_GVAR+MAX_GVARS-1,
777 MIXSRC_TX_VOLTAGE, LUA_EXPORT("tx-voltage", "Transmitter battery voltage [volts]")
778 MIXSRC_TX_TIME, LUA_EXPORT("clock", "RTC clock [minutes from midnight]")
779 #if defined(INTERNAL_GPS)
780 MIXSRC_TX_GPS,
781 MIXSRC_FIRST_RESERVE,
782 #else
783 MIXSRC_FIRST_RESERVE,
784 MIXSRC_RESERVE2,
785 #endif
786 MIXSRC_RESERVE3,
787 MIXSRC_RESERVE4,
788 MIXSRC_LAST_RESERVE,
789 MIXSRC_FIRST_TIMER,
790 MIXSRC_TIMER1 = MIXSRC_FIRST_TIMER, LUA_EXPORT("timer1", "Timer 1 value [seconds]")
791 MIXSRC_TIMER2, LUA_EXPORT("timer2", "Timer 2 value [seconds]")
792 MIXSRC_TIMER3, LUA_EXPORT("timer3", "Timer 3 value [seconds]")
793 MIXSRC_LAST_TIMER = MIXSRC_TIMER3,
795 MIXSRC_FIRST_TELEM, LUA_EXPORT_MULTIPLE("telem", "Telemetry sensor %d", MAX_TELEMETRY_SENSORS)
796 MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+3*MAX_TELEMETRY_SENSORS-1
799 #if defined(__cplusplus)
800 static_assert(MIXSRC_FIRST_LOGICAL_SWITCH == MIXSRC_FIRST_SWITCH + STORAGE_NUM_SWITCHES, "Wrong switches definition in MIXSRC list");
801 #endif
803 #define MIXSRC_FIRST (MIXSRC_NONE + 1)
804 #define MIXSRC_LAST MIXSRC_LAST_CH
805 #define MIXSRC_LAST_SWITCH (MIXSRC_FIRST_SWITCH + STORAGE_NUM_SWITCHES - 1)
806 #define INPUTSRC_FIRST MIXSRC_Rud
807 #define INPUTSRC_LAST MIXSRC_LAST_TELEM
809 enum BacklightMode {
810 e_backlight_mode_off = 0,
811 e_backlight_mode_keys = 1,
812 e_backlight_mode_sticks = 2,
813 e_backlight_mode_all = e_backlight_mode_keys+e_backlight_mode_sticks,
814 e_backlight_mode_on
817 enum Functions {
818 // first the functions which need a checkbox
819 FUNC_OVERRIDE_CHANNEL,
820 FUNC_TRAINER,
821 FUNC_INSTANT_TRIM,
822 FUNC_RESET,
823 FUNC_SET_TIMER,
824 FUNC_ADJUST_GVAR,
825 FUNC_VOLUME,
826 FUNC_SET_FAILSAFE,
827 FUNC_RANGECHECK,
828 FUNC_BIND,
829 // then the other functions
830 FUNC_FIRST_WITHOUT_ENABLE,
831 FUNC_PLAY_SOUND = FUNC_FIRST_WITHOUT_ENABLE,
832 FUNC_PLAY_TRACK,
833 FUNC_PLAY_VALUE,
834 FUNC_RESERVE4,
835 FUNC_PLAY_SCRIPT,
836 FUNC_RESERVE5,
837 FUNC_BACKGND_MUSIC,
838 FUNC_BACKGND_MUSIC_PAUSE,
839 FUNC_VARIO,
840 FUNC_HAPTIC,
841 FUNC_LOGS,
842 FUNC_BACKLIGHT,
843 FUNC_SCREENSHOT,
844 #if defined(DEBUG)
845 FUNC_TEST, // should remain the last before MAX as not added in Companion
846 #endif
847 FUNC_MAX
850 enum TimerModes {
851 TMRMODE_NONE,
852 TMRMODE_ABS,
853 TMRMODE_THR,
854 TMRMODE_THR_REL,
855 TMRMODE_THR_TRG,
856 TMRMODE_COUNT
859 enum CountDownModes {
860 COUNTDOWN_SILENT,
861 COUNTDOWN_BEEPS,
862 COUNTDOWN_VOICE,
863 #if defined(HAPTIC)
864 COUNTDOWN_HAPTIC,
865 #endif
866 COUNTDOWN_COUNT
869 enum ResetFunctionParam {
870 FUNC_RESET_TIMER1,
871 FUNC_RESET_TIMER2,
872 FUNC_RESET_TIMER3,
873 FUNC_RESET_FLIGHT,
874 FUNC_RESET_TELEMETRY,
875 FUNC_RESET_PARAM_FIRST_TELEM,
876 FUNC_RESET_PARAM_LAST_TELEM = FUNC_RESET_PARAM_FIRST_TELEM + MAX_TELEMETRY_SENSORS,
877 FUNC_RESET_PARAMS_COUNT,
878 FUNC_RESET_PARAM_LAST = FUNC_RESET_PARAMS_COUNT-1,
881 enum AdjustGvarFunctionParam {
882 FUNC_ADJUST_GVAR_CONSTANT,
883 FUNC_ADJUST_GVAR_SOURCE,
884 FUNC_ADJUST_GVAR_GVAR,
885 FUNC_ADJUST_GVAR_INCDEC,
888 enum BluetoothModes {
889 BLUETOOTH_OFF,
890 BLUETOOTH_TELEMETRY,
891 BLUETOOTH_TRAINER,
894 // PXX2 constants
895 #define PXX2_LEN_REGISTRATION_ID 8
896 #define PXX2_LEN_RX_NAME 8
897 #define PXX2_MAX_RECEIVERS_PER_MODULE 3
899 #endif // _DATACONSTANTS_H_