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