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