Update CREDITS.txt
[opentx.git] / companion / src / firmwares / generalsettings.h
blobcf0fd550cef52365e7adb89d817aba68c6294495
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 GENERALSETTINGS_H
22 #define GENERALSETTINGS_H
24 #include "boards.h"
25 #include "constants.h"
26 #include "customfunctiondata.h"
27 #include "rawsource.h"
29 #include <QtCore>
31 class Firmware;
32 class ModelData;
33 class GeneralSettings;
34 class RadioDataConversionState;
36 enum UartModes {
37 UART_MODE_NONE,
38 UART_MODE_TELEMETRY_MIRROR,
39 UART_MODE_TELEMETRY,
40 UART_MODE_SBUS_TRAINER,
41 UART_MODE_DEBUG
44 class TrainerMix {
45 public:
46 TrainerMix() { clear(); }
47 unsigned int src; // 0-7 = ch1-8
48 RawSwitch swtch;
49 int weight;
50 unsigned int mode; // off, add-mode, subst-mode
51 void clear() { memset(this, 0, sizeof(TrainerMix)); }
54 class TrainerData {
55 public:
56 TrainerData() { clear(); }
57 int calib[4];
58 TrainerMix mix[4];
59 void clear() { memset(this, 0, sizeof(TrainerData)); }
62 class GeneralSettings {
63 Q_DECLARE_TR_FUNCTIONS(GeneralSettings)
65 public:
67 enum BeeperMode {
68 BEEPER_QUIET = -2,
69 BEEPER_ALARMS_ONLY = -1,
70 BEEPER_NOKEYS = 0,
71 BEEPER_ALL = 1
74 GeneralSettings();
75 void convert(RadioDataConversionState & cstate);
77 void setDefaultControlTypes(Board::Type board);
78 int getDefaultStick(unsigned int channel) const;
79 RawSource getDefaultSource(unsigned int channel) const;
80 int getDefaultChannel(unsigned int stick) const;
82 unsigned int version;
83 unsigned int variant;
84 int calibMid[CPN_MAX_ANALOGS];
85 int calibSpanNeg[CPN_MAX_ANALOGS];
86 int calibSpanPos[CPN_MAX_ANALOGS];
87 unsigned int currModelIndex;
88 char currModelFilename[16+1];
89 unsigned int contrast;
90 unsigned int vBatWarn;
91 int txVoltageCalibration;
92 int txCurrentCalibration;
93 int vBatMin;
94 int vBatMax;
95 int backlightMode;
96 TrainerData trainer;
97 unsigned int view; // main screen view // TODO enum
98 bool disableThrottleWarning;
99 bool fai;
100 bool disableMemoryWarning;
101 BeeperMode beeperMode;
102 bool disableAlarmWarning;
103 bool disableRssiPoweroffAlarm;
104 unsigned int usbMode;
105 BeeperMode hapticMode;
106 unsigned int stickMode; // TODO enum
107 int timezone;
108 bool adjustRTC;
109 bool optrexDisplay;
110 unsigned int inactivityTimer;
111 bool minuteBeep;
112 bool preBeep;
113 bool flashBeep;
114 unsigned int splashMode;
115 int splashDuration;
116 unsigned int backlightDelay;
117 unsigned int templateSetup; //RETA order according to chout_ar array
118 int PPM_Multiplier;
119 int hapticLength;
120 unsigned int reNavigation;
121 unsigned int stickReverse;
122 unsigned int speakerPitch;
123 int hapticStrength;
124 unsigned int speakerMode;
125 char ownerName[10+1];
126 int beeperLength;
127 unsigned int gpsFormat;
128 int speakerVolume;
129 unsigned int backlightBright;
130 unsigned int backlightOffBright;
131 int switchesDelay;
132 int temperatureCalib;
133 int temperatureWarn;
134 unsigned int mAhWarn;
135 unsigned int mAhUsed;
136 unsigned int globalTimer;
137 bool bluetoothEnable;
138 char bluetoothName[10+1];
139 unsigned int bluetoothBaudrate;
140 unsigned int bluetoothMode;
141 unsigned int sticksGain;
142 unsigned int rotarySteps;
143 unsigned int countryCode;
144 bool jitterFilter;
145 unsigned int imperial;
146 char ttsLanguage[2+1];
147 int beepVolume;
148 int wavVolume;
149 int varioVolume;
150 int varioPitch;
151 int varioRange;
152 int varioRepeat;
153 int backgroundVolume;
154 unsigned int mavbaud;
155 unsigned int switchUnlockStates;
156 unsigned int hw_uartMode; // UartModes
157 unsigned int backlightColor;
158 CustomFunctionData customFn[CPN_MAX_SPECIAL_FUNCTIONS];
159 char switchName[CPN_MAX_SWITCHES][3+1];
160 unsigned int switchConfig[CPN_MAX_SWITCHES];
161 char stickName[CPN_MAX_STICKS][3+1];
162 char potName[CPN_MAX_KNOBS][3+1];
163 unsigned int potConfig[CPN_MAX_KNOBS];
164 char sliderName[CPN_MAX_SLIDERS][3+1];
165 unsigned int sliderConfig[CPN_MAX_SLIDERS];
167 char themeName[8+1];
168 typedef uint8_t ThemeOptionData[8+1];
169 ThemeOptionData themeOptionValue[5];
171 bool switchPositionAllowedTaranis(int index) const;
172 bool switchSourceAllowedTaranis(int index) const;
173 bool isPotAvailable(int index) const;
174 bool isSliderAvailable(int index) const;
178 #endif // GENERALSETTINGS_H