display receiver or module name for each sensor (if available)

This commit is contained in:
Raphael Coeffic
2019-08-22 06:21:31 +02:00
parent b3c6301e5a
commit 4c12aac16c
3 changed files with 45 additions and 24 deletions
+23
View File
@@ -21,6 +21,7 @@
#include "sensordata.h"
#include "radiodata.h"
#include "modeldata.h"
void SensorData::updateUnit()
{
@@ -90,3 +91,25 @@ QString SensorData::nameToString(int index) const
{
return RadioData::getElementName(tr("TELE"), index + 1, label);
}
QString SensorData::getRxOrModName(const ModelData* model) const
{
if ((type != TELEM_TYPE_CUSTOM) || (!id && !instance))
return QString();
const ModuleData& module = model->moduleData[moduleIdx];
if (module.isPxx2Module()) {
if (module.access.receivers & (1 << rxIdx)) {
return QString(module.access.receiverName[rxIdx]);
}
// receiver does not seem to be active
return QString();
}
if (moduleIdx)
return tr("Internal");
return tr("External");
}