diff --git a/companion/src/firmwares/rawsource.cpp b/companion/src/firmwares/rawsource.cpp
index 67ad743b6..898c0ca4a 100644
--- a/companion/src/firmwares/rawsource.cpp
+++ b/companion/src/firmwares/rawsource.cpp
@@ -60,7 +60,7 @@ RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSetting
result.min = -30000 * result.step;
result.max = +30000 * result.step;
result.decimals = sensor.prec;
- result.unit = sensor.unitString();
+ result.unit = SensorData::unitToString(qr.quot);
break;
}
diff --git a/companion/src/firmwares/sensordata.cpp b/companion/src/firmwares/sensordata.cpp
index 753d2eed0..152e51a81 100644
--- a/companion/src/firmwares/sensordata.cpp
+++ b/companion/src/firmwares/sensordata.cpp
@@ -33,10 +33,206 @@ void SensorData::updateUnit()
}
}
-// TODO depreciated
-QString SensorData::unitString() const
+QString SensorData::nameToString(int index) const
{
- return unitToString(unit);
+ return RadioData::getElementName(tr("TELE"), index + 1, label);
+}
+
+QString SensorData::getOrigin(const ModelData * model) const
+{
+ if (type != TELEM_TYPE_CUSTOM || !id)
+ return QString();
+
+ const ModuleData & module = model->moduleData[moduleIdx];
+ if (module.isPxx2Module() && rxIdx <= 2 && module.access.receivers & (1 << rxIdx)) {
+ return QString(module.access.receiverName[rxIdx]);
+ }
+ else {
+ return QString();
+ }
+}
+
+bool SensorData::isEmpty() const
+{
+ return (!isAvailable() && type == 0 && id == 0 && subid == 0 && instance == 0 && rxIdx == 0 && moduleIdx == 0 && unit == 0 && ratio == 0 && prec == 0 && offset == 0 && autoOffset == 0 && filter == 0 && onlyPositive == 0 && logs == 0);
+}
+
+constexpr int SENSOR_ISCONFIGURABLE { 1 << 1 };
+constexpr int SENSOR_PRINT_GPS { 1 << 2 };
+constexpr int SENSOR_PRINT_CELLS { 1 << 3 };
+constexpr int SENSOR_PRINT_CONSUMPTION { 1 << 4 };
+constexpr int SENSOR_PRINT_RATIO { 1 << 5 };
+constexpr int SENSOR_PRINT_TOTALIZE { 1 << 6 };
+constexpr int SENSOR_PRINT_SOURCES_12 { 1 << 7 };
+constexpr int SENSOR_PRINT_SOURCES_34 { 1 << 8 };
+constexpr char FMT_LABEL[] { "%1: " };
+constexpr char FMT_VALUE[] { "%1 " };
+constexpr char FMT_LABEL_VALUE[] { "%1: %2 " };
+
+QString SensorData::paramsToString(const ModelData * model) const
+{
+ if (!isAvailable())
+ return "";
+
+ QString str;
+ int mask = 0;
+
+ if (type == TELEM_TYPE_CALCULATED) {
+ if (formula < TELEM_FORMULA_CELL)
+ mask |= SENSOR_ISCONFIGURABLE;
+ if (formula == TELEM_FORMULA_DIST)
+ mask |= SENSOR_PRINT_GPS;
+ if (formula == TELEM_FORMULA_CELL)
+ mask |= SENSOR_PRINT_CELLS;
+ if (formula == TELEM_FORMULA_CONSUMPTION)
+ mask |= SENSOR_PRINT_CONSUMPTION;
+ if (formula <= TELEM_FORMULA_MULTIPLY)
+ mask |= SENSOR_PRINT_SOURCES_12;
+ if (formula < TELEM_FORMULA_MULTIPLY)
+ mask |= SENSOR_PRINT_SOURCES_34;
+ if (formula == TELEM_FORMULA_TOTALIZE)
+ mask |= SENSOR_PRINT_TOTALIZE;
+
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Formula")).arg(formulaToString(formula)));
+ }
+ else {
+ if (unit < UNIT_FIRST_VIRTUAL)
+ mask |= (SENSOR_ISCONFIGURABLE | SENSOR_PRINT_RATIO);
+
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Id")).arg(QString::number(id, 16).toUpper()));
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Instance")).arg(instance));
+ }
+
+ if (mask & SENSOR_PRINT_CELLS) {
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Sensor")).arg(sourceToString(model, source)));
+ str.append(QString(FMT_VALUE).arg(cellIndexToString(index)));
+ }
+
+ if (mask & SENSOR_PRINT_SOURCES_12) {
+ str.append(QString(FMT_LABEL).arg(tr("Sources")));
+ for (int i = 0; i < 4; i++) {
+ if (i < 2 || mask & SENSOR_PRINT_SOURCES_34) {
+ str.append(QString(FMT_VALUE).arg(sourceToString(model, sources[i])));
+ }
+ }
+ }
+
+ if (mask & SENSOR_PRINT_CONSUMPTION || mask & SENSOR_PRINT_TOTALIZE)
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Sensor")).arg(sourceToString(model, amps)));
+
+ if (mask & SENSOR_PRINT_GPS) {
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("GPS")).arg(sourceToString(model, gps)));
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Alt")).arg(sourceToString(model, alt)));
+ }
+
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Unit")).arg(unitToString(unit)));
+
+ if (mask & SENSOR_ISCONFIGURABLE && unit != UNIT_FAHRENHEIT)
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Precision")).arg(precToString(prec)));
+
+ if (mask & SENSOR_PRINT_RATIO) {
+ if (unit != UNIT_RPMS) {
+ int precsn = prec == 0 ? 1 : pow(10, prec);
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Ratio")).arg((float)ratio / 10));
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Offset")).arg(QString::number((float)offset / precsn, 'f', prec)));
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Auto Offset")).arg(boolToString(autoOffset)));
+ }
+ else {
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Blades")).arg(ratio)); // TODO refactor to dedicated RPMS field
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Multi")).arg(offset)); // TODO refactor to dedicated RPMS field
+ }
+ }
+
+ if (mask & SENSOR_ISCONFIGURABLE)
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Filter")).arg(boolToString(filter)));
+
+ if (type == TELEM_TYPE_CALCULATED)
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Persist")).arg(boolToString(persistent)));
+
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Positive")).arg(boolToString(onlyPositive)));
+ str.append(QString(FMT_LABEL_VALUE).arg(tr("Log")).arg(boolToString(logs)));
+
+ return str;
+}
+
+// static
+QString SensorData::typeToString(const int value)
+{
+ switch(value) {
+ case TELEM_TYPE_CUSTOM:
+ return tr("Custom");
+ case TELEM_TYPE_CALCULATED:
+ return tr("Calculated");
+ default:
+ return CPN_STR_UNKNOWN_ITEM;
+ }
+}
+
+// static
+QString SensorData::formulaToString(const int value)
+{
+ switch(value) {
+ case TELEM_FORMULA_ADD:
+ return tr("Add");
+ case TELEM_FORMULA_AVERAGE:
+ return tr("Average");
+ case TELEM_FORMULA_MIN:
+ return tr("Minimum");
+ case TELEM_FORMULA_MAX:
+ return tr("Maximum");
+ case TELEM_FORMULA_MULTIPLY:
+ return tr("Multiply");
+ case TELEM_FORMULA_TOTALIZE:
+ return tr("Totalize");
+ case TELEM_FORMULA_CELL:
+ return tr("Cell");
+ case TELEM_FORMULA_CONSUMPTION:
+ return tr("Consumption");
+ case TELEM_FORMULA_DIST:
+ return tr("Distance");
+ default:
+ return CPN_STR_UNKNOWN_ITEM;
+ }
+}
+
+// static
+QString SensorData::cellIndexToString(const int value)
+{
+ if (value == TELEM_CELL_INDEX_LOWEST)
+ return tr("Lowest");
+ if (value > TELEM_CELL_INDEX_LOWEST && value < TELEM_CELL_INDEX_HIGHEST)
+ return tr("Cell %1").arg(value - TELEM_CELL_INDEX_LOWEST);
+ if (value== TELEM_CELL_INDEX_HIGHEST)
+ return tr("Highest");
+ if (value == TELEM_CELL_INDEX_DELTA)
+ return tr("Delta");
+ return CPN_STR_UNKNOWN_ITEM;
+}
+
+// static
+QString SensorData::precToString(const int value)
+{
+ return QString("0.%1").arg(QString(value, '0'));
+}
+
+// static
+QString SensorData::sourceToString(const ModelData * model, const int index, const bool sign)
+{
+ if (model) {
+ const QString prfx = sign ? index < 0 ? "-" : "+" : "";
+
+ if (abs(index) > 0) {
+ const SensorData &sd = model->sensorData[abs(index) - 1];
+ if (sd.type == SensorData::TELEM_TYPE_CUSTOM)
+ return QString("%1%2 (%3)").arg(prfx).arg(sd.label).arg(sd.getOrigin(model));
+ else
+ return QString("%1%2").arg(prfx).arg(sd.label);
+ }
+ else
+ return CPN_STR_NONE_ITEM;
+ }
+
+ return "";
}
// static
@@ -106,110 +302,6 @@ QString SensorData::unitToString(const int value)
}
}
-QString SensorData::nameToString(int index) const
-{
- return RadioData::getElementName(tr("TELE"), index + 1, label);
-}
-
-QString SensorData::getOrigin(const ModelData * model) const
-{
- if (type != TELEM_TYPE_CUSTOM || !id)
- return QString();
-
- const ModuleData & module = model->moduleData[moduleIdx];
- if (module.isPxx2Module() && rxIdx <= 2 && module.access.receivers & (1 << rxIdx)) {
- return QString(module.access.receiverName[rxIdx]);
- }
- else {
- return QString();
- }
-}
-
-bool SensorData::isEmpty() const
-{
- return (!isAvailable() && type == 0 && id == 0 && subid == 0 && instance == 0 && rxIdx == 0 && moduleIdx == 0 && unit == 0 && ratio == 0 && prec == 0 && offset == 0 && autoOffset == 0 && filter == 0 && onlyPositive == 0 && logs == 0);
-}
-
-// static
-QString SensorData::typeToString(const int value)
-{
- switch(value) {
- case TELEM_TYPE_CUSTOM:
- return tr("Custom");
- case TELEM_TYPE_CALCULATED:
- return tr("Calculated");
- default:
- return CPN_STR_UNKNOWN_ITEM;
- }
-}
-
-// static
-QString SensorData::formulaToString(const int value)
-{
- switch(value) {
- case TELEM_FORMULA_ADD:
- return tr("Add");
- case TELEM_FORMULA_AVERAGE:
- return tr("Average");
- case TELEM_FORMULA_MIN:
- return tr("Minimum");
- case TELEM_FORMULA_MAX:
- return tr("Maximum");
- case TELEM_FORMULA_MULTIPLY:
- return tr("Multiply");
- case TELEM_FORMULA_TOTALIZE:
- return tr("Totalize");
- case TELEM_FORMULA_CELL:
- return tr("Cell");
- case TELEM_FORMULA_CONSUMPTION:
- return tr("Consumption");
- case TELEM_FORMULA_DIST:
- return tr("Distance");
- default:
- return CPN_STR_UNKNOWN_ITEM;
- }
-}
-
-// static
-QString SensorData::cellIndexToString(const int value)
-{
- if (value == TELEM_CELL_INDEX_LOWEST)
- return tr("Lowest");
- if (value > TELEM_CELL_INDEX_LOWEST && value < TELEM_CELL_INDEX_HIGHEST)
- return tr("Cell %1").arg(value - TELEM_CELL_INDEX_LOWEST);
- if (value== TELEM_CELL_INDEX_HIGHEST)
- return tr("Highest");
- if (value == TELEM_CELL_INDEX_DELTA)
- return tr("Delta");
- return CPN_STR_UNKNOWN_ITEM;
-}
-
-// static
-QString SensorData::precisionToString(const int value)
-{
- return QString("0.%1").arg(QString(value, '0'));
-}
-
-// static
-QString SensorData::sourceToString(const ModelData * model, const int index, const bool sign)
-{
- if (model) {
- const QString prfx = sign ? index < 0 ? "-" : "+" : "";
-
- if (abs(index) > 0) {
- const SensorData &sd = model->sensorData[abs(index) - 1];
- if (sd.type == SensorData::TELEM_TYPE_CUSTOM)
- return QString("%1%2 (%3)").arg(prfx).arg(sd.label).arg(sd.getOrigin(model));
- else
- return QString("%1%2").arg(prfx).arg(sd.label);
- }
- else
- return CPN_STR_NONE_ITEM;
- }
-
- return "";
-}
-
// static
bool SensorData::isSourceAvailable(const ModelData * model, const int index)
{
diff --git a/companion/src/firmwares/sensordata.h b/companion/src/firmwares/sensordata.h
index afd9d7891..23d8a7fcc 100644
--- a/companion/src/firmwares/sensordata.h
+++ b/companion/src/firmwares/sensordata.h
@@ -167,11 +167,11 @@ class SensorData {
bool isAvailable() const { return strlen(label) > 0; }
void updateUnit();
- QString unitString() const;
QString nameToString(int index) const;
QString getOrigin(const ModelData* model) const;
void clear() { memset(this, 0, sizeof(SensorData)); }
bool isEmpty() const;
+ QString paramsToString(const ModelData * model) const;
static QString sourceToString(const ModelData * model, const int index, const bool sign = false);
static bool isSourceAvailable(const ModelData * model, const int index);
@@ -179,7 +179,8 @@ class SensorData {
static QString formulaToString(const int value);
static QString cellIndexToString(const int value);
static QString unitToString(const int value);
- static QString precisionToString(const int value);
+ static QString precToString(const int value);
+ static QString boolToString(const bool value) { return value ? tr("Y") : tr("N"); }
static AbstractStaticItemModel * typeItemModel();
static AbstractStaticItemModel * formulaItemModel();
diff --git a/companion/src/modelprinter.cpp b/companion/src/modelprinter.cpp
index 61bfedda9..282f53550 100644
--- a/companion/src/modelprinter.cpp
+++ b/companion/src/modelprinter.cpp
@@ -1071,17 +1071,6 @@ QString ModelPrinter::printRssiAlarmsDisabled(bool mb)
return printBoolean(!mb, BOOLEAN_ENABLEDISABLE);
}
-QString ModelPrinter::printTelemetrySource(int val)
-{
- QStringList strings = QStringList() << tr("None");
-
- for (unsigned i=1; i<=CPN_MAX_SENSORS; ++i) {
- strings << QString("%1").arg(model.sensorData[i-1].label);
- }
-
- return QString("%1%2").arg((val < 0 ? "-" : "")).arg(strings.value(abs(val)));
-}
-
QString ModelPrinter::printVarioSource(unsigned int val)
{
switch (val) {
@@ -1155,144 +1144,6 @@ QString ModelPrinter::printIgnoreSensorIds(bool mb)
return printBoolean(mb, BOOLEAN_ENABLEDISABLE);
}
-QString ModelPrinter::printSensorType(unsigned int val)
-{
- switch (val) {
- case SensorData::TELEM_TYPE_CUSTOM:
- return tr("Custom");
- case SensorData::TELEM_TYPE_CALCULATED:
- return tr("Calculated");
- default:
- return CPN_STR_UNKNOWN_ITEM;
- }
-}
-
-QString ModelPrinter::printSensorFormula(unsigned int val)
-{
- switch (val) {
- case SensorData::TELEM_FORMULA_ADD:
- return tr("Add");
- case SensorData::TELEM_FORMULA_AVERAGE:
- return tr("Average");
- case SensorData::TELEM_FORMULA_MIN:
- return tr("Min");
- case SensorData::TELEM_FORMULA_MAX:
- return tr("Max");
- case SensorData::TELEM_FORMULA_MULTIPLY:
- return tr("Multiply");
- case SensorData::TELEM_FORMULA_TOTALIZE:
- return tr("Totalise");
- case SensorData::TELEM_FORMULA_CELL:
- return tr("Cell");
- case SensorData::TELEM_FORMULA_CONSUMPTION:
- return tr("Consumption");
- case SensorData::TELEM_FORMULA_DIST:
- return tr("Distance");
- default:
- return CPN_STR_UNKNOWN_ITEM;
- }
-}
-
-QString ModelPrinter::printSensorCells(unsigned int val)
-{
- QStringList strings;
-
- strings << tr("Lowest");
- for (int i=1; i<=6; i++)
- strings << tr("Cell %1").arg(i);
- strings << tr("Highest") << tr("Delta");
-
- return strings.value(val);
-}
-
-QString ModelPrinter::printSensorTypeCond(unsigned int idx)
-{
- if (!model.sensorData[idx].isAvailable())
- return "";
- else
- return printSensorType(model.sensorData[idx].type);
-}
-
-QString ModelPrinter::printSensorParams(unsigned int idx)
-{
- QString str = "";
- SensorData sensor = model.sensorData[idx];
-
- if (!sensor.isAvailable())
- return str;
-
- bool isConfigurable = false;
- bool gpsFieldsPrinted = false;
- bool cellsFieldsPrinted = false;
- bool consFieldsPrinted = false;
- bool ratioFieldsPrinted = false;
- bool totalizeFieldsPrinted = false;
- bool sources12FieldsPrinted = false;
- bool sources34FieldsPrinted = false;
-
- if (sensor.type == SensorData::TELEM_TYPE_CALCULATED) {
- isConfigurable = (sensor.formula < SensorData::TELEM_FORMULA_CELL);
- gpsFieldsPrinted = (sensor.formula == SensorData::TELEM_FORMULA_DIST);
- cellsFieldsPrinted = (sensor.formula == SensorData::TELEM_FORMULA_CELL);
- consFieldsPrinted = (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION);
- sources12FieldsPrinted = (sensor.formula <= SensorData::TELEM_FORMULA_MULTIPLY);
- sources34FieldsPrinted = (sensor.formula < SensorData::TELEM_FORMULA_MULTIPLY);
- totalizeFieldsPrinted = (sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE);
-
- str.append(printLabelValue(tr("F"), printSensorFormula(sensor.formula)));
- }
- else {
- isConfigurable = sensor.unit < SensorData::UNIT_FIRST_VIRTUAL;
- ratioFieldsPrinted = (sensor.unit < SensorData::UNIT_FIRST_VIRTUAL);
-
- str.append(printLabelValue(tr("Id"), QString::number(sensor.id,16).toUpper()));
- str.append(printLabelValue(tr("Inst"), QString::number(sensor.instance)));
- }
- if (cellsFieldsPrinted) {
- str.append(printLabelValue(tr("Sensor"), QString("%1 %2").arg(printTelemetrySource(sensor.source), false).arg(printSensorCells(sensor.index))));
- }
- if (sources12FieldsPrinted) {
- QStringList srcs;
- for (int i=0;i<4;i++) {
- if (i < 2 || sources34FieldsPrinted) {
- srcs << printTelemetrySource(sensor.sources[i]);
- }
- }
- str.append(printLabelValues(tr("Sources"), srcs));
- }
- if (consFieldsPrinted || totalizeFieldsPrinted)
- str.append(printLabelValue(tr("Sensor"), printTelemetrySource(sensor.amps)));
- if (gpsFieldsPrinted) {
- str.append(printLabelValue(tr("GPS"), printTelemetrySource(sensor.gps)));
- str.append(printLabelValue(tr("Alt"), printTelemetrySource(sensor.alt)));
- }
- QString u = sensor.unitString();
- u = u.trimmed() == "" ? "-" : u;
- str.append(printLabelValue(tr("Unit"), u));
- if (isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT)
- str.append(printLabelValue(tr("Prec"), printTelemetryPrecision(sensor.prec)));
- if (ratioFieldsPrinted) {
- if (sensor.unit != SensorData::UNIT_RPMS) {
- int prec = sensor.prec == 0 ? 1 : pow(10, sensor.prec);
- str.append(printLabelValue(tr("Ratio"), QString::number((float)sensor.ratio / 10)));
- str.append(printLabelValue(tr("Offset"), QString::number((float)sensor.offset / prec, 'f', sensor.prec)));
- }
- else if (sensor.unit == SensorData::UNIT_RPMS) {
- str.append(printLabelValue(tr("Blades"), QString::number(sensor.ratio)));
- str.append(printLabelValue(tr("Multi"), QString::number(sensor.offset)));
- }
- }
- if (sensor.unit != SensorData::UNIT_RPMS && isConfigurable)
- str.append(printLabelValue(tr("Auto Offset"), printBoolean(sensor.autoOffset, BOOLEAN_YN)));
- if (isConfigurable)
- str.append(printLabelValue(tr("Filter"), printBoolean(sensor.filter, BOOLEAN_YN)));
- if (sensor.type == SensorData::TELEM_TYPE_CALCULATED)
- str.append(printLabelValue(tr("Persist"), printBoolean(sensor.persistent, BOOLEAN_YN)));
- str.append(printLabelValue(tr("Positive"), printBoolean(sensor.onlyPositive, BOOLEAN_YN)));
- str.append(printLabelValue(tr("Log"), printBoolean(sensor.logs, BOOLEAN_YN), false));
- return str;
-}
-
QString ModelPrinter::printTelemetryScreenType(unsigned int val)
{
switch (val) {
@@ -1373,17 +1224,3 @@ QString ModelPrinter::printChecklist()
}
return str;
}
-
-QString ModelPrinter::printTelemetryPrecision(unsigned int val)
-{
- switch (val) {
- case 0:
- return tr("0.");
- case 1:
- return tr("0.0");
- case 2:
- return tr("0.00");
- default:
- return CPN_STR_UNKNOWN_ITEM;
- }
-}
diff --git a/companion/src/modelprinter.h b/companion/src/modelprinter.h
index 2cce3585d..639eddb0e 100644
--- a/companion/src/modelprinter.h
+++ b/companion/src/modelprinter.h
@@ -116,22 +116,15 @@ class ModelPrinter: public QObject
QString printLabelValue(const QString & lbl, const QString & val, const bool sep = false);
QString printLabelValues(const QString & lbl, const QStringList & vals, const bool sep = false);
QString printRssiAlarmsDisabled(bool mb);
- QString printTelemetrySource(int val);
QString printVarioSource(unsigned int val);
QString printVarioCenterSilent(bool mb);
QString printVoltsSource(unsigned int val);
QString printCurrentSource(unsigned int val);
QString printMahPersistent(bool mb);
QString printIgnoreSensorIds(bool mb);
- QString printSensorType(unsigned int val);
- QString printSensorFormula(unsigned int val);
- QString printSensorCells(unsigned int val);
- QString printSensorTypeCond(unsigned int idx);
- QString printSensorParams(unsigned int idx);
QString printTelemetryScreenType(unsigned int val);
QString printTelemetryScreen(unsigned int idx, unsigned int line, unsigned int width);
QString printChecklist();
- QString printTelemetryPrecision(unsigned int val);
private:
Firmware * firmware;
diff --git a/companion/src/multimodelprinter.cpp b/companion/src/multimodelprinter.cpp
index 4da889cb1..9686dd944 100644
--- a/companion/src/multimodelprinter.cpp
+++ b/companion/src/multimodelprinter.cpp
@@ -777,7 +777,7 @@ QString MultiModelPrinter::printTelemetry()
if (firmware->getCapability(HasVario)) {
columns.appendRowStart(tr("Altimetry"), 20);
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
- LABELCOMPARECELL(tr("Vario source"), modelPrinter->printTelemetrySource(model->frsky.varioSource), 80);
+ LABELCOMPARECELL(tr("Vario source"), SensorData::sourceToString(model, model->frsky.varioSource), 80);
}
else {
LABELCOMPARECELL(tr("Vario source"), modelPrinter->printVarioSource(model->frsky.varioSource), 80);
@@ -801,8 +801,8 @@ QString MultiModelPrinter::printTelemetry()
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
columns.appendRowStart(tr("Top Bar"), 20);
columns.appendCellStart(80);
- COMPARESTRING(tr("Volts source"), modelPrinter->printTelemetrySource(model->frsky.voltsSource), true);
- COMPARESTRING(tr("Altitude source"), modelPrinter->printTelemetrySource(model->frsky.altitudeSource), false);
+ COMPARESTRING(tr("Volts source"), SensorData::sourceToString(model, model->frsky.voltsSource), true);
+ COMPARESTRING(tr("Altitude source"), SensorData::sourceToString(model, model->frsky.altitudeSource), false);
columns.appendCellEnd();
columns.appendRowEnd();
}
@@ -822,9 +822,9 @@ QString MultiModelPrinter::printSensors()
int count = 0;
columns.appendSectionTableStart();
columns.appendRowHeader(QStringList() << tr("Name") << tr("Type") << tr("Parameters"));
- for (unsigned i=0; isensorData[i].isAvailable()) {
tsEmpty = false;
break;
@@ -836,8 +836,8 @@ QString MultiModelPrinter::printSensors()
columns.appendCellStart(20, true);
COMPARE(model->sensorData[i].nameToString(i));
columns.appendCellEnd(true);
- COMPARECELLWIDTH(modelPrinter->printSensorTypeCond(i), 15);
- COMPARECELLWIDTH(modelPrinter->printSensorParams(i), 65);
+ COMPARECELLWIDTH(model->sensorData[i].isAvailable() ? SensorData::typeToString(model->sensorData[i].type) : "", 15);
+ COMPARECELLWIDTH(model->sensorData[i].paramsToString(model), 65);
columns.appendRowEnd();
}
}