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.
26 constexpr int CPN_MAX_SENSORS
= 60;
31 Q_DECLARE_TR_FUNCTIONS(SensorData
)
44 TELEM_FORMULA_AVERAGE
,
47 TELEM_FORMULA_MULTIPLY
,
48 TELEM_FORMULA_TOTALIZE
,
50 TELEM_FORMULA_CONSUMPTION
,
52 TELEM_FORMULA_LAST
= TELEM_FORMULA_DIST
56 TELEM_CELL_INDEX_LOWEST
,
63 TELEM_CELL_INDEX_HIGHEST
,
64 TELEM_CELL_INDEX_DELTA
,
74 UNIT_METERS_PER_SECOND
,
96 // FrSky format used for these fields, could be another format in the future
98 UNIT_CELLS
= UNIT_FIRST_VIRTUAL
,
103 UNIT_GPS_LONGITUDE_EW
,
104 UNIT_GPS_LATITUDE_NS
,
106 UNIT_DATETIME_DAY_MONTH
,
107 UNIT_DATETIME_HOUR_MIN
,
111 SensorData() { clear(); }
112 unsigned int type
; // custom / formula
115 unsigned int instance
;
117 unsigned int moduleIdx
;
118 unsigned int persistentValue
;
119 unsigned int formula
;
129 // for custom sensors
147 bool isAvailable() const { return strlen(label
) > 0; }
149 QString
unitString() const;
150 QString
nameToString(int index
) const;
151 QString
getOrigin(const ModelData
* model
) const;
152 void clear() { memset(this, 0, sizeof(SensorData
)); }
155 #endif // SENSORDATA_H