Taranis Q X7 optimized wizard (#5198)
[opentx.git] / radio / src / dataconstants.h
blobe01827c6d7d1e398e9087865e6889ca0b2dc3dd0
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 #define NUM_STICKS 4
26 #if defined(EXPORT)
27 #define LUA_EXPORT(...) LEXP(__VA_ARGS__)
28 #define LUA_EXPORT_MULTIPLE(...) LEXP_MULTIPLE(__VA_ARGS__)
29 #define LUA_EXPORT_EXTRA(...) LEXP_EXTRA(__VA_ARGS__)
30 #else
31 #define LUA_EXPORT(...)
32 #define LUA_EXPORT_MULTIPLE(...)
33 #define LUA_EXPORT_EXTRA(...)
34 #endif
36 #if defined(PCBHORUS)
37 #define MAX_MODELS 60
38 #define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
39 #define MAX_FLIGHT_MODES 9
40 #define MAX_MIXERS 64
41 #define MAX_EXPOS 64
42 #define MAX_LOGICAL_SWITCHES 64
43 #define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
44 #define MAX_SCRIPTS 9
45 #define MAX_INPUTS 32
46 #define MAX_TRAINER_CHANNELS 16
47 #define MAX_TELEMETRY_SENSORS 32
48 #define MAX_CUSTOM_SCREENS 5
49 #elif defined(PCBFLAMENCO)
50 #define MAX_MODELS 60
51 #define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
52 #define MAX_FLIGHT_MODES 9
53 #define MAX_MIXERS 64
54 #define MAX_EXPOS 64
55 #define MAX_LOGICAL_SWITCHES 32
56 #define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
57 #define MAX_SCRIPTS 7
58 #define MAX_INPUTS 32
59 #define MAX_TRAINER_CHANNELS 16
60 #define MAX_TELEMETRY_SENSORS 32
61 #elif defined(PCBTARANIS)
62 #define MAX_MODELS 60
63 #define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
64 #define MAX_FLIGHT_MODES 9
65 #define MAX_MIXERS 64
66 #define MAX_EXPOS 64
67 #define MAX_LOGICAL_SWITCHES 64
68 #define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
69 #define MAX_SCRIPTS 7
70 #define MAX_INPUTS 32
71 #define MAX_TRAINER_CHANNELS 16
72 #define MAX_TELEMETRY_SENSORS 32
73 #elif defined(PCBSKY9X)
74 #define MAX_MODELS 60
75 #define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
76 #define MAX_FLIGHT_MODES 9
77 #define MAX_MIXERS 64
78 #define MAX_EXPOS 32
79 #define MAX_LOGICAL_SWITCHES 64
80 #define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
81 #define MAX_INPUTS 32
82 #define MAX_TRAINER_CHANNELS 16
83 #define MAX_TELEMETRY_SENSORS 32
84 #elif defined(CPUM2560) || defined(CPUM2561)
85 #define MAX_MODELS 30
86 #define MAX_OUTPUT_CHANNELS 16 // number of real output channels CH1-CH16
87 #define MAX_FLIGHT_MODES 6
88 #define MAX_MIXERS 32
89 #define MAX_EXPOS 16
90 #define MAX_LOGICAL_SWITCHES 12
91 #define MAX_SPECIAL_FUNCTIONS 24 // number of functions assigned to switches
92 #define MAX_TRAINER_CHANNELS 8
93 #define MAX_TELEMETRY_SENSORS 0
94 #elif defined(CPUM128)
95 #define MAX_MODELS 30
96 #define MAX_OUTPUT_CHANNELS 16 // number of real output channels CH1-CH16
97 #define MAX_FLIGHT_MODES 5
98 #define MAX_MIXERS 32
99 #define MAX_EXPOS 14
100 #define MAX_LOGICAL_SWITCHES 12
101 #define MAX_SPECIAL_FUNCTIONS 24 // number of functions assigned to switches
102 #define MAX_TRAINER_CHANNELS 8
103 #define MAX_TELEMETRY_SENSORS 0
104 #else
105 #define MAX_MODELS 16
106 #define MAX_OUTPUT_CHANNELS 16 // number of real output channels CH1-CH16
107 #define MAX_FLIGHT_MODES 5
108 #define MAX_MIXERS 32
109 #define MAX_EXPOS 14
110 #define MAX_LOGICAL_SWITCHES 12
111 #define MAX_SPECIAL_FUNCTIONS 16 // number of functions assigned to switches
112 #define MAX_TRAINER_CHANNELS 8
113 #define MAX_TELEMETRY_SENSORS 0
114 #endif
116 #if defined(CPUARM)
117 #define MAX_TIMERS 3
118 #else
119 #define MAX_TIMERS 2
120 #endif
122 #define NUM_CYC 3
123 #define NUM_CAL_PPM 4
125 enum CurveType {
126 CURVE_TYPE_STANDARD,
127 CURVE_TYPE_CUSTOM,
128 CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM
131 #if defined(CPUARM)
132 #define MIN_POINTS_PER_CURVE 3
133 #else
134 #define MIN_POINTS_PER_CURVE 3
135 #endif
137 #define MAX_POINTS_PER_CURVE 17
139 #if defined(PCBHORUS)
140 #define LEN_MODEL_NAME 15
141 #define LEN_TIMER_NAME 8
142 #define LEN_FLIGHT_MODE_NAME 10
143 #define LEN_BITMAP_NAME 10 // TODO next EEPROM change: we need 14 here as we have to store the file extension
144 #define LEN_EXPOMIX_NAME 6
145 #define LEN_CHANNEL_NAME 6
146 #define LEN_INPUT_NAME 4
147 #define LEN_CURVE_NAME 3
148 #define LEN_FUNCTION_NAME 6
149 #define MAX_CURVES 32
150 #define MAX_CURVE_POINTS 512
151 #elif defined(PCBFLAMENCO)
152 #define LEN_MODEL_NAME 12
153 #define LEN_TIMER_NAME 8
154 #define LEN_FLIGHT_MODE_NAME 10
155 #define LEN_EXPOMIX_NAME 6
156 #define LEN_CHANNEL_NAME 6
157 #define LEN_INPUT_NAME 4
158 #define LEN_CURVE_NAME 3
159 #define LEN_FUNCTION_NAME 8
160 #define MAX_CURVES 32
161 #define MAX_CURVE_POINTS 512
162 #elif defined(PCBSKY9X) || defined(PCBX7)
163 #define LEN_MODEL_NAME 10
164 #define LEN_TIMER_NAME 3
165 #define LEN_FLIGHT_MODE_NAME 6
166 #define LEN_EXPOMIX_NAME 6
167 #define LEN_CHANNEL_NAME 4
168 #define LEN_INPUT_NAME 3
169 #define LEN_CURVE_NAME 3
170 #define LEN_FUNCTION_NAME 6
171 #define MAX_CURVES 16 // TODO next EEPROM check if can be changed to 32 to have all ARM the same
172 #define MAX_CURVE_POINTS 512
173 #elif defined(PCBTARANIS)
174 #define LEN_MODEL_NAME 12
175 #define LEN_TIMER_NAME 8
176 #define LEN_FLIGHT_MODE_NAME 10
177 #define LEN_BITMAP_NAME 10
178 #define LEN_EXPOMIX_NAME 8 // TODO next EEPROM change: 6 seem enough
179 #define LEN_CHANNEL_NAME 6
180 #define LEN_INPUT_NAME 4
181 #define LEN_CURVE_NAME 3
182 #define LEN_FUNCTION_NAME 8
183 #define MAX_CURVES 32
184 #define MAX_CURVE_POINTS 512
185 #else
186 #define LEN_MODEL_NAME 10
187 #define LEN_FLIGHT_MODE_NAME 6
188 #define MAX_CURVES 8
189 #define MAX_CURVE_POINTS (112-MAX_CURVES)
190 #endif
192 #if defined(PCBTARANIS) || defined(PCBSKY9X) || defined(PCBHORUS)
193 #define NUM_MODULES 2
194 #else
195 #define NUM_MODULES 1
196 #endif
198 #if defined(PCBFLAMENCO)
199 #define NUM_SWITCHES 5 // TODO in board.h
200 #endif
202 #define XPOTS_MULTIPOS_COUNT 6
204 #if defined(PCBSKY9X) && defined(REVX)
205 #define MAX_ROTARY_ENCODERS 1
206 #define NUM_ROTARY_ENCODERS 0
207 #elif defined(PCBSKY9X)
208 #define MAX_ROTARY_ENCODERS 1
209 #define NUM_ROTARY_ENCODERS 1
210 #elif defined(CPUM2560)
211 #define MAX_ROTARY_ENCODERS 2
212 #define NUM_ROTARY_ENCODERS 2
213 #else
214 #define MAX_ROTARY_ENCODERS 0
215 #define NUM_ROTARY_ENCODERS 0
216 #endif
218 #if defined(PCBX10)
219 #define NUM_AUX_TRIMS 2
220 #define NUM_MOUSE_ANALOGS 2
221 #define NUM_DUMMY_ANAS 2
222 #elif defined(PCBHORUS)
223 #define NUM_AUX_TRIMS 2
224 #define NUM_MOUSE_ANALOGS 2
225 #define NUM_DUMMY_ANAS 0
226 #else
227 #define NUM_AUX_TRIMS 0
228 #define NUM_MOUSE_ANALOGS 0
229 #define NUM_DUMMY_ANAS 0
230 #endif
232 #if defined(COLORLCD)
233 enum MainViews {
234 VIEW_BLANK,
235 VIEW_TIMERS_ALTITUDE,
236 VIEW_CHANNELS,
237 VIEW_TELEM1,
238 VIEW_TELEM2,
239 VIEW_TELEM3,
240 VIEW_TELEM4,
241 VIEW_COUNT
243 #elif LCD_W >= 212
244 enum MainViews {
245 VIEW_TIMERS,
246 VIEW_INPUTS,
247 VIEW_SWITCHES,
248 VIEW_COUNT
250 #else
251 enum MainViews {
252 VIEW_OUTPUTS_VALUES,
253 VIEW_OUTPUTS_BARS,
254 VIEW_INPUTS,
255 VIEW_TIMER2,
256 VIEW_COUNT
258 #endif
260 enum BeeperMode {
261 e_mode_quiet = -2,
262 e_mode_alarms,
263 e_mode_nokeys,
264 e_mode_all
267 #if defined(PCBFLAMENCO)
268 enum ModuleIndex {
269 EXTERNAL_MODULE,
270 TRAINER_MODULE,
272 enum TrainerMode {
273 TRAINER_MODE_MASTER,
274 TRAINER_MODE_SLAVE
276 #elif defined(PCBTARANIS) || defined(PCBHORUS)
277 enum ModuleIndex {
278 INTERNAL_MODULE,
279 EXTERNAL_MODULE,
280 TRAINER_MODULE
282 enum TrainerMode {
283 TRAINER_MODE_MASTER_TRAINER_JACK,
284 TRAINER_MODE_SLAVE,
285 #if defined(PCBTARANIS)
286 TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE,
287 TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
288 #endif
289 TRAINER_MODE_MASTER_BATTERY_COMPARTMENT,
290 #if defined(BLUETOOTH)
291 TRAINER_MODE_MASTER_BLUETOOTH,
292 TRAINER_MODE_SLAVE_BLUETOOTH,
293 #endif
295 #elif defined(PCBSKY9X)
296 enum ModuleIndex {
297 EXTERNAL_MODULE,
298 EXTRA_MODULE,
299 TRAINER_MODULE
301 #endif
303 #if defined(BLUETOOTH)
304 #define TRAINER_MODE_MAX() TRAINER_MODE_SLAVE_BLUETOOTH
305 #elif defined(PCBX7)
306 #define TRAINER_MODE_MAX() TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE
307 #else
308 #define TRAINER_MODE_MAX() HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE
309 #endif
311 #if defined(PCBTARANIS) || defined(PCBHORUS)
312 #define IS_INTERNAL_MODULE_ENABLED() (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_NONE)
313 #elif defined(PCBSKY9X)
314 #define IS_INTERNAL_MODULE_ENABLED() (false)
315 #endif
316 #define IS_EXTERNAL_MODULE_ENABLED() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_NONE)
319 enum UartModes {
320 #if defined(CLI) || defined(DEBUG)
321 UART_MODE_DEBUG,
322 #else
323 UART_MODE_NONE,
324 #endif
325 UART_MODE_TELEMETRY_MIRROR,
326 UART_MODE_TELEMETRY,
327 UART_MODE_SBUS_TRAINER,
328 // UART_MODE_CPPM_TRAINER,
329 UART_MODE_COUNT,
330 UART_MODE_MAX = UART_MODE_COUNT-1
333 #if defined(PCBHORUS)
334 #define LEN_SWITCH_NAME 3
335 #define LEN_ANA_NAME 3
336 #define LEN_MODEL_FILENAME 16
337 #define LEN_BLUETOOTH_NAME 10
338 #elif defined(CPUARM)
339 #define LEN_SWITCH_NAME 3
340 #define LEN_ANA_NAME 3
341 #define LEN_BLUETOOTH_NAME 10
342 #endif
344 #if defined(CPUARM)
345 #define TELEM_LABEL_LEN 4
346 enum TelemetryUnit {
347 UNIT_RAW,
348 UNIT_VOLTS,
349 UNIT_AMPS,
350 UNIT_MILLIAMPS,
351 UNIT_KTS,
352 UNIT_METERS_PER_SECOND,
353 UNIT_FEET_PER_SECOND,
354 UNIT_KMH,
355 UNIT_MPH,
356 UNIT_METERS,
357 UNIT_FEET,
358 UNIT_CELSIUS,
359 UNIT_FAHRENHEIT,
360 UNIT_PERCENT,
361 UNIT_MAH,
362 UNIT_WATTS,
363 UNIT_MILLIWATTS,
364 UNIT_DB,
365 UNIT_RPMS,
366 UNIT_G,
367 UNIT_DEGREE,
368 UNIT_RADIANS,
369 UNIT_MILLILITERS,
370 UNIT_FLOZ,
371 UNIT_HOURS,
372 UNIT_MINUTES,
373 UNIT_SECONDS,
374 // FrSky format used for these fields, could be another format in the future
375 UNIT_FIRST_VIRTUAL,
376 UNIT_CELLS = UNIT_FIRST_VIRTUAL,
377 UNIT_DATETIME,
378 UNIT_GPS,
379 UNIT_BITFIELD,
380 UNIT_TEXT,
381 // Internal units (not stored in sensor unit)
382 UNIT_GPS_LONGITUDE,
383 UNIT_GPS_LATITUDE,
384 UNIT_DATETIME_YEAR,
385 UNIT_DATETIME_DAY_MONTH,
386 UNIT_DATETIME_HOUR_MIN,
387 UNIT_DATETIME_SEC
389 #define UNIT_MAX UNIT_FLOZ
390 #define UNIT_DIST UNIT_METERS
391 #define UNIT_TEMPERATURE UNIT_CELSIUS
392 #define UNIT_SPEED UNIT_KMH
393 #else
394 #if !defined(CPUARM)
395 enum TelemetrySource {
396 TELEM_NONE,
397 TELEM_TX_VOLTAGE,
398 TELEM_TIMER1,
399 TELEM_TIMER2,
400 TELEM_TIMER_MAX=TELEM_TIMER2,
401 TELEM_RSSI_TX,
402 TELEM_RSSI_RX,
403 TELEM_A_FIRST,
404 TELEM_A1=TELEM_A_FIRST,
405 TELEM_A2,
406 TELEM_A_LAST=TELEM_A2,
407 TELEM_ALT,
408 TELEM_RPM,
409 TELEM_FUEL,
410 TELEM_T1,
411 TELEM_T2,
412 TELEM_SPEED,
413 TELEM_DIST,
414 TELEM_GPSALT,
415 TELEM_CELL,
416 TELEM_CELLS_SUM,
417 TELEM_VFAS,
418 TELEM_CURRENT,
419 TELEM_CONSUMPTION,
420 TELEM_POWER,
421 TELEM_ACCx,
422 TELEM_ACCy,
423 TELEM_ACCz,
424 TELEM_HDG,
425 TELEM_VSPEED,
426 TELEM_ASPEED,
427 TELEM_DTE,
428 TELEM_MIN_A_FIRST,
429 TELEM_MIN_A1=TELEM_MIN_A_FIRST,
430 TELEM_MIN_A2,
431 TELEM_MIN_A_LAST=TELEM_MIN_A2,
432 TELEM_MIN_ALT,
433 TELEM_MAX_ALT,
434 TELEM_MAX_RPM,
435 TELEM_MAX_T1,
436 TELEM_MAX_T2,
437 TELEM_MAX_SPEED,
438 TELEM_MAX_DIST,
439 TELEM_MAX_ASPEED,
440 TELEM_MIN_CELL,
441 TELEM_MIN_CELLS_SUM,
442 TELEM_MIN_VFAS,
443 TELEM_MAX_CURRENT,
444 TELEM_MAX_POWER,
445 TELEM_ACC,
446 TELEM_GPS_TIME,
447 TELEM_CSW_MAX = TELEM_MAX_POWER,
448 TELEM_NOUSR_MAX = TELEM_A2,
449 #if defined(TELEMETRY_FRSKY)
450 TELEM_DISPLAY_MAX = TELEM_MAX_POWER,
451 #else
452 TELEM_DISPLAY_MAX = TELEM_TIMER2, // because used also in PlayValue
453 #endif
454 TELEM_STATUS_MAX = TELEM_GPS_TIME,
455 TELEM_FIRST_STREAMED_VALUE = TELEM_RSSI_TX,
458 #if defined(FRSKY_HUB)
459 #define NUM_TELEMETRY TELEM_CSW_MAX
460 #elif defined(WS_HOW_HIGH)
461 #define NUM_TELEMETRY TELEM_ALT
462 #elif defined(TELEMETRY_FRSKY)
463 #define NUM_TELEMETRY TELEM_A2
464 #elif defined(TELEMETRY_MAVLINK)
465 #define NUM_TELEMETRY 4
466 #else
467 #define NUM_TELEMETRY TELEM_TIMER2
468 #endif
470 #endif
472 enum TelemetryUnit {
473 UNIT_VOLTS,
474 UNIT_AMPS,
475 UNIT_METERS_PER_SECOND,
476 UNIT_RAW,
477 UNIT_SPEED,
478 UNIT_DIST,
479 UNIT_TEMPERATURE,
480 UNIT_PERCENT,
481 UNIT_MILLIAMPS,
482 UNIT_A1A2_MAX = UNIT_MILLIAMPS,
483 UNIT_MAH,
484 UNIT_WATTS,
485 UNIT_DB,
486 UNIT_FEET,
487 UNIT_KTS,
488 UNIT_HOURS,
489 UNIT_MINUTES,
490 UNIT_SECONDS,
491 UNIT_RPMS,
492 UNIT_G,
493 UNIT_HDG
495 #endif
497 #if LCD_W >= 212
498 #define NUM_LINE_ITEMS 3
499 #else
500 #define NUM_LINE_ITEMS 2
501 #endif
503 #if defined(PCBTARANIS)
504 #define MAX_TELEM_SCRIPT_INPUTS 8
505 #endif
507 #if defined(CPUARM)
508 enum TelemetryScreenType {
509 TELEMETRY_SCREEN_TYPE_NONE,
510 TELEMETRY_SCREEN_TYPE_VALUES,
511 TELEMETRY_SCREEN_TYPE_GAUGES,
512 #if defined(LUA)
513 TELEMETRY_SCREEN_TYPE_SCRIPT,
514 TELEMETRY_SCREEN_TYPE_MAX = TELEMETRY_SCREEN_TYPE_SCRIPT
515 #else
516 TELEMETRY_SCREEN_TYPE_MAX = TELEMETRY_SCREEN_TYPE_GAUGES
517 #endif
519 #define MAX_TELEMETRY_SCREENS 4
520 #define TELEMETRY_SCREEN_TYPE(screenIndex) TelemetryScreenType((g_model.frsky.screensType >> (2*(screenIndex))) & 0x03)
521 #define IS_BARS_SCREEN(screenIndex) (TELEMETRY_SCREEN_TYPE(screenIndex) == TELEMETRY_SCREEN_TYPE_GAUGES)
522 #else
523 #define MAX_FRSKY_A_CHANNELS 2
524 #define MAX_TELEMETRY_SCREENS 2
525 #define IS_BARS_SCREEN(screenIndex) (g_model.frsky.screensType & (1<<(screenIndex)))
526 #define MIN_BLADES 0 // 2 blades
527 #define MAX_BLADES 3 // 5 blades
528 #endif
530 #define FAILSAFE_CHANNEL_HOLD 2000
531 #define FAILSAFE_CHANNEL_NOPULSE 2001
533 #define LEN_SCRIPT_FILENAME 6
534 #define LEN_SCRIPT_NAME 6
535 #define MAX_SCRIPT_INPUTS 6
536 #define MAX_SCRIPT_OUTPUTS 6
538 enum PotsWarnMode {
539 POTS_WARN_OFF,
540 POTS_WARN_MANUAL,
541 POTS_WARN_AUTO
544 #if !defined(PCBSTD)
545 #define LEN_GVAR_NAME 3
546 #define GVAR_MAX 1024
547 #define GVAR_MIN -GVAR_MAX
548 #endif
550 #define RESERVE_RANGE_FOR_GVARS 10
551 // even we do not spend space in EEPROM for 10 GVARS, we reserve the space inside the range of values, like offset, weight, etc.
553 #if defined(PCBSTD) && defined(GVARS)
554 #define MAX_GVARS 5
555 #elif defined(PCBSTD)
556 #define MAX_GVARS 0
557 #elif defined(CPUARM)
558 #define MAX_GVARS 9
559 #else
560 #define MAX_GVARS 5
561 #endif
563 enum SwitchSources {
564 SWSRC_NONE = 0,
566 SWSRC_FIRST_SWITCH,
568 #if defined(PCBFLAMENCO)
569 SWSRC_SA0 = SWSRC_FIRST_SWITCH,
570 SWSRC_SA1,
571 SWSRC_SA2,
572 SWSRC_SB0,
573 SWSRC_SB2,
574 SWSRC_SC0,
575 SWSRC_SC1,
576 SWSRC_SC2,
577 SWSRC_SC3,
578 SWSRC_SC4,
579 SWSRC_SC5,
580 SWSRC_SE0,
581 SWSRC_SE2,
582 SWSRC_SF0,
583 SWSRC_SF1,
584 SWSRC_SF2,
585 SWSRC_LAST_SWITCH = SWSRC_SF2,
586 #elif defined(PCBTARANIS) || defined(PCBHORUS)
587 SWSRC_SA0 = SWSRC_FIRST_SWITCH,
588 SWSRC_SA1,
589 SWSRC_SA2,
590 SWSRC_SB0,
591 SWSRC_SB1,
592 SWSRC_SB2,
593 SWSRC_SC0,
594 SWSRC_SC1,
595 SWSRC_SC2,
596 SWSRC_SD0,
597 SWSRC_SD1,
598 SWSRC_SD2,
599 #if !defined(PCBX7)
600 SWSRC_SE0,
601 SWSRC_SE1,
602 SWSRC_SE2,
603 #endif
604 SWSRC_SF0,
605 SWSRC_SF1,
606 SWSRC_SF2,
607 #if !defined(PCBX7)
608 SWSRC_SG0,
609 SWSRC_SG1,
610 SWSRC_SG2,
611 #endif
612 SWSRC_SH0,
613 SWSRC_SH1,
614 SWSRC_SH2,
615 SWSRC_TRAINER = SWSRC_SH2,
616 #if defined(PCBX9E)
617 SWSRC_SI0,
618 SWSRC_SI1,
619 SWSRC_SI2,
620 SWSRC_SJ0,
621 SWSRC_SJ1,
622 SWSRC_SJ2,
623 SWSRC_SK0,
624 SWSRC_SK1,
625 SWSRC_SK2,
626 SWSRC_SL0,
627 SWSRC_SL1,
628 SWSRC_SL2,
629 SWSRC_SM0,
630 SWSRC_SM1,
631 SWSRC_SM2,
632 SWSRC_SN0,
633 SWSRC_SN1,
634 SWSRC_SN2,
635 SWSRC_SO0,
636 SWSRC_SO1,
637 SWSRC_SO2,
638 SWSRC_SP0,
639 SWSRC_SP1,
640 SWSRC_SP2,
641 SWSRC_SQ0,
642 SWSRC_SQ1,
643 SWSRC_SQ2,
644 SWSRC_SR0,
645 SWSRC_SR1,
646 SWSRC_SR2,
647 SWSRC_LAST_SWITCH = SWSRC_SR2,
648 #else
649 SWSRC_LAST_SWITCH = SWSRC_SH2,
650 #endif
651 #else
652 SWSRC_ID0 = SWSRC_FIRST_SWITCH,
653 SWSRC_ID1,
654 SWSRC_ID2,
655 SWSRC_THR,
656 SWSRC_RUD,
657 SWSRC_ELE,
658 SWSRC_AIL,
659 SWSRC_GEA,
660 SWSRC_TRN,
661 SWSRC_TRAINER = SWSRC_TRN,
662 SWSRC_LAST_SWITCH = SWSRC_TRN,
663 #endif
665 #if NUM_XPOTS > 0
666 SWSRC_FIRST_MULTIPOS_SWITCH,
667 SWSRC_LAST_MULTIPOS_SWITCH = SWSRC_FIRST_MULTIPOS_SWITCH + (NUM_XPOTS*XPOTS_MULTIPOS_COUNT) - 1,
668 #endif
670 SWSRC_FIRST_TRIM,
671 SWSRC_TrimRudLeft = SWSRC_FIRST_TRIM,
672 SWSRC_TrimRudRight,
673 SWSRC_TrimEleDown,
674 SWSRC_TrimEleUp,
675 SWSRC_TrimThrDown,
676 SWSRC_TrimThrUp,
677 SWSRC_TrimAilLeft,
678 SWSRC_TrimAilRight,
679 #if defined(PCBHORUS)
680 SWSRC_TrimT5Down,
681 SWSRC_TrimT5Up,
682 SWSRC_TrimT6Down,
683 SWSRC_TrimT6Up,
684 SWSRC_LAST_TRIM = SWSRC_TrimT6Up,
685 #else
686 SWSRC_LAST_TRIM = SWSRC_TrimAilRight,
687 #endif
689 #if defined(PCBSKY9X)
690 SWSRC_REa,
691 #elif defined(CPUM2560)
692 SWSRC_REa,
693 SWSRC_REb,
694 #endif
696 SWSRC_FIRST_LOGICAL_SWITCH,
697 SWSRC_SW1 = SWSRC_FIRST_LOGICAL_SWITCH,
698 SWSRC_SW2,
699 SWSRC_SW3,
700 SWSRC_SW4,
701 SWSRC_SW5,
702 SWSRC_SW6,
703 SWSRC_SW7,
704 SWSRC_SW8,
705 SWSRC_SW9,
706 SWSRC_SWA,
707 SWSRC_SWB,
708 SWSRC_SWC,
709 SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
711 SWSRC_ON,
712 SWSRC_ONE,
714 #if defined(CPUARM)
715 SWSRC_FIRST_FLIGHT_MODE,
716 SWSRC_LAST_FLIGHT_MODE = SWSRC_FIRST_FLIGHT_MODE+MAX_FLIGHT_MODES-1,
718 SWSRC_TELEMETRY_STREAMING,
719 SWSRC_FIRST_SENSOR,
720 SWSRC_LAST_SENSOR = SWSRC_FIRST_SENSOR+MAX_TELEMETRY_SENSORS-1,
721 #endif
723 SWSRC_COUNT,
725 SWSRC_OFF = -SWSRC_ON,
727 SWSRC_LAST = SWSRC_COUNT-1,
728 SWSRC_FIRST = -SWSRC_LAST,
730 #if defined(CPUARM)
731 SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_COUNT-1,
732 SWSRC_LAST_IN_MIXES = SWSRC_COUNT-1,
733 #else
734 SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_LAST_LOGICAL_SWITCH,
735 SWSRC_LAST_IN_MIXES = SWSRC_LAST_LOGICAL_SWITCH,
736 #endif
738 SWSRC_FIRST_IN_LOGICAL_SWITCHES = -SWSRC_LAST_IN_LOGICAL_SWITCHES,
739 SWSRC_FIRST_IN_MIXES = -SWSRC_LAST_IN_MIXES,
741 #if defined(CPUARM)
742 SWSRC_INVERT = SWSRC_COUNT+1,
743 #endif
746 enum MixSources {
747 MIXSRC_NONE,
749 #if defined(VIRTUAL_INPUTS)
750 MIXSRC_FIRST_INPUT, LUA_EXPORT_MULTIPLE("input", "Input [I%d]", MAX_INPUTS)
751 MIXSRC_LAST_INPUT = MIXSRC_FIRST_INPUT+MAX_INPUTS-1,
752 #endif
754 #if defined(LUA_INPUTS)
755 MIXSRC_FIRST_LUA,
756 MIXSRC_LAST_LUA = MIXSRC_FIRST_LUA+(MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS)-1,
757 #endif
759 MIXSRC_FIRST_STICK,
760 MIXSRC_Rud = MIXSRC_FIRST_STICK, LUA_EXPORT("rud", "Rudder")
761 MIXSRC_Ele, LUA_EXPORT("ele", "Elevator")
762 MIXSRC_Thr, LUA_EXPORT("thr", "Throttle")
763 MIXSRC_Ail, LUA_EXPORT("ail", "Aileron")
765 MIXSRC_FIRST_POT,
766 #if defined(PCBHORUS)
767 MIXSRC_S1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer S1")
768 MIXSRC_6POS, LUA_EXPORT("6pos", "Multipos Switch")
769 MIXSRC_S2, LUA_EXPORT("s2", "Potentiometer S2")
770 MIXSRC_FIRST_SLIDER,
771 MIXSRC_S3 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("s3", "Slider S3")
772 MIXSRC_S4, LUA_EXPORT("s4", "Slider S4")
773 MIXSRC_LS, LUA_EXPORT("ls", "Left rear slider")
774 MIXSRC_RS, LUA_EXPORT("rs", "Right rear slider")
775 MIXSRC_LAST_POT = MIXSRC_RS,
776 #elif defined(PCBFLAMENCO)
777 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("sd", "Potentiometer D")
778 MIXSRC_SLIDER1, LUA_EXPORT("ls", "Left slider")
779 MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
780 MIXSRC_LAST_POT = MIXSRC_SLIDER2,
781 #elif defined(PCBX9E)
782 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
783 MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
784 MIXSRC_POT3, LUA_EXPORT("s3", "Potentiometer 3")
785 MIXSRC_POT4, LUA_EXPORT("s4", "Potentiometer 4 (X9E only)")
786 MIXSRC_FIRST_SLIDER,
787 MIXSRC_SLIDER1 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("ls", "Left slider")
788 MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
789 MIXSRC_SLIDER3, LUA_EXPORT("lcs", "Left center slider (X9E only)")
790 MIXSRC_SLIDER4, LUA_EXPORT("rcs", "Right center slider (X9E only)")
791 MIXSRC_LAST_POT = MIXSRC_SLIDER4,
792 #elif defined(PCBX7)
793 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
794 MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
795 MIXSRC_LAST_POT = MIXSRC_POT2,
796 #elif defined(PCBTARANIS)
797 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
798 MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
799 MIXSRC_POT3, LUA_EXPORT("s3", "Potentiometer 3")
800 MIXSRC_FIRST_SLIDER,
801 MIXSRC_SLIDER1 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("ls", "Left slider")
802 MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
803 MIXSRC_LAST_POT = MIXSRC_SLIDER2,
804 #else
805 MIXSRC_P1 = MIXSRC_FIRST_POT,
806 MIXSRC_P2,
807 MIXSRC_P3,
808 MIXSRC_LAST_POT = MIXSRC_P3,
809 #endif
811 #if defined(PCBHORUS)
812 MIXSRC_MOUSE1, LUA_EXPORT("jsx", "Joystick X")
813 MIXSRC_MOUSE2, LUA_EXPORT("jsy", "Joystick Y")
814 #endif
816 #if defined(PCBSKY9X)
817 MIXSRC_REa,
818 MIXSRC_LAST_ROTARY_ENCODER = MIXSRC_REa,
819 #elif defined(CPUM2560)
820 MIXSRC_REa,
821 MIXSRC_REb,
822 #if ROTARY_ENCODERS > 2
823 MIXSRC_REc,
824 MIXSRC_REd,
825 MIXSRC_LAST_ROTARY_ENCODER = MIXSRC_REd,
826 #else
827 MIXSRC_LAST_ROTARY_ENCODER = MIXSRC_REb,
828 #endif
829 #endif
831 MIXSRC_MAX,
833 MIXSRC_FIRST_HELI,
834 MIXSRC_CYC1 = MIXSRC_FIRST_HELI, LUA_EXPORT("cyc1", "Cyclic 1")
835 MIXSRC_CYC2, LUA_EXPORT("cyc2", "Cyclic 2")
836 MIXSRC_CYC3, LUA_EXPORT("cyc3", "Cyclic 3")
838 MIXSRC_FIRST_TRIM,
839 MIXSRC_TrimRud = MIXSRC_FIRST_TRIM, LUA_EXPORT("trim-rud", "Rudder trim")
840 MIXSRC_TrimEle, LUA_EXPORT("trim-ele", "Elevator trim")
841 MIXSRC_TrimThr, LUA_EXPORT("trim-thr", "Throttle trim")
842 MIXSRC_TrimAil, LUA_EXPORT("trim-ail", "Aileron trim")
843 #if defined(PCBHORUS)
844 MIXSRC_TrimT5, LUA_EXPORT("trim-t5", "Aux trim T5")
845 MIXSRC_TrimT6, LUA_EXPORT("trim-t6", "Aux trim T6")
846 MIXSRC_LAST_TRIM = MIXSRC_TrimT6,
847 #else
848 MIXSRC_LAST_TRIM = MIXSRC_TrimAil,
849 #endif
851 MIXSRC_FIRST_SWITCH,
853 #if defined(PCBFLAMENCO)
854 MIXSRC_SA = MIXSRC_FIRST_SWITCH, LUA_EXPORT("sa", "Switch A")
855 MIXSRC_SB, LUA_EXPORT("sb", "Switch B")
856 MIXSRC_SC, LUA_EXPORT("sc", "Switch C")
857 MIXSRC_SE, LUA_EXPORT("se", "Switch E")
858 MIXSRC_SF, LUA_EXPORT("sf", "Switch F")
859 MIXSRC_LAST_SWITCH = MIXSRC_SF,
860 #elif defined(PCBTARANIS) || defined(PCBHORUS)
861 MIXSRC_SA = MIXSRC_FIRST_SWITCH, LUA_EXPORT("sa", "Switch A")
862 MIXSRC_SB, LUA_EXPORT("sb", "Switch B")
863 MIXSRC_SC, LUA_EXPORT("sc", "Switch C")
864 MIXSRC_SD, LUA_EXPORT("sd", "Switch D")
865 #if !defined(PCBX7)
866 MIXSRC_SE, LUA_EXPORT("se", "Switch E")
867 #endif
868 MIXSRC_SF, LUA_EXPORT("sf", "Switch F")
869 #if !defined(PCBX7)
870 MIXSRC_SG, LUA_EXPORT("sg", "Switch G")
871 #endif
872 MIXSRC_SH, LUA_EXPORT("sh", "Switch H")
873 #if defined(PCBX9E)
874 MIXSRC_SI, LUA_EXPORT("si", "Switch I")
875 MIXSRC_SJ, LUA_EXPORT("sj", "Switch J")
876 MIXSRC_SK, LUA_EXPORT("sk", "Switch K")
877 MIXSRC_SL, LUA_EXPORT("sl", "Switch L")
878 MIXSRC_SM, LUA_EXPORT("sm", "Switch M")
879 MIXSRC_SN, LUA_EXPORT("sn", "Switch N")
880 MIXSRC_SO, LUA_EXPORT("so", "Switch O")
881 MIXSRC_SP, LUA_EXPORT("sp", "Switch P")
882 MIXSRC_SQ, LUA_EXPORT("sq", "Switch Q")
883 MIXSRC_SR, LUA_EXPORT("sr", "Switch R")
884 MIXSRC_LAST_SWITCH = MIXSRC_SR,
885 #else
886 MIXSRC_LAST_SWITCH = MIXSRC_SH,
887 #endif
888 #else
889 MIXSRC_3POS = MIXSRC_FIRST_SWITCH,
890 MIXSRC_THR,
891 MIXSRC_RUD,
892 MIXSRC_ELE,
893 MIXSRC_AIL,
894 MIXSRC_GEA,
895 MIXSRC_TRN,
896 MIXSRC_LAST_SWITCH = MIXSRC_TRN,
897 #endif
898 MIXSRC_FIRST_LOGICAL_SWITCH,
899 MIXSRC_SW1 = MIXSRC_FIRST_LOGICAL_SWITCH, LUA_EXPORT_MULTIPLE("ls", "Logical switch L%d", MAX_LOGICAL_SWITCHES)
900 MIXSRC_LAST_LOGICAL_SWITCH = MIXSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
902 MIXSRC_FIRST_TRAINER, LUA_EXPORT_MULTIPLE("trn", "Trainer input %d", MAX_TRAINER_CHANNELS)
903 MIXSRC_LAST_TRAINER = MIXSRC_FIRST_TRAINER+MAX_TRAINER_CHANNELS-1,
905 MIXSRC_FIRST_CH,
906 MIXSRC_CH1 = MIXSRC_FIRST_CH, LUA_EXPORT_MULTIPLE("ch", "Channel CH%d", MAX_OUTPUT_CHANNELS)
907 MIXSRC_CH2,
908 MIXSRC_CH3,
909 MIXSRC_CH4,
910 MIXSRC_CH5,
911 MIXSRC_CH6,
912 MIXSRC_CH7,
913 MIXSRC_CH8,
914 MIXSRC_CH9,
915 MIXSRC_CH10,
916 MIXSRC_CH11,
917 MIXSRC_CH12,
918 MIXSRC_CH13,
919 MIXSRC_CH14,
920 MIXSRC_CH15,
921 MIXSRC_CH16,
922 MIXSRC_LAST_CH = MIXSRC_CH1+MAX_OUTPUT_CHANNELS-1,
924 MIXSRC_FIRST_GVAR,
925 MIXSRC_GVAR1 = MIXSRC_FIRST_GVAR, LUA_EXPORT_MULTIPLE("gvar", "Global variable %d", MAX_GVARS)
926 MIXSRC_LAST_GVAR = MIXSRC_FIRST_GVAR+MAX_GVARS-1,
928 #if defined(CPUARM)
929 MIXSRC_TX_VOLTAGE, LUA_EXPORT("tx-voltage", "Transmitter battery voltage [volts]")
930 MIXSRC_TX_TIME, LUA_EXPORT("clock", "RTC clock [minutes from midnight]")
931 #if defined(INTERNAL_GPS)
932 MIXSRC_TX_GPS,
933 MIXSRC_FIRST_RESERVE,
934 #else
935 MIXSRC_FIRST_RESERVE,
936 MIXSRC_RESERVE2,
937 #endif
938 MIXSRC_RESERVE3,
939 MIXSRC_RESERVE4,
940 MIXSRC_LAST_RESERVE,
941 MIXSRC_FIRST_TIMER,
942 MIXSRC_TIMER1 = MIXSRC_FIRST_TIMER, LUA_EXPORT("timer1", "Timer 1 value [seconds]")
943 MIXSRC_TIMER2, LUA_EXPORT("timer2", "Timer 2 value [seconds]")
944 MIXSRC_TIMER3, LUA_EXPORT("timer3", "Timer 3 value [seconds]")
945 MIXSRC_LAST_TIMER = MIXSRC_TIMER3,
946 #endif
948 MIXSRC_FIRST_TELEM,
949 #if defined(CPUARM)
950 MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+3*MAX_TELEMETRY_SENSORS-1
951 #else
952 MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+NUM_TELEMETRY-1
953 #endif
956 #define MIXSRC_FIRST (MIXSRC_NONE+1)
957 #define MIXSRC_LAST MIXSRC_LAST_CH
958 #define INPUTSRC_FIRST MIXSRC_Rud
959 #define INPUTSRC_LAST MIXSRC_LAST_TELEM
961 enum BacklightMode {
962 e_backlight_mode_off = 0,
963 e_backlight_mode_keys = 1,
964 e_backlight_mode_sticks = 2,
965 e_backlight_mode_all = e_backlight_mode_keys+e_backlight_mode_sticks,
966 e_backlight_mode_on
969 enum Functions {
970 // first the functions which need a checkbox
971 FUNC_OVERRIDE_CHANNEL,
972 FUNC_TRAINER,
973 FUNC_INSTANT_TRIM,
974 FUNC_RESET,
975 #if defined(CPUARM)
976 FUNC_SET_TIMER,
977 #endif
978 FUNC_ADJUST_GVAR,
979 #if defined(CPUARM)
980 FUNC_VOLUME,
981 FUNC_SET_FAILSAFE,
982 FUNC_RANGECHECK,
983 FUNC_BIND,
984 #endif
985 // then the other functions
986 FUNC_FIRST_WITHOUT_ENABLE,
987 FUNC_PLAY_SOUND = FUNC_FIRST_WITHOUT_ENABLE,
988 FUNC_PLAY_TRACK,
989 #if !defined(CPUARM)
990 FUNC_PLAY_BOTH,
991 #endif
992 FUNC_PLAY_VALUE,
993 #if defined(CPUARM)
994 FUNC_RESERVE4,
995 FUNC_PLAY_SCRIPT,
996 FUNC_RESERVE5,
997 FUNC_BACKGND_MUSIC,
998 FUNC_BACKGND_MUSIC_PAUSE,
999 #endif
1000 FUNC_VARIO,
1001 FUNC_HAPTIC,
1002 #if !defined(PCBSTD)
1003 FUNC_LOGS,
1004 #endif
1005 FUNC_BACKLIGHT,
1006 #if defined(PCBTARANIS)
1007 FUNC_SCREENSHOT,
1008 #endif
1009 #if defined(DEBUG)
1010 FUNC_TEST, // should remain the last before MAX as not added in Companion
1011 #endif
1012 FUNC_MAX
1015 enum TimerModes {
1016 TMRMODE_NONE,
1017 TMRMODE_ABS,
1018 TMRMODE_THR,
1019 TMRMODE_THR_REL,
1020 TMRMODE_THR_TRG,
1021 TMRMODE_COUNT
1024 enum CountDownModes {
1025 COUNTDOWN_SILENT,
1026 COUNTDOWN_BEEPS,
1027 COUNTDOWN_VOICE,
1028 #if defined(HAPTIC)
1029 COUNTDOWN_HAPTIC,
1030 #endif
1031 COUNTDOWN_COUNT
1034 enum ResetFunctionParam {
1035 FUNC_RESET_TIMER1,
1036 FUNC_RESET_TIMER2,
1037 #if defined(CPUARM)
1038 FUNC_RESET_TIMER3,
1039 #endif
1040 FUNC_RESET_FLIGHT,
1041 #if defined(TELEMETRY_FRSKY)
1042 FUNC_RESET_TELEMETRY,
1043 #endif
1044 #if ROTARY_ENCODERS > 0
1045 FUNC_RESET_ROTENC1,
1046 #endif
1047 #if ROTARY_ENCODERS > 1
1048 FUNC_RESET_ROTENC2,
1049 #endif
1050 #if defined(CPUARM)
1051 FUNC_RESET_PARAM_FIRST_TELEM,
1052 FUNC_RESET_PARAM_LAST_TELEM = FUNC_RESET_PARAM_FIRST_TELEM + MAX_TELEMETRY_SENSORS,
1053 #endif
1054 FUNC_RESET_PARAMS_COUNT,
1055 FUNC_RESET_PARAM_LAST = FUNC_RESET_PARAMS_COUNT-1,
1058 enum AdjustGvarFunctionParam {
1059 FUNC_ADJUST_GVAR_CONSTANT,
1060 FUNC_ADJUST_GVAR_SOURCE,
1061 FUNC_ADJUST_GVAR_GVAR,
1062 FUNC_ADJUST_GVAR_INCDEC,
1065 enum BluetoothModes {
1066 BLUETOOTH_OFF,
1067 BLUETOOTH_TELEMETRY,
1068 BLUETOOTH_TRAINER,
1071 #endif // _DATACONSTANTS_H_