Bsongis/x7d companion support (#4028)
[opentx.git] / radio / src / dataconstants.h
bloba200afc2821bee5226d90243d9e24ddbe9cd86fd
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
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(PCBX7D)
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
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
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(PCBHORUS)
219 #define NUM_AUX_TRIMS 2
220 #define NUM_MOUSE_ANALOGS 2
221 #else
222 #define NUM_AUX_TRIMS 0
223 #define NUM_MOUSE_ANALOGS 0
224 #endif
226 #if defined(COLORLCD)
227 enum MainViews {
228 VIEW_BLANK,
229 VIEW_TIMERS_ALTITUDE,
230 VIEW_CHANNELS,
231 VIEW_TELEM1,
232 VIEW_TELEM2,
233 VIEW_TELEM3,
234 VIEW_TELEM4,
235 VIEW_COUNT
237 #elif LCD_W >= 212
238 enum MainViews {
239 VIEW_TIMERS,
240 VIEW_INPUTS,
241 VIEW_SWITCHES,
242 VIEW_COUNT
244 #else
245 enum MainViews {
246 VIEW_OUTPUTS_VALUES,
247 VIEW_OUTPUTS_BARS,
248 VIEW_INPUTS,
249 VIEW_TIMER2,
250 VIEW_COUNT
252 #endif
254 enum BeeperMode {
255 e_mode_quiet = -2,
256 e_mode_alarms,
257 e_mode_nokeys,
258 e_mode_all
261 #if defined(PCBFLAMENCO)
262 enum ModuleIndex {
263 EXTERNAL_MODULE,
264 TRAINER_MODULE,
266 enum TrainerMode {
267 TRAINER_MODE_MASTER,
268 TRAINER_MODE_SLAVE
270 #elif defined(PCBTARANIS) || defined(PCBHORUS)
271 enum ModuleIndex {
272 INTERNAL_MODULE,
273 EXTERNAL_MODULE,
274 TRAINER_MODULE
276 enum TrainerMode {
277 TRAINER_MODE_MASTER_TRAINER_JACK,
278 TRAINER_MODE_SLAVE,
279 #if defined(PCBTARANIS)
280 TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE,
281 TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
282 #endif
283 TRAINER_MODE_MASTER_BATTERY_COMPARTMENT,
285 #elif defined(PCBSKY9X)
286 enum ModuleIndex {
287 EXTERNAL_MODULE,
288 EXTRA_MODULE,
289 TRAINER_MODULE
291 #endif
293 enum UartModes {
294 #if defined(CLI) || defined(DEBUG)
295 UART_MODE_DEBUG,
296 #else
297 UART_MODE_NONE,
298 #endif
299 UART_MODE_TELEMETRY_MIRROR,
300 UART_MODE_TELEMETRY,
301 UART_MODE_SBUS_TRAINER,
302 // UART_MODE_CPPM_TRAINER,
303 UART_MODE_COUNT,
304 UART_MODE_MAX = UART_MODE_COUNT-1
307 #if defined(PCBHORUS)
308 #define LEN_SWITCH_NAME 3
309 #define LEN_ANA_NAME 3
310 #define LEN_MODEL_FILENAME 16
311 #define LEN_BLUETOOTH_NAME 10
312 #elif defined(CPUARM)
313 #define LEN_SWITCH_NAME 3
314 #define LEN_ANA_NAME 3
315 #define LEN_BLUETOOTH_NAME 10
316 #endif
318 #if defined(CPUARM)
319 #define TELEM_LABEL_LEN 4
320 enum TelemetryUnit {
321 UNIT_RAW,
322 UNIT_VOLTS,
323 UNIT_AMPS,
324 UNIT_MILLIAMPS,
325 UNIT_KTS,
326 UNIT_METERS_PER_SECOND,
327 UNIT_FEET_PER_SECOND,
328 UNIT_KMH,
329 UNIT_MPH,
330 UNIT_METERS,
331 UNIT_FEET,
332 UNIT_CELSIUS,
333 UNIT_FAHRENHEIT,
334 UNIT_PERCENT,
335 UNIT_MAH,
336 UNIT_WATTS,
337 UNIT_MILLIWATTS,
338 UNIT_DB,
339 UNIT_RPMS,
340 UNIT_G,
341 UNIT_DEGREE,
342 UNIT_RADIANS,
343 UNIT_MILLILITERS,
344 UNIT_FLOZ,
345 UNIT_HOURS,
346 UNIT_MINUTES,
347 UNIT_SECONDS,
348 // FrSky format used for these fields, could be another format in the future
349 UNIT_FIRST_VIRTUAL,
350 UNIT_CELLS = UNIT_FIRST_VIRTUAL,
351 UNIT_DATETIME,
352 UNIT_GPS,
353 UNIT_BITFIELD,
354 UNIT_TEXT,
355 // Internal units (not stored in sensor unit)
356 UNIT_GPS_LONGITUDE,
357 UNIT_GPS_LATITUDE,
358 UNIT_DATETIME_YEAR,
359 UNIT_DATETIME_DAY_MONTH,
360 UNIT_DATETIME_HOUR_MIN,
361 UNIT_DATETIME_SEC
363 #define UNIT_MAX UNIT_FLOZ
364 #define UNIT_DIST UNIT_METERS
365 #define UNIT_TEMPERATURE UNIT_CELSIUS
366 #define UNIT_SPEED UNIT_KMH
367 #else
368 #if !defined(CPUARM)
369 enum TelemetrySource {
370 TELEM_NONE,
371 TELEM_TX_VOLTAGE,
372 TELEM_TIMER1,
373 TELEM_TIMER2,
374 TELEM_TIMER_MAX=TELEM_TIMER2,
375 TELEM_RSSI_TX,
376 TELEM_RSSI_RX,
377 TELEM_A_FIRST,
378 TELEM_A1=TELEM_A_FIRST,
379 TELEM_A2,
380 TELEM_A_LAST=TELEM_A2,
381 TELEM_ALT,
382 TELEM_RPM,
383 TELEM_FUEL,
384 TELEM_T1,
385 TELEM_T2,
386 TELEM_SPEED,
387 TELEM_DIST,
388 TELEM_GPSALT,
389 TELEM_CELL,
390 TELEM_CELLS_SUM,
391 TELEM_VFAS,
392 TELEM_CURRENT,
393 TELEM_CONSUMPTION,
394 TELEM_POWER,
395 TELEM_ACCx,
396 TELEM_ACCy,
397 TELEM_ACCz,
398 TELEM_HDG,
399 TELEM_VSPEED,
400 TELEM_ASPEED,
401 TELEM_DTE,
402 TELEM_MIN_A_FIRST,
403 TELEM_MIN_A1=TELEM_MIN_A_FIRST,
404 TELEM_MIN_A2,
405 TELEM_MIN_A_LAST=TELEM_MIN_A2,
406 TELEM_MIN_ALT,
407 TELEM_MAX_ALT,
408 TELEM_MAX_RPM,
409 TELEM_MAX_T1,
410 TELEM_MAX_T2,
411 TELEM_MAX_SPEED,
412 TELEM_MAX_DIST,
413 TELEM_MAX_ASPEED,
414 TELEM_MIN_CELL,
415 TELEM_MIN_CELLS_SUM,
416 TELEM_MIN_VFAS,
417 TELEM_MAX_CURRENT,
418 TELEM_MAX_POWER,
419 TELEM_ACC,
420 TELEM_GPS_TIME,
421 TELEM_CSW_MAX = TELEM_MAX_POWER,
422 TELEM_NOUSR_MAX = TELEM_A2,
423 #if defined(TELEMETRY_FRSKY)
424 TELEM_DISPLAY_MAX = TELEM_MAX_POWER,
425 #else
426 TELEM_DISPLAY_MAX = TELEM_TIMER2, // because used also in PlayValue
427 #endif
428 TELEM_STATUS_MAX = TELEM_GPS_TIME,
429 TELEM_FIRST_STREAMED_VALUE = TELEM_RSSI_TX,
432 #if defined(FRSKY_HUB)
433 #define NUM_TELEMETRY TELEM_CSW_MAX
434 #elif defined(WS_HOW_HIGH)
435 #define NUM_TELEMETRY TELEM_ALT
436 #elif defined(TELEMETRY_FRSKY)
437 #define NUM_TELEMETRY TELEM_A2
438 #elif defined(TELEMETRY_MAVLINK)
439 #define NUM_TELEMETRY 4
440 #else
441 #define NUM_TELEMETRY TELEM_TIMER2
442 #endif
444 #endif
446 enum TelemetryUnit {
447 UNIT_VOLTS,
448 UNIT_AMPS,
449 UNIT_METERS_PER_SECOND,
450 UNIT_RAW,
451 UNIT_SPEED,
452 UNIT_DIST,
453 UNIT_TEMPERATURE,
454 UNIT_PERCENT,
455 UNIT_MILLIAMPS,
456 UNIT_A1A2_MAX = UNIT_MILLIAMPS,
457 UNIT_MAH,
458 UNIT_WATTS,
459 UNIT_DB,
460 UNIT_FEET,
461 UNIT_KTS,
462 UNIT_HOURS,
463 UNIT_MINUTES,
464 UNIT_SECONDS,
465 UNIT_RPMS,
466 UNIT_G,
467 UNIT_HDG
469 #endif
471 #if LCD_W >= 212
472 #define NUM_LINE_ITEMS 3
473 #else
474 #define NUM_LINE_ITEMS 2
475 #endif
477 #if defined(PCBTARANIS)
478 #define MAX_TELEM_SCRIPT_INPUTS 8
479 #endif
481 #if defined(CPUARM)
482 enum TelemetryScreenType {
483 TELEMETRY_SCREEN_TYPE_NONE,
484 TELEMETRY_SCREEN_TYPE_VALUES,
485 TELEMETRY_SCREEN_TYPE_GAUGES,
486 #if defined(LUA)
487 TELEMETRY_SCREEN_TYPE_SCRIPT,
488 TELEMETRY_SCREEN_TYPE_MAX = TELEMETRY_SCREEN_TYPE_SCRIPT
489 #else
490 TELEMETRY_SCREEN_TYPE_MAX = TELEMETRY_SCREEN_TYPE_GAUGES
491 #endif
493 #define MAX_TELEMETRY_SCREENS 4
494 #define TELEMETRY_SCREEN_TYPE(screenIndex) TelemetryScreenType((g_model.frsky.screensType >> (2*(screenIndex))) & 0x03)
495 #define IS_BARS_SCREEN(screenIndex) (TELEMETRY_SCREEN_TYPE(screenIndex) == TELEMETRY_SCREEN_TYPE_GAUGES)
496 #define MIN_BLADES -1 // 1 blade
497 #define MAX_BLADES 126 // 128 blades
498 #else
499 #define MAX_FRSKY_A_CHANNELS 2
500 #define MAX_TELEMETRY_SCREENS 2
501 #define IS_BARS_SCREEN(screenIndex) (g_model.frsky.screensType & (1<<(screenIndex)))
502 #define MIN_BLADES 0 // 2 blades
503 #define MAX_BLADES 3 // 5 blades
504 #endif
506 #define FAILSAFE_CHANNEL_HOLD 2000
507 #define FAILSAFE_CHANNEL_NOPULSE 2001
509 #define LEN_SCRIPT_FILENAME 6
510 #define LEN_SCRIPT_NAME 6
511 #define MAX_SCRIPT_INPUTS 6
512 #define MAX_SCRIPT_OUTPUTS 6
514 enum PotsWarnMode {
515 POTS_WARN_OFF,
516 POTS_WARN_MANUAL,
517 POTS_WARN_AUTO
520 #if !defined(PCBSTD)
521 #define LEN_GVAR_NAME 3
522 #define GVAR_MAX 1024
523 #define GVAR_MIN -GVAR_MAX
524 #endif
526 #define RESERVE_RANGE_FOR_GVARS 10
527 // even we do not spend space in EEPROM for 10 GVARS, we reserve the space inside the range of values, like offset, weight, etc.
529 #if defined(PCBSTD) && defined(GVARS)
530 #define MAX_GVARS 5
531 #elif defined(PCBSTD)
532 #define MAX_GVARS 0
533 #elif defined(CPUARM)
534 #define MAX_GVARS 9
535 #else
536 #define MAX_GVARS 5
537 #endif
539 enum SwitchSources {
540 SWSRC_NONE = 0,
542 SWSRC_FIRST_SWITCH,
544 #if defined(PCBFLAMENCO)
545 SWSRC_SA0 = SWSRC_FIRST_SWITCH,
546 SWSRC_SA1,
547 SWSRC_SA2,
548 SWSRC_SB0,
549 SWSRC_SB2,
550 SWSRC_SC0,
551 SWSRC_SC1,
552 SWSRC_SC2,
553 SWSRC_SC3,
554 SWSRC_SC4,
555 SWSRC_SC5,
556 SWSRC_SE0,
557 SWSRC_SE2,
558 SWSRC_SF0,
559 SWSRC_SF1,
560 SWSRC_SF2,
561 SWSRC_LAST_SWITCH = SWSRC_SF2,
562 #elif defined(PCBTARANIS) || defined(PCBHORUS)
563 SWSRC_SA0 = SWSRC_FIRST_SWITCH,
564 SWSRC_SA1,
565 SWSRC_SA2,
566 SWSRC_SB0,
567 SWSRC_SB1,
568 SWSRC_SB2,
569 SWSRC_SC0,
570 SWSRC_SC1,
571 SWSRC_SC2,
572 SWSRC_SD0,
573 SWSRC_SD1,
574 SWSRC_SD2,
575 SWSRC_SE0,
576 SWSRC_SE1,
577 SWSRC_SE2,
578 SWSRC_SF0,
579 SWSRC_SF1,
580 SWSRC_SF2,
581 SWSRC_SG0,
582 SWSRC_SG1,
583 SWSRC_SG2,
584 SWSRC_SH0,
585 SWSRC_SH1,
586 SWSRC_SH2,
587 SWSRC_TRAINER = SWSRC_SH2,
588 #if defined(PCBX9E)
589 SWSRC_SI0,
590 SWSRC_SI1,
591 SWSRC_SI2,
592 SWSRC_SJ0,
593 SWSRC_SJ1,
594 SWSRC_SJ2,
595 SWSRC_SK0,
596 SWSRC_SK1,
597 SWSRC_SK2,
598 SWSRC_SL0,
599 SWSRC_SL1,
600 SWSRC_SL2,
601 SWSRC_SM0,
602 SWSRC_SM1,
603 SWSRC_SM2,
604 SWSRC_SN0,
605 SWSRC_SN1,
606 SWSRC_SN2,
607 SWSRC_SO0,
608 SWSRC_SO1,
609 SWSRC_SO2,
610 SWSRC_SP0,
611 SWSRC_SP1,
612 SWSRC_SP2,
613 SWSRC_SQ0,
614 SWSRC_SQ1,
615 SWSRC_SQ2,
616 SWSRC_SR0,
617 SWSRC_SR1,
618 SWSRC_SR2,
619 SWSRC_LAST_SWITCH = SWSRC_SR2,
620 #else
621 SWSRC_LAST_SWITCH = SWSRC_SH2,
622 #endif
623 #else
624 SWSRC_ID0 = SWSRC_FIRST_SWITCH,
625 SWSRC_ID1,
626 SWSRC_ID2,
627 SWSRC_THR,
628 SWSRC_RUD,
629 SWSRC_ELE,
630 SWSRC_AIL,
631 SWSRC_GEA,
632 SWSRC_TRN,
633 SWSRC_TRAINER = SWSRC_TRN,
634 SWSRC_LAST_SWITCH = SWSRC_TRN,
635 #endif
637 #if NUM_XPOTS > 0
638 SWSRC_FIRST_MULTIPOS_SWITCH,
639 SWSRC_LAST_MULTIPOS_SWITCH = SWSRC_FIRST_MULTIPOS_SWITCH + (NUM_XPOTS*XPOTS_MULTIPOS_COUNT) - 1,
640 #endif
642 SWSRC_FIRST_TRIM,
643 SWSRC_TrimRudLeft = SWSRC_FIRST_TRIM,
644 SWSRC_TrimRudRight,
645 SWSRC_TrimEleDown,
646 SWSRC_TrimEleUp,
647 SWSRC_TrimThrDown,
648 SWSRC_TrimThrUp,
649 SWSRC_TrimAilLeft,
650 SWSRC_TrimAilRight,
651 #if defined(PCBHORUS)
652 SWSRC_TrimT5Down,
653 SWSRC_TrimT5Up,
654 SWSRC_TrimT6Down,
655 SWSRC_TrimT6Up,
656 SWSRC_LAST_TRIM = SWSRC_TrimT6Up,
657 #else
658 SWSRC_LAST_TRIM = SWSRC_TrimAilRight,
659 #endif
661 #if defined(PCBSKY9X)
662 SWSRC_REa,
663 #elif defined(CPUM2560)
664 SWSRC_REa,
665 SWSRC_REb,
666 #endif
668 SWSRC_FIRST_LOGICAL_SWITCH,
669 SWSRC_SW1 = SWSRC_FIRST_LOGICAL_SWITCH,
670 SWSRC_SW2,
671 SWSRC_SW3,
672 SWSRC_SW4,
673 SWSRC_SW5,
674 SWSRC_SW6,
675 SWSRC_SW7,
676 SWSRC_SW8,
677 SWSRC_SW9,
678 SWSRC_SWA,
679 SWSRC_SWB,
680 SWSRC_SWC,
681 SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
683 SWSRC_ON,
684 SWSRC_ONE,
686 #if defined(CPUARM)
687 SWSRC_FIRST_FLIGHT_MODE,
688 SWSRC_LAST_FLIGHT_MODE = SWSRC_FIRST_FLIGHT_MODE+MAX_FLIGHT_MODES-1,
690 SWSRC_TELEMETRY_STREAMING,
691 SWSRC_FIRST_SENSOR,
692 SWSRC_LAST_SENSOR = SWSRC_FIRST_SENSOR+MAX_TELEMETRY_SENSORS-1,
693 #endif
695 SWSRC_COUNT,
697 SWSRC_OFF = -SWSRC_ON,
699 SWSRC_LAST = SWSRC_COUNT-1,
700 SWSRC_FIRST = -SWSRC_LAST,
702 #if defined(CPUARM)
703 SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_COUNT-1,
704 SWSRC_LAST_IN_MIXES = SWSRC_COUNT-1,
705 #else
706 SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_LAST_LOGICAL_SWITCH,
707 SWSRC_LAST_IN_MIXES = SWSRC_LAST_LOGICAL_SWITCH,
708 #endif
710 SWSRC_FIRST_IN_LOGICAL_SWITCHES = -SWSRC_LAST_IN_LOGICAL_SWITCHES,
711 SWSRC_FIRST_IN_MIXES = -SWSRC_LAST_IN_MIXES,
713 #if defined(CPUARM)
714 SWSRC_INVERT = SWSRC_COUNT+1,
715 #endif
718 enum MixSources {
719 MIXSRC_NONE,
721 #if defined(VIRTUAL_INPUTS)
722 MIXSRC_FIRST_INPUT, LUA_EXPORT_MULTIPLE("input", "Input [I%d]", MAX_INPUTS)
723 MIXSRC_LAST_INPUT = MIXSRC_FIRST_INPUT+MAX_INPUTS-1,
724 #endif
726 #if defined(LUA_INPUTS)
727 MIXSRC_FIRST_LUA,
728 MIXSRC_LAST_LUA = MIXSRC_FIRST_LUA+(MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS)-1,
729 #endif
731 MIXSRC_FIRST_STICK,
732 MIXSRC_Rud = MIXSRC_FIRST_STICK, LUA_EXPORT("rud", "Rudder")
733 MIXSRC_Ele, LUA_EXPORT("ele", "Elevator")
734 MIXSRC_Thr, LUA_EXPORT("thr", "Throttle")
735 MIXSRC_Ail, LUA_EXPORT("ail", "Aileron")
737 MIXSRC_FIRST_POT,
738 #if defined(PCBHORUS)
739 MIXSRC_S1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer S1")
740 MIXSRC_6POS, LUA_EXPORT("6pos", "Multipos Switch")
741 MIXSRC_S2, LUA_EXPORT("s2", "Potentiometer S2")
742 MIXSRC_FIRST_SLIDER,
743 MIXSRC_S3 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("s3", "Slider S3")
744 MIXSRC_S4, LUA_EXPORT("s4", "Slider S4")
745 MIXSRC_LS, LUA_EXPORT("ls", "Left rear slider")
746 MIXSRC_RS, LUA_EXPORT("rs", "Right rear slider")
747 MIXSRC_LAST_POT = MIXSRC_RS,
748 #elif defined(PCBFLAMENCO)
749 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("sd", "Potentiometer D")
750 MIXSRC_SLIDER1, LUA_EXPORT("ls", "Left slider")
751 MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
752 MIXSRC_LAST_POT = MIXSRC_SLIDER2,
753 #elif defined(PCBX9E)
754 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
755 MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
756 MIXSRC_POT3, LUA_EXPORT("s3", "Potentiometer 3")
757 MIXSRC_POT4, LUA_EXPORT("s4", "Potentiometer 4 (X9E only)")
758 MIXSRC_FIRST_SLIDER,
759 MIXSRC_SLIDER1 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("ls", "Left slider")
760 MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
761 MIXSRC_SLIDER3, LUA_EXPORT("lcs", "Left center slider (X9E only)")
762 MIXSRC_SLIDER4, LUA_EXPORT("rcs", "Right center slider (X9E only)")
763 MIXSRC_LAST_POT = MIXSRC_SLIDER4,
764 #elif defined(PCBX7D)
765 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
766 MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
767 MIXSRC_LAST_POT = MIXSRC_POT2,
768 #elif defined(PCBTARANIS)
769 MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
770 MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
771 MIXSRC_POT3, LUA_EXPORT("s3", "Potentiometer 3")
772 MIXSRC_FIRST_SLIDER,
773 MIXSRC_SLIDER1 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("ls", "Left slider")
774 MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
775 MIXSRC_LAST_POT = MIXSRC_SLIDER2,
776 #else
777 MIXSRC_P1 = MIXSRC_FIRST_POT,
778 MIXSRC_P2,
779 MIXSRC_P3,
780 MIXSRC_LAST_POT = MIXSRC_P3,
781 #endif
783 #if defined(PCBHORUS)
784 MIXSRC_MOUSE1,
785 MIXSRC_MOUSE2,
786 #endif
788 #if defined(PCBSKY9X)
789 MIXSRC_REa,
790 MIXSRC_LAST_ROTARY_ENCODER = MIXSRC_REa,
791 #elif defined(CPUM2560)
792 MIXSRC_REa,
793 MIXSRC_REb,
794 #if ROTARY_ENCODERS > 2
795 MIXSRC_REc,
796 MIXSRC_REd,
797 MIXSRC_LAST_ROTARY_ENCODER = MIXSRC_REd,
798 #else
799 MIXSRC_LAST_ROTARY_ENCODER = MIXSRC_REb,
800 #endif
801 #endif
803 MIXSRC_MAX,
805 MIXSRC_FIRST_HELI,
806 MIXSRC_CYC1 = MIXSRC_FIRST_HELI, LUA_EXPORT("cyc1", "Cyclic 1")
807 MIXSRC_CYC2, LUA_EXPORT("cyc2", "Cyclic 2")
808 MIXSRC_CYC3, LUA_EXPORT("cyc3", "Cyclic 3")
810 MIXSRC_FIRST_TRIM,
811 MIXSRC_TrimRud = MIXSRC_FIRST_TRIM, LUA_EXPORT("trim-rud", "Rudder trim")
812 MIXSRC_TrimEle, LUA_EXPORT("trim-ele", "Elevator trim")
813 MIXSRC_TrimThr, LUA_EXPORT("trim-thr", "Throttle trim")
814 MIXSRC_TrimAil, LUA_EXPORT("trim-ail", "Aileron trim")
815 #if defined(PCBHORUS)
816 MIXSRC_TrimT5, LUA_EXPORT("trim-t5", "Aux trim T5")
817 MIXSRC_TrimT6, LUA_EXPORT("trim-t6", "Aux trim T6")
818 MIXSRC_LAST_TRIM = MIXSRC_TrimT6,
819 #else
820 MIXSRC_LAST_TRIM = MIXSRC_TrimAil,
821 #endif
823 MIXSRC_FIRST_SWITCH,
825 #if defined(PCBFLAMENCO)
826 MIXSRC_SA = MIXSRC_FIRST_SWITCH, LUA_EXPORT("sa", "Switch A")
827 MIXSRC_SB, LUA_EXPORT("sb", "Switch B")
828 MIXSRC_SC, LUA_EXPORT("sc", "Switch C")
829 MIXSRC_SE, LUA_EXPORT("se", "Switch E")
830 MIXSRC_SF, LUA_EXPORT("sf", "Switch F")
831 MIXSRC_LAST_SWITCH = MIXSRC_SF,
832 #elif defined(PCBTARANIS) || defined(PCBHORUS)
833 MIXSRC_SA = MIXSRC_FIRST_SWITCH, LUA_EXPORT("sa", "Switch A")
834 MIXSRC_SB, LUA_EXPORT("sb", "Switch B")
835 MIXSRC_SC, LUA_EXPORT("sc", "Switch C")
836 MIXSRC_SD, LUA_EXPORT("sd", "Switch D")
837 #if !defined(PCBX7D)
838 MIXSRC_SE, LUA_EXPORT("se", "Switch E")
839 #endif
840 MIXSRC_SF, LUA_EXPORT("sf", "Switch F")
841 #if !defined(PCBX7D)
842 MIXSRC_SG, LUA_EXPORT("sg", "Switch G")
843 #endif
844 MIXSRC_SH, LUA_EXPORT("sh", "Switch H")
845 #if defined(PCBX9E)
846 MIXSRC_SI, LUA_EXPORT("si", "Switch I")
847 MIXSRC_SJ, LUA_EXPORT("sj", "Switch J")
848 MIXSRC_SK, LUA_EXPORT("sk", "Switch K")
849 MIXSRC_SL, LUA_EXPORT("sl", "Switch L")
850 MIXSRC_SM, LUA_EXPORT("sm", "Switch M")
851 MIXSRC_SN, LUA_EXPORT("sn", "Switch N")
852 MIXSRC_SO, LUA_EXPORT("so", "Switch O")
853 MIXSRC_SP, LUA_EXPORT("sp", "Switch P")
854 MIXSRC_SQ, LUA_EXPORT("sq", "Switch Q")
855 MIXSRC_SR, LUA_EXPORT("sr", "Switch R")
856 MIXSRC_LAST_SWITCH = MIXSRC_SR,
857 #else
858 MIXSRC_LAST_SWITCH = MIXSRC_SH,
859 #endif
860 #else
861 MIXSRC_3POS = MIXSRC_FIRST_SWITCH,
862 MIXSRC_THR,
863 MIXSRC_RUD,
864 MIXSRC_ELE,
865 MIXSRC_AIL,
866 MIXSRC_GEA,
867 MIXSRC_TRN,
868 MIXSRC_LAST_SWITCH = MIXSRC_TRN,
869 #endif
870 MIXSRC_FIRST_LOGICAL_SWITCH,
871 MIXSRC_SW1 = MIXSRC_FIRST_LOGICAL_SWITCH, LUA_EXPORT_MULTIPLE("ls", "Logical switch L%d", MAX_LOGICAL_SWITCHES)
872 MIXSRC_LAST_LOGICAL_SWITCH = MIXSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
874 MIXSRC_FIRST_TRAINER, LUA_EXPORT_MULTIPLE("trn", "Trainer input %d", MAX_TRAINER_CHANNELS)
875 MIXSRC_LAST_TRAINER = MIXSRC_FIRST_TRAINER+MAX_TRAINER_CHANNELS-1,
877 MIXSRC_FIRST_CH,
878 MIXSRC_CH1 = MIXSRC_FIRST_CH, LUA_EXPORT_MULTIPLE("ch", "Channel CH%d", MAX_OUTPUT_CHANNELS)
879 MIXSRC_CH2,
880 MIXSRC_CH3,
881 MIXSRC_CH4,
882 MIXSRC_CH5,
883 MIXSRC_CH6,
884 MIXSRC_CH7,
885 MIXSRC_CH8,
886 MIXSRC_CH9,
887 MIXSRC_CH10,
888 MIXSRC_CH11,
889 MIXSRC_CH12,
890 MIXSRC_CH13,
891 MIXSRC_CH14,
892 MIXSRC_CH15,
893 MIXSRC_CH16,
894 MIXSRC_LAST_CH = MIXSRC_CH1+MAX_OUTPUT_CHANNELS-1,
896 MIXSRC_FIRST_GVAR,
897 MIXSRC_GVAR1 = MIXSRC_FIRST_GVAR, LUA_EXPORT_MULTIPLE("gvar", "Global variable %d", MAX_GVARS)
898 MIXSRC_LAST_GVAR = MIXSRC_FIRST_GVAR+MAX_GVARS-1,
900 #if defined(CPUARM)
901 MIXSRC_TX_VOLTAGE, LUA_EXPORT("tx-voltage", "Transmitter battery voltage [volts]")
902 MIXSRC_TX_TIME, LUA_EXPORT("clock", "RTC clock [minutes from midnight]")
903 #if defined(INTERNAL_GPS)
904 MIXSRC_TX_GPS,
905 MIXSRC_FIRST_RESERVE,
906 #else
907 MIXSRC_FIRST_RESERVE,
908 MIXSRC_RESERVE2,
909 #endif
910 MIXSRC_RESERVE3,
911 MIXSRC_RESERVE4,
912 MIXSRC_LAST_RESERVE,
913 MIXSRC_FIRST_TIMER,
914 MIXSRC_TIMER1 = MIXSRC_FIRST_TIMER, LUA_EXPORT("timer1", "Timer 1 value [seconds]")
915 MIXSRC_TIMER2, LUA_EXPORT("timer2", "Timer 2 value [seconds]")
916 MIXSRC_TIMER3, LUA_EXPORT("timer3", "Timer 3 value [seconds]")
917 MIXSRC_LAST_TIMER = MIXSRC_TIMER3,
918 #endif
920 MIXSRC_FIRST_TELEM,
921 #if defined(CPUARM)
922 MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+3*MAX_TELEMETRY_SENSORS-1
923 #else
924 MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+NUM_TELEMETRY-1
925 #endif
928 #define MIXSRC_FIRST (MIXSRC_NONE+1)
929 #define MIXSRC_LAST MIXSRC_LAST_CH
930 #define INPUTSRC_FIRST MIXSRC_Rud
931 #define INPUTSRC_LAST MIXSRC_LAST_TELEM
933 enum BacklightMode {
934 e_backlight_mode_off = 0,
935 e_backlight_mode_keys = 1,
936 e_backlight_mode_sticks = 2,
937 e_backlight_mode_all = e_backlight_mode_keys+e_backlight_mode_sticks,
938 e_backlight_mode_on
941 enum Functions {
942 // first the functions which need a checkbox
943 FUNC_OVERRIDE_CHANNEL,
944 FUNC_TRAINER,
945 FUNC_INSTANT_TRIM,
946 FUNC_RESET,
947 #if defined(CPUARM)
948 FUNC_SET_TIMER,
949 #endif
950 FUNC_ADJUST_GVAR,
951 #if defined(CPUARM)
952 FUNC_VOLUME,
953 FUNC_SET_FAILSAFE,
954 FUNC_RANGECHECK,
955 FUNC_BIND,
956 #endif
957 // then the other functions
958 FUNC_FIRST_WITHOUT_ENABLE,
959 FUNC_PLAY_SOUND = FUNC_FIRST_WITHOUT_ENABLE,
960 FUNC_PLAY_TRACK,
961 #if !defined(CPUARM)
962 FUNC_PLAY_BOTH,
963 #endif
964 FUNC_PLAY_VALUE,
965 #if defined(CPUARM)
966 FUNC_RESERVE4,
967 FUNC_PLAY_SCRIPT,
968 FUNC_RESERVE5,
969 FUNC_BACKGND_MUSIC,
970 FUNC_BACKGND_MUSIC_PAUSE,
971 #endif
972 FUNC_VARIO,
973 FUNC_HAPTIC,
974 #if !defined(PCBSTD)
975 FUNC_LOGS,
976 #endif
977 FUNC_BACKLIGHT,
978 #if defined(PCBTARANIS)
979 FUNC_SCREENSHOT,
980 #endif
981 #if defined(DEBUG)
982 FUNC_TEST, // should remain the last before MAX as not added in companion9x
983 #endif
984 FUNC_MAX
987 enum TimerModes {
988 TMRMODE_NONE,
989 TMRMODE_ABS,
990 TMRMODE_THR,
991 TMRMODE_THR_REL,
992 TMRMODE_THR_TRG,
993 TMRMODE_COUNT
996 enum CountDownModes {
997 COUNTDOWN_SILENT,
998 COUNTDOWN_BEEPS,
999 COUNTDOWN_VOICE,
1000 #if defined(CPUARM) && defined(HAPTIC)
1001 COUNTDOWN_HAPTIC,
1002 #endif
1003 COUNTDOWN_COUNT
1006 enum ResetFunctionParam {
1007 FUNC_RESET_TIMER1,
1008 FUNC_RESET_TIMER2,
1009 #if defined(CPUARM)
1010 FUNC_RESET_TIMER3,
1011 #endif
1012 FUNC_RESET_FLIGHT,
1013 #if defined(TELEMETRY_FRSKY)
1014 FUNC_RESET_TELEMETRY,
1015 #endif
1016 #if ROTARY_ENCODERS > 0
1017 FUNC_RESET_ROTENC1,
1018 #endif
1019 #if ROTARY_ENCODERS > 1
1020 FUNC_RESET_ROTENC2,
1021 #endif
1022 #if defined(CPUARM)
1023 FUNC_RESET_PARAM_FIRST_TELEM,
1024 FUNC_RESET_PARAM_LAST_TELEM = FUNC_RESET_PARAM_FIRST_TELEM + MAX_TELEMETRY_SENSORS,
1025 #endif
1026 FUNC_RESET_PARAMS_COUNT,
1027 FUNC_RESET_PARAM_LAST = FUNC_RESET_PARAMS_COUNT-1,
1030 enum AdjustGvarFunctionParam {
1031 FUNC_ADJUST_GVAR_CONSTANT,
1032 FUNC_ADJUST_GVAR_SOURCE,
1033 FUNC_ADJUST_GVAR_GVAR,
1034 FUNC_ADJUST_GVAR_INCDEC,
1037 #endif // _DATACONSTANTS_H_