Update CREDITS.txt
[opentx.git] / companion / src / firmwares / io_data.h
blobe2321f63775e934dfc95174794e11f8a46a3f166
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 IO_DATA_H
22 #define IO_DATA_H
24 #include "constants.h"
25 #include "curvereference.h"
26 #include "rawsource.h"
27 #include "rawswitch.h"
29 #include <QtCore>
31 class RadioDataConversionState;
33 enum InputMode {
34 INPUT_MODE_NONE,
35 INPUT_MODE_POS,
36 INPUT_MODE_NEG,
37 INPUT_MODE_BOTH
40 class ExpoData {
41 Q_DECLARE_TR_FUNCTIONS(ExpoData)
43 public:
44 ExpoData() { clear(); }
45 RawSource srcRaw;
46 unsigned int scale;
47 unsigned int mode; // InputMode
48 unsigned int chn;
49 RawSwitch swtch;
50 unsigned int flightModes; // -5=!FP4, 0=normal, 5=FP4
51 int weight;
52 int offset;
53 CurveReference curve;
54 int carryTrim;
55 char name[10+1];
56 void clear() { memset(this, 0, sizeof(ExpoData)); }
57 void convert(RadioDataConversionState & cstate);
60 enum MltpxValue {
61 MLTPX_ADD=0,
62 MLTPX_MUL=1,
63 MLTPX_REP=2
66 #define MIXDATA_NAME_LEN 10
68 class MixData {
69 Q_DECLARE_TR_FUNCTIONS(MixData)
71 public:
72 MixData() { clear(); }
73 void convert(RadioDataConversionState & cstate);
75 unsigned int destCh; // 1..CPN_MAX_CHNOUT
76 RawSource srcRaw;
77 int weight;
78 RawSwitch swtch;
79 CurveReference curve; //0=symmetrisch
80 unsigned int delayUp;
81 unsigned int delayDown;
82 unsigned int speedUp; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
83 unsigned int speedDown; // 0 nichts
84 int carryTrim;
85 bool noExpo;
86 MltpxValue mltpx; // multiplex method 0=+ 1=* 2=replace
87 unsigned int mixWarn; // mixer warning
88 unsigned int flightModes; // -5=!FP4, 0=normal, 5=FP4
89 int sOffset;
90 char name[MIXDATA_NAME_LEN+1];
92 void clear() { memset(this, 0, sizeof(MixData)); }
95 class LimitData {
96 Q_DECLARE_TR_FUNCTIONS(LimitData)
98 public:
99 LimitData() { clear(); }
100 int min;
101 int max;
102 bool revert;
103 int offset;
104 int ppmCenter;
105 bool symetrical;
106 char name[6+1];
107 CurveReference curve;
108 QString minToString() const;
109 QString maxToString() const;
110 QString offsetToString() const;
111 QString revertToString() const;
112 QString nameToString(int index) const;
113 void clear();
116 class CurvePoint {
117 public:
118 int8_t x;
119 int8_t y;
122 class CurveData {
123 Q_DECLARE_TR_FUNCTIONS(CurveData)
125 public:
126 enum CurveType {
127 CURVE_TYPE_STANDARD,
128 CURVE_TYPE_CUSTOM,
129 CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM
132 CurveData();
133 void clear(int count);
134 bool isEmpty() const;
135 QString nameToString(const int idx) const;
137 CurveType type;
138 bool smooth;
139 int count;
140 CurvePoint points[CPN_MAX_POINTS];
141 char name[6+1];
144 class FlightModeData {
145 Q_DECLARE_TR_FUNCTIONS(FlightModeData)
147 public:
148 FlightModeData() { clear(0); }
149 int trimMode[CPN_MAX_TRIMS];
150 int trimRef[CPN_MAX_TRIMS];
151 int trim[CPN_MAX_TRIMS];
152 RawSwitch swtch;
153 char name[10+1];
154 unsigned int fadeIn;
155 unsigned int fadeOut;
156 int rotaryEncoders[CPN_MAX_ENCODERS];
157 int gvars[CPN_MAX_GVARS];
158 void clear(const int phase);
159 QString nameToString(int index) const;
160 void convert(RadioDataConversionState & cstate);
163 class SwashRingData {
164 Q_DECLARE_TR_FUNCTIONS(SwashRingData)
166 public:
167 SwashRingData() { clear(); }
168 int elevatorWeight;
169 int aileronWeight;
170 int collectiveWeight;
171 unsigned int type;
172 RawSource collectiveSource;
173 RawSource aileronSource;
174 RawSource elevatorSource;
175 unsigned int value;
176 void clear() { memset(this, 0, sizeof(SwashRingData)); }
179 #endif // IO_DATA_H