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 #include "sensordata.h"
23 #include "radiodata.h"
24 #include "modeldata.h"
26 void SensorData::updateUnit()
28 if (type
== TELEM_TYPE_CALCULATED
) {
29 if (formula
== TELEM_FORMULA_CONSUMPTION
)
34 QString
SensorData::unitString() const
45 case UNIT_METERS_PER_SECOND
:
90 QString
SensorData::nameToString(int index
) const
92 return RadioData::getElementName(tr("TELE"), index
+ 1, label
);
95 QString
SensorData::getOrigin(const ModelData
* model
) const
97 if (type
!= TELEM_TYPE_CUSTOM
|| !id
)
100 const ModuleData
& module
= model
->moduleData
[moduleIdx
];
101 if (module
.isPxx2Module() && rxIdx
<= 2 && module
.access
.receivers
& (1 << rxIdx
)) {
102 return QString(module
.access
.receiverName
[rxIdx
]);