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.
23 #include "radiodata.h" // for RadioData::getElementName
24 #include "radiodataconversionstate.h"
30 void ExpoData::convert(RadioDataConversionState
& cstate
)
32 cstate
.setComponent(tr("INP"), 3);
33 cstate
.setSubComp(RawSource(SOURCE_TYPE_VIRTUAL_INPUT
, chn
).toString(cstate
.fromModel(), cstate
.fromGS(), cstate
.fromType
) % tr(" (@%1)").arg(cstate
.subCompIdx
));
34 srcRaw
.convert(cstate
);
35 swtch
.convert(cstate
);
43 void MixData::convert(RadioDataConversionState
& cstate
)
45 cstate
.setComponent(tr("MIX"), 4);
46 cstate
.setSubComp(RawSource(SOURCE_TYPE_CH
, destCh
-1).toString(cstate
.fromModel(), cstate
.fromGS(), cstate
.fromType
) % tr(" (@%1)").arg(cstate
.subCompIdx
));
47 srcRaw
.convert(cstate
);
48 swtch
.convert(cstate
);
56 QString
LimitData::minToString() const
58 return QString::number((qreal
)min
/10);
61 QString
LimitData::maxToString() const
63 return QString::number((qreal
)max
/10);
66 QString
LimitData::revertToString() const
68 return revert
? tr("INV") : tr("NOR");
71 QString
LimitData::nameToString(int index
) const
73 return RadioData::getElementName(tr("CH"), index
+ 1, name
);
76 QString
LimitData::offsetToString() const
78 return QString::number((qreal
)offset
/10, 'f', 1);
81 void LimitData::clear()
83 memset(this, 0, sizeof(LimitData
));
93 CurveData::CurveData()
98 void CurveData::clear(int count
)
100 memset(this, 0, sizeof(CurveData
));
104 bool CurveData::isEmpty() const
106 for (int i
=0; i
<count
; i
++) {
107 if (points
[i
].y
!= 0) {
114 QString
CurveData::nameToString(const int idx
) const
116 return RadioData::getElementName(tr("CV"), idx
+ 1, name
);
124 void FlightModeData::clear(const int phase
)
126 memset(this, 0, sizeof(FlightModeData
));
128 for (int idx
=0; idx
<CPN_MAX_GVARS
; idx
++) {
131 for (int idx
=0; idx
<CPN_MAX_ENCODERS
; idx
++) {
132 rotaryEncoders
[idx
] = 1025;
137 QString
FlightModeData::nameToString(int index
) const
139 return RadioData::getElementName(tr("FM"), index
, name
); // names are zero-based, FM0, FM1, etc
142 void FlightModeData::convert(RadioDataConversionState
& cstate
)
144 cstate
.setComponent("FMD", 2);
145 cstate
.setSubComp(nameToString(cstate
.subCompIdx
));
146 swtch
.convert(cstate
);