diff --git a/companion/src/comparedialog.cpp b/companion/src/comparedialog.cpp
index 29551220a..29a60f2cf 100644
--- a/companion/src/comparedialog.cpp
+++ b/companion/src/comparedialog.cpp
@@ -803,7 +803,7 @@ void CompareDialog::printMixers()
break;
};
str += QString(" %1").arg(getGVarString(md->weight)).rightJustified(6, ' ');
- str += md->srcRaw.toString();
+ str += md->srcRaw.toString(*g_model1);
if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
if (md->carryTrim) str += " " + tr("noTrim");
if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
@@ -881,7 +881,7 @@ void CompareDialog::printMixers()
break;
};
str += QString(" %1").arg(getGVarString(md->weight)).rightJustified(6, ' ');
- str += md->srcRaw.toString();
+ str += md->srcRaw.toString(*g_model2);
if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
if (md->carryTrim) str += " " + tr("noTrim");
if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
@@ -1025,8 +1025,9 @@ void CompareDialog::printSwitches()
str.append("
");
for (int i=0; igetCapability(LogicalSwitches); i++) {
- QString sw1 = g_model1->customSw[i].toString(*g_model1);
- QString sw2 = g_model2->customSw[i].toString(*g_model2);
+ GeneralSettings settings;
+ QString sw1 = g_model1->customSw[i].toString(*g_model1, settings);
+ QString sw2 = g_model2->customSw[i].toString(*g_model2, settings);
if (!(sw1.isEmpty() && sw2.isEmpty())) {
str.append("");
color=getColor1(sw1,sw2);
diff --git a/companion/src/comparedialog.h b/companion/src/comparedialog.h
index 6f1c83875..ef6a5aec1 100644
--- a/companion/src/comparedialog.h
+++ b/companion/src/comparedialog.h
@@ -19,6 +19,7 @@ class CompareDialog : public QDialog
~CompareDialog();
protected:
+ GeneralSettings * settings;
ModelData * g_model1;
ModelData * g_model2;
ModelData * modeltemp;
diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp
index c0c745001..67d710c1f 100644
--- a/companion/src/eeprominterface.cpp
+++ b/companion/src/eeprominterface.cpp
@@ -1,5 +1,6 @@
#include
#include
+#include
#include "eeprominterface.h"
#include "firmwares/er9x/er9xinterface.h"
#include "firmwares/th9x/th9xinterface.h"
@@ -91,11 +92,12 @@ QString getGVarString(int16_t val, bool sign)
}
}
-RawSourceRange RawSource::getRange(bool singleprec)
+RawSourceRange RawSource::getRange(const ModelData & model, const GeneralSettings & settings, bool singleprec)
{
RawSourceRange result;
- int board = GetEepromInterface()->getBoard();
+ FirmwareInterface * firmware = GetCurrentFirmware();
+ int board = firmware->getBoard();
if (!singleprec && !IS_ARM(board)) {
singleprec = true;
@@ -103,11 +105,16 @@ RawSourceRange RawSource::getRange(bool singleprec)
switch (type) {
case SOURCE_TYPE_TELEMETRY:
+ if (singleprec) {
+ result.offset = -DBL_MAX;
+ }
+
switch (index) {
case TELEMETRY_SOURCE_TX_BATT:
result.step = 0.1;
result.decimals = 1;
result.max = 25.5;
+ result.unit = QObject::tr("V");
break;
case TELEMETRY_SOURCE_TX_TIME:
result.step = 1;
@@ -117,6 +124,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_TIMER2:
result.step = singleprec ? 5 : 1;
result.max = singleprec ? 255*5 : 60*60;
+ result.unit = QObject::tr("s");
break;
case TELEMETRY_SOURCE_RSSI_TX:
case TELEMETRY_SOURCE_RSSI_RX:
@@ -127,23 +135,33 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_A2:
case TELEMETRY_SOURCE_A3:
case TELEMETRY_SOURCE_A4:
- if (model) {
- const FrSkyChannelData & channel = model->frsky.channels[index-TELEMETRY_SOURCE_A1];
- float ratio = channel.getRatio();
- if (channel.type==0 || channel.type==1 || channel.type==2)
- result.decimals = 2;
- else
- result.decimals = 0;
- result.step = ratio / 255;
- result.min = channel.offset * result.step;
- result.max = ratio + result.min;
- }
+ {
+ const FrSkyChannelData & channel = model.frsky.channels[index-TELEMETRY_SOURCE_A1];
+ float ratio = channel.getRatio();
+ if (channel.type==0 || channel.type==1 || channel.type==2)
+ result.decimals = 2;
+ else
+ result.decimals = 0;
+ result.step = ratio / 255;
+ result.min = channel.offset * result.step;
+ result.max = ratio + result.min;
+ result.unit = QObject::tr("V");
break;
+ }
case TELEMETRY_SOURCE_ALT:
case TELEMETRY_SOURCE_GPS_ALT:
result.step = singleprec ? 8 : 1;
result.min = -500;
result.max = singleprec ? 1540 : 3000;
+ if (firmware->getCapability(Imperial) || settings.imperial) {
+ result.step = (result.step * 105) / 32;
+ result.min = (result.min * 105) / 32;
+ result.max = (result.max * 105) / 32;
+ result.unit = QObject::tr("ft");
+ }
+ else {
+ result.unit = QObject::tr("m");
+ }
break;
case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T1_MAX:
@@ -151,11 +169,13 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_T2_MAX:
result.min = -30;
result.max = 225;
+ result.unit = QObject::tr("°C");
break;
case TELEMETRY_SOURCE_HDG:
result.step = singleprec ? 2 : 1;
result.max = 360;
if (singleprec) result.offset = 256;
+ result.unit = QObject::tr("°");
break;
case TELEMETRY_SOURCE_RPM:
case TELEMETRY_SOURCE_RPM_MAX:
@@ -164,14 +184,21 @@ RawSourceRange RawSource::getRange(bool singleprec)
break;
case TELEMETRY_SOURCE_FUEL:
result.max = 100;
+ result.unit = QObject::tr("%");
break;
+ case TELEMETRY_SOURCE_ASPEED:
+ case TELEMETRY_SOURCE_ASPEED_MAX:
case TELEMETRY_SOURCE_SPEED:
case TELEMETRY_SOURCE_SPEED_MAX:
- result.step = singleprec ? 4 : 1;
- result.max = singleprec ? (4*236) : 2000;
- if (model && !model->frsky.imperial) {
+ result.step = singleprec ? 2 : 1;
+ result.max = singleprec ? (2*255) : 2000;
+ if (firmware->getCapability(Imperial) || settings.imperial) {
+ result.unit = QObject::tr("MPH");
+ }
+ else {
result.step *= 1.852;
result.max *= 1.852;
+ result.unit = QObject::tr("km/h");
}
break;
case TELEMETRY_SOURCE_VERTICAL_SPEED:
@@ -179,17 +206,20 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.min = -12.5;
result.max = 13.0;
result.decimals = 1;
+ result.unit = QObject::tr("m/s");
break;
case TELEMETRY_SOURCE_DIST:
case TELEMETRY_SOURCE_DIST_MAX:
result.step = singleprec ? 8 : 1;
result.max = singleprec ? 2040 : 10000;
+ result.unit = QObject::tr("m");
break;
case TELEMETRY_SOURCE_CELL:
case TELEMETRY_SOURCE_CELL_MIN:
result.step = singleprec ? 0.02 : 0.01;
result.max = 5.1;
result.decimals = 2;
+ result.unit = QObject::tr("V");
break;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_CELLS_MIN:
@@ -198,21 +228,25 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.step = 0.1;
result.max = 25.5;
result.decimals = 1;
+ result.unit = QObject::tr("V");
break;
case TELEMETRY_SOURCE_CURRENT:
case TELEMETRY_SOURCE_CURRENT_MAX:
result.step = singleprec ? 0.5 : 0.1;
result.max = singleprec ? 127.5 : 200.0;
result.decimals = 1;
+ result.unit = QObject::tr("A");
break;
case TELEMETRY_SOURCE_CONSUMPTION:
result.step = singleprec ? 100 : 1;
result.max = singleprec ? 25500 : 10000;
+ result.unit = QObject::tr("mAh");
break;
case TELEMETRY_SOURCE_POWER:
case TELEMETRY_SOURCE_POWER_MAX:
result.step = singleprec ? 5 : 1;
result.max = singleprec ? 1275 : 2000;
+ result.unit = QObject::tr("W");
break;
case TELEMETRY_SOURCE_ACCX:
case TELEMETRY_SOURCE_ACCY:
@@ -220,19 +254,21 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.step = 0.01;
result.decimals = 2;
result.max = 2.55;
+ result.unit = QObject::tr("g");
break;
default:
result.max = 125;
break;
}
- if (singleprec && !result.offset) {
+
+ if (singleprec && result.offset==-DBL_MAX) {
result.offset = result.max - (127*result.step);
}
break;
default:
- result.max = (model && model->extendedLimits ? 125 : 100);
- result.min = - result.max;
+ result.max = (model.extendedLimits ? 125 : 100);
+ result.min = -result.max;
break;
}
@@ -257,7 +293,7 @@ QString RotaryEncoderString(int index)
return CHECK_IN_ARRAY(rotary, index);
}
-QString RawSource::toString()
+QString RawSource::toString(const ModelData & model)
{
static const QString trims[] = {
QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA")
@@ -292,8 +328,8 @@ QString RawSource::toString()
case SOURCE_TYPE_VIRTUAL_INPUT:
{
QString result = QObject::tr("[I%1]").arg(index+1);
- if (model && strlen(model->inputNames[index]) > 0) {
- result += QString(model->inputNames[index]);
+ if (strlen(model.inputNames[index]) > 0) {
+ result += QString(model.inputNames[index]);
}
return result;
}
@@ -514,7 +550,7 @@ QString LogicalSwitchData::funcToString()
}
}
-QString LogicalSwitchData::toString(const ModelData & model)
+QString LogicalSwitchData::toString(const ModelData & model, const GeneralSettings & settings)
{
QString result = "";
@@ -535,11 +571,11 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += QObject::tr("Timer(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
break;
case LS_FAMILY_VOFS: {
- RawSource source = RawSource(val1, &model);
- RawSourceRange range = source.getRange();
+ RawSource source = RawSource(val1);
+ RawSourceRange range = source.getRange(model, settings);
QString res;
if (val1)
- res += source.toString();
+ res += source.toString(model);
else
res += "0";
res.remove(" ");
@@ -582,7 +618,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
case LS_FAMILY_VCOMP:
if (val1)
- result += RawSource(val1).toString();
+ result += RawSource(val1).toString(model);
else
result += "0";
switch (func) {
@@ -610,7 +646,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
break;
}
if (val2)
- result += RawSource(val2).toString();
+ result += RawSource(val2).toString(model);
else
result += "0";
break;
@@ -720,8 +756,9 @@ QStringList FuncSwData::toStringList()
QString FuncSwData::funcToString()
{
+ ModelData model;
if (func >= FuncSafetyCh1 && func <= FuncSafetyCh32)
- return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, func).toString());
+ return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model));
else if (func == FuncTrainer)
return QObject::tr("Trainer");
else if (func == FuncTrainerRUD)
@@ -800,7 +837,8 @@ QString FuncSwData::paramToString()
}
else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
RawSource item(param);
- return item.toString();
+ ModelData model;
+ return item.toString(model);
}
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
@@ -810,15 +848,16 @@ QString FuncSwData::paramToString()
}
}
else if ((func>FuncBackgroundMusicPause) && (funcmode = INPUT_MODE_BOTH;
expo->srcRaw = settings.getDefaultSource(i);
expo->weight = 100;
- strncpy(inputNames[i], expo->srcRaw.toString().toLatin1().constData(), sizeof(inputNames[i])-1);
+ strncpy(inputNames[i], expo->srcRaw.toString(*this).toLatin1().constData(), sizeof(inputNames[i])-1);
}
}
}
@@ -1153,7 +1185,7 @@ void ModelData::setDefaultMixes(const GeneralSettings & settings)
mix->destCh = i+1;
mix->weight = 100;
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
- mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, this);
+ mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i);
}
else {
mix->srcRaw = RawSource(SOURCE_TYPE_STICK, i);
diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h
index a4ceddde4..50a0cdf85 100644
--- a/companion/src/eeprominterface.h
+++ b/companion/src/eeprominterface.h
@@ -252,7 +252,7 @@ enum TelemetrySource {
TELEMETRY_SOURCE_ACCZ,
TELEMETRY_SOURCE_HDG,
TELEMETRY_SOURCE_VERTICAL_SPEED,
- TELEMETRY_SOURCE_ASPD,
+ TELEMETRY_SOURCE_ASPEED,
TELEMETRY_SOURCE_DTE,
TELEMETRY_SOURCE_A1_MIN,
TELEMETRY_SOURCE_A2_MIN,
@@ -327,29 +327,27 @@ class RawSourceRange
double max;
double step;
double offset;
-
+ QString unit;
};
+class GeneralSettings;
class RawSource {
public:
RawSource():
type(SOURCE_TYPE_NONE),
- index(0),
- model(NULL)
+ index(0)
{
}
- RawSource(int value, const ModelData * model=NULL):
+ RawSource(int value):
type(RawSourceType(abs(value)/65536)),
- index(value >= 0 ? abs(value)%65536 : -(abs(value)%65536)),
- model(model)
+ index(value >= 0 ? abs(value)%65536 : -(abs(value)%65536))
{
}
- RawSource(RawSourceType type, int index=0, const ModelData * model=NULL):
+ RawSource(RawSourceType type, int index=0):
type(type),
- index(index),
- model(model)
+ index(index)
{
}
@@ -358,9 +356,9 @@ class RawSource {
return index >= 0 ? (type * 65536 + index) : -(type * 65536 - index);
}
- QString toString();
+ QString toString(const ModelData & model);
- RawSourceRange getRange(bool singleprec=false);
+ RawSourceRange getRange(const ModelData & model, const GeneralSettings & settings, bool singleprec=false);
bool operator == ( const RawSource & other) {
return (this->type == other.type) && (this->index == other.index);
@@ -377,7 +375,6 @@ class RawSource {
RawSourceType type;
int index;
- const ModelData * model;
};
enum RawSwitchType {
@@ -717,7 +714,7 @@ class LogicalSwitchData { // Logical Switches data
CSFunctionFamily getFunctionFamily();
bool isDeltaFunction();
QString funcToString();
- QString toString(const ModelData & model);
+ QString toString(const ModelData & model, const GeneralSettings & settings);
};
enum AssignFunc {
@@ -888,7 +885,6 @@ class FrSkyData {
FrSkyData() { clear(); }
FrSkyChannelData channels[4];
unsigned int usrProto;
- unsigned int imperial;
int blades;
unsigned int voltsSource;
bool altitudeDisplayed;
@@ -1064,6 +1060,7 @@ enum Capability {
FlightModes,
FlightModesName,
FlightModesHaveFades,
+ Imperial,
Mixes,
Timers,
TimeDivisions,
diff --git a/companion/src/firmwares/er9x/er9xeeprom.cpp b/companion/src/firmwares/er9x/er9xeeprom.cpp
index abc644ae9..b65cbf7a7 100644
--- a/companion/src/firmwares/er9x/er9xeeprom.cpp
+++ b/companion/src/firmwares/er9x/er9xeeprom.cpp
@@ -468,7 +468,6 @@ t_Er9xModelData::operator ModelData ()
c9x.frsky = frsky;
c9x.frsky.usrProto=FrSkyUsrProto;
- c9x.frsky.imperial=FrSkyImperial;
c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt;
return c9x;
}
diff --git a/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp b/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp
index 94f26496f..ddb94c0fd 100644
--- a/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp
+++ b/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp
@@ -596,7 +596,6 @@ t_Ersky9xModelData_v10::operator ModelData ()
c9x.frsky = frsky;
c9x.frsky.usrProto=FrSkyUsrProto;
- c9x.frsky.imperial=FrSkyImperial;
c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt;
return c9x;
}
@@ -715,7 +714,6 @@ t_Ersky9xModelData_v11::operator ModelData ()
c9x.frsky = frsky;
c9x.frsky.usrProto=FrSkyUsrProto;
- c9x.frsky.imperial=FrSkyImperial;
c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt;
// for (int i=0; i<8; i++) {
// c9x.frskyalarms[i].frskyAlarmLimit=frskyAlarms.alarmData[i].frskyAlarmLimit;
diff --git a/companion/src/firmwares/opentx/open9xStockeeprom.cpp b/companion/src/firmwares/opentx/open9xStockeeprom.cpp
index a6cd3c4f1..898743af1 100644
--- a/companion/src/firmwares/opentx/open9xStockeeprom.cpp
+++ b/companion/src/firmwares/opentx/open9xStockeeprom.cpp
@@ -842,7 +842,6 @@ t_Open9xFrSkyData_v204::operator FrSkyData ()
c9x.channels[0] = channels[0];
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
- c9x.imperial = imperial;
c9x.blades = blades+2;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
@@ -856,7 +855,6 @@ t_Open9xFrSkyData_v205::operator FrSkyData ()
c9x.channels[0] = channels[0];
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
- c9x.imperial = imperial;
c9x.blades = blades+2;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
diff --git a/companion/src/firmwares/opentx/opentxM128simulator.cpp b/companion/src/firmwares/opentx/opentxM128simulator.cpp
index b5ba97093..d92eae2b3 100644
--- a/companion/src/firmwares/opentx/opentxM128simulator.cpp
+++ b/companion/src/firmwares/opentx/opentxM128simulator.cpp
@@ -46,6 +46,8 @@
#define GPS
#define FAI_CHOICE
#define FRSKY_STICKS
+#define DSM2
+#define DSM2_PPM
#define EEPROM_VARIANT SIMU_M128_VARIANTS
#define GAUGES
diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp
index c42e80483..d17afe577 100644
--- a/companion/src/firmwares/opentx/opentxeeprom.cpp
+++ b/companion/src/firmwares/opentx/opentxeeprom.cpp
@@ -260,7 +260,7 @@ class SourcesConversionTable: public ConversionTable {
for (int i=0; i= 216) {
- addConversion(1+TELEMETRY_SOURCE_ASPD, val++);
+ addConversion(1+TELEMETRY_SOURCE_ASPEED, val++);
addConversion(1+TELEMETRY_SOURCE_DTE, val++);
}
if (IS_ARM(board) && version >= 216) {
@@ -1009,7 +1009,7 @@ class MixField: public TransformedField {
if (IS_TARANIS(board) && version < 216) {
if (mix.srcRaw.type == SOURCE_TYPE_STICK && mix.srcRaw.index < NUM_STICKS) {
if (!mix.noExpo) {
- mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, mix.srcRaw.index, model);
+ mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, mix.srcRaw.index);
}
}
}
@@ -1548,7 +1548,7 @@ class LogicalSwitchField: public TransformedField {
else if (csw.func != LS_FN_OFF) {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
csw.val2 = v2;
- RawSource val1(csw.val1, model);
+ RawSource val1(csw.val1);
if (IS_ARM(board) && version < 216 && val1.type == SOURCE_TYPE_TELEMETRY) {
switch (val1.index) {
case TELEMETRY_SOURCE_TIMER1:
@@ -2424,7 +2424,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_ARM(board))
internalField.Append(new UnsignedField<3>(modelData.telemetryProtocol));
else
- internalField.Append(new ConversionField< SignedField<3> >(modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol")));
+ internalField.Append(new ConversionField< UnsignedField<3> >((unsigned int &)modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol")));
internalField.Append(new BoolField<1>(modelData.thrTrim));
diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp
index 7631bcd40..ab630585d 100644
--- a/companion/src/firmwares/opentx/opentxinterface.cpp
+++ b/companion/src/firmwares/opentx/opentxinterface.cpp
@@ -468,6 +468,11 @@ FirmwareInterface * OpenTxFirmware::getFirmwareVariant(const QString & id)
int OpenTxFirmware::getCapability(const Capability capability)
{
switch (capability) {
+ case Imperial:
+ if (IS_ARM(board))
+ return 0;
+ else
+ return id.contains("imperial") ? 1 : 0;
case ModelImage:
if (IS_TARANIS(board))
return 1;
diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp
index f82abc21f..6288305ae 100644
--- a/companion/src/helpers.cpp
+++ b/companion/src/helpers.cpp
@@ -72,7 +72,7 @@ QString getInputStr(ModelData & model, int index)
}
}
else {
- result = RawSource(SOURCE_TYPE_STICK, index).toString();
+ result = RawSource(SOURCE_TYPE_STICK, index).toString(model);
}
return result;
@@ -158,7 +158,7 @@ GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightC
}
else {
weightGV->hide();
- if (weight > maxi || weight < -mini) {
+ if (weight > maxi || weight < mini) {
weight = deflt;
}
}
@@ -553,7 +553,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_SOURCES) {
item = RawSource(SOURCE_TYPE_NONE);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
@@ -561,8 +561,8 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
for (int i=0; iaddItem(item.toString(), item.toValue());
+ item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i);
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -571,12 +571,12 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_SOURCES) {
for (int i=0; i<4+GetCurrentFirmware()->getCapability(Pots); i++) {
item = RawSource(SOURCE_TYPE_STICK, i);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; igetCapability(RotaryEncoders); i++) {
item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, i);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -584,27 +584,27 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_TRIMS) {
for (int i=0; i<4; i++) {
item = RawSource(SOURCE_TYPE_TRIM, i);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
if (flags & POPULATE_SOURCES) {
item = RawSource(SOURCE_TYPE_MAX);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
if (flags & POPULATE_SWITCHES) {
for (int i=0; igetCapability(Switches); i++) {
item = RawSource(SOURCE_TYPE_SWITCH, i);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; igetCapability(LogicalSwitches); i++) {
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -612,19 +612,19 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_SOURCES) {
for (int i=0; iaddItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; igetCapability(TrainerInputs); i++) {
item = RawSource(SOURCE_TYPE_PPM, i);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; igetCapability(Outputs); i++) {
item = RawSource(SOURCE_TYPE_CH, i);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -634,7 +634,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(GetCurrentFirmware()->getBoard()))
continue;
item = RawSource(SOURCE_TYPE_TELEMETRY, i);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -643,7 +643,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(GetCurrentFirmware()->getBoard()))
continue;
item = RawSource(SOURCE_TYPE_TELEMETRY, i);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -651,7 +651,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_GVARS) {
for (int i=0; igetCapability(Gvars); i++) {
item = RawSource(SOURCE_TYPE_GVAR, i);
- b->addItem(item.toString(), item.toValue());
+ b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -777,7 +777,8 @@ QString getFrSkyMeasure(int units)
QString getFrSkySrc(int index)
{
- return RawSource(SOURCE_TYPE_TELEMETRY, index-1).toString();
+ ModelData model;
+ return RawSource(SOURCE_TYPE_TELEMETRY, index-1).toString(model);
}
QString getTrimInc(ModelData * g_model)
diff --git a/companion/src/modeledit/expodialog.cpp b/companion/src/modeledit/expodialog.cpp
index ff0f788f1..3ae8177cb 100644
--- a/companion/src/modeledit/expodialog.cpp
+++ b/companion/src/modeledit/expodialog.cpp
@@ -122,7 +122,7 @@ ExpoDialog::~ExpoDialog()
void ExpoDialog::updateScale()
{
if (firmware->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
- RawSourceRange range = ed->srcRaw.getRange();
+ RawSourceRange range = ed->srcRaw.getRange(model, generalSettings);
ui->scaleLabel->show();
ui->scale->show();
ui->scale->setDecimals(range.decimals);
@@ -146,7 +146,7 @@ void ExpoDialog::valuesChanged()
updateScale();
}
- RawSourceRange range = srcRaw.getRange();
+ RawSourceRange range = srcRaw.getRange(model, generalSettings);
ed->scale = round(float(ui->scale->value()) / range.step);
ed->carryTrim = 1 - ui->trimCB->currentIndex();
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
diff --git a/companion/src/modeledit/inputs.cpp b/companion/src/modeledit/inputs.cpp
index 0c0718974..6ffa4c972 100644
--- a/companion/src/modeledit/inputs.cpp
+++ b/companion/src/modeledit/inputs.cpp
@@ -165,12 +165,12 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
if (md->offset) str += " " + tr("Offset(%1)").arg(getGVarString(md->offset));
if (firmware->getCapability(VirtualInputs)) {
- str += " " + tr("Source(%1)").arg(md->srcRaw.toString());
+ str += " " + tr("Source(%1)").arg(md->srcRaw.toString(model));
if (md->carryTrim>0) {
str += " " + tr("NoTrim");
}
else if (md->carryTrim<0) {
- str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
+ str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
}
}
diff --git a/companion/src/modeledit/logicalswitches.cpp b/companion/src/modeledit/logicalswitches.cpp
index bd65588e8..d14bea63a 100644
--- a/companion/src/modeledit/logicalswitches.cpp
+++ b/companion/src/modeledit/logicalswitches.cpp
@@ -138,13 +138,13 @@ void LogicalSwitchesPanel::v1Edited(int value)
int i = sender()->property("index").toInt();
model.customSw[i].val1 = cswitchSource1[i]->itemData(value).toInt();
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_VOFS) {
- RawSource source = RawSource(model.customSw[i].val1, &model);
- RawSourceRange range = source.getRange();
+ RawSource source = RawSource(model.customSw[i].val1);
+ RawSourceRange range = source.getRange(model, generalSettings);
if (model.customSw[i].isDeltaFunction()) {
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
}
else {
- model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step/* TODO - source.getRawOffset(model)*/;
+ model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step;
}
setSwitchWidgetVisibility(i);
}
@@ -220,8 +220,8 @@ void LogicalSwitchesPanel::edited()
{
case LS_FAMILY_VOFS:
{
- source = RawSource(model.customSw[i].val1, &model);
- RawSourceRange range = source.getRange();
+ source = RawSource(model.customSw[i].val1);
+ RawSourceRange range = source.getRange(model, generalSettings);
double value = source.isTimeBased() ? QTimeS(cswitchTOffset[i]->time()).seconds() : cswitchOffset[i]->value();
if (model.customSw[i].isDeltaFunction()) {
/*TODO: is this delta function value set correctly*/
@@ -230,10 +230,12 @@ void LogicalSwitchesPanel::edited()
}
else {
model.customSw[i].val2 = round((value-range.offset)/range.step);;
- value= model.customSw[i].val2*range.step + range.offset;
+ value = model.customSw[i].val2*range.step + range.offset;
}
- if (source.isTimeBased()) cswitchTOffset[i]->setTime(QTimeS(round(value)));
- else cswitchOffset[i]->setValue(value);
+ if (source.isTimeBased())
+ cswitchTOffset[i]->setTime(QTimeS(round(value)));
+ else
+ cswitchOffset[i]->setValue(value);
break;
}
case LS_FAMILY_TIMER:
@@ -288,8 +290,8 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
lock = true;
unsigned int mask = 0;
- RawSource source = RawSource(model.customSw[i].val1, &model);
- RawSourceRange range = source.getRange();
+ RawSource source = RawSource(model.customSw[i].val1);
+ RawSourceRange range = source.getRange(model, generalSettings);
switch (model.customSw[i].getFunctionFamily())
{
@@ -316,6 +318,10 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
}
else {
mask |= VALUE2_VISIBLE;
+ if (range.unit.isEmpty())
+ cswitchOffset[i]->setSuffix("");
+ else
+ cswitchOffset[i]->setSuffix(" " + range.unit);
if (model.customSw[i].isDeltaFunction()) {
/*TODO: is this delta function value set correctly*/
cswitchOffset[i]->setMinimum(range.step*-127);
diff --git a/companion/src/modeledit/mixerdialog.cpp b/companion/src/modeledit/mixerdialog.cpp
index 33140c8df..1312c1255 100644
--- a/companion/src/modeledit/mixerdialog.cpp
+++ b/companion/src/modeledit/mixerdialog.cpp
@@ -142,7 +142,7 @@ void MixerDialog::valuesChanged()
if (!lock) {
lock = true;
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
- md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt(), &model);
+ md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
if (firmware->getCapability(HasNoExpo)) {
bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < NUM_STICKS);
ui->MixDR_CB->setEnabled(drVisible);
diff --git a/companion/src/modeledit/mixes.cpp b/companion/src/modeledit/mixes.cpp
index a6b6459d9..946668b1d 100644
--- a/companion/src/modeledit/mixes.cpp
+++ b/companion/src/modeledit/mixes.cpp
@@ -170,16 +170,12 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
default: str += " "; break;
};
- //set mixer src model if it is unset (srcRaw needs this to generate proper toString() for input source type)
- if (md->srcRaw.model == 0)
- md->srcRaw.model = &model;
-
- //highlight source if needed
+ // highlight source if needed
if ( (md->srcRaw.type == SOURCE_TYPE_CH) && (md->srcRaw.index+1 == (int)highlightedSource) ) {
- str += " " + Qt::escape(md->srcRaw.toString()) + "";
+ str += " " + Qt::escape(md->srcRaw.toString(model)) + "";
}
else {
- str += " " + Qt::escape(md->srcRaw.toString());
+ str += " " + Qt::escape(md->srcRaw.toString(model));
}
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(md->weight, true)));
@@ -192,7 +188,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
}
if (md->carryTrim>0) str += " " + Qt::escape(tr("NoTrim"));
- else if (md->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
+ else if (md->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
if (firmware->getCapability(HasNoExpo) && md->noExpo) str += " " + Qt::escape(tr("No DR/Expo"));
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp
index 9a42349dd..1e37aa5b3 100644
--- a/companion/src/modeledit/telemetry.cpp
+++ b/companion/src/modeledit/telemetry.cpp
@@ -168,7 +168,8 @@ void TelemetryAnalog::on_RatioSB_editingFinished()
if (calib<0) {
if (calib<((ratio*-128)/255)) {
analog.offset=-128;
- } else {
+ }
+ else {
analog.offset=round(calib*255/ratio);
}
}
@@ -294,7 +295,6 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
for (int c=0; cgetCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c] = new QComboBox(this);
fieldsCB[l][c]->setProperty("index", c + (l<<8));
- populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model.frsky.usrProto);
ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int)));
}
@@ -303,7 +303,6 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
for (int l=0; l<4; l++) {
barsCB[l] = new QComboBox(this);
barsCB[l]->setProperty("index", l);
- populateTelemetrySourceCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto);
connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);
@@ -336,10 +335,10 @@ void TelemetryCustomScreen::populateTelemetrySourceCB(QComboBox *b, unsigned int
int telem_hub[] = {0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,0,2,2,1,1,1,1,1,1};
b->clear();
- b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString());
+ b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString(model));
for (unsigned int i = 0; i < (last ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_DISPLAY_COUNT); i++) {
- b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString());
+ b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString(model));
if (!firmware->isTelemetrySourceAvailable(i)) {
//disable item
QModelIndex index = b->model()->index(i+1, 0);
@@ -375,6 +374,16 @@ void TelemetryCustomScreen::update()
ui->screenNums->setVisible(screen.type == 0);
ui->screenBars->setVisible(screen.type != 0);
+ for (int l=0; l<4; l++) {
+ for (int c=0; cgetCapability(TelemetryCustomScreensFieldsPerLine); c++) {
+ populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model.frsky.usrProto);
+ }
+ }
+
+ for (int l=0; l<4; l++) {
+ populateTelemetrySourceCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto);
+ }
+
if (screen.type == 0) {
for (int l=0; l<4; l++) {
for (int c=0; cgetCapability(TelemetryCustomScreensFieldsPerLine); c++) {
@@ -398,8 +407,8 @@ void TelemetryCustomScreen::updateBar(int line)
int index = screen.body.bars[line].source;
barsCB[line]->setCurrentIndex(index);
if (index) {
- RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1, &model);
- RawSourceRange range = source.getRange(true);
+ RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1);
+ RawSourceRange range = source.getRange(model, generalSettings, true);
int max = round((range.max - range.min) / range.step);
if (int(255-screen.body.bars[line].barMax) > max)
screen.body.bars[line].barMax = 255 - max;
@@ -519,6 +528,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
for (int i=0; igetCapability(TelemetryCustomScreens); i++) {
TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings, firmware);
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
+ telemetryCustomScreens[i] = tab;
}
if (IS_ARM(GetEepromInterface()->getBoard())) {
@@ -606,27 +616,10 @@ void TelemetryPanel::setup()
}
}
- if (!(firmware->getCapability(HasAltitudeSel)||firmware->getCapability(HasVario))) {
- ui->altimetryGB->hide();
- }
+ ui->altimetryGB->setVisible(firmware->getCapability(HasAltitudeSel) || firmware->getCapability(HasVario)),
+ ui->frskyProtoCB->setDisabled(firmware->getCapability(NoTelemetryProtocol));
- if (firmware->getCapability(NoTelemetryProtocol)) {
- ui->frskyProtoCB->setDisabled(true);
- }
- else {
- ui->frskyProtoCB->setEnabled(true);
- }
-
- if (!firmware->getCapability(TelemetryUnits)) {
- ui->frskyUnitsCB->setDisabled(true);
- int index=0;
- if (firmware_id.contains("imperial")) {
- index=1;
- }
- ui->frskyUnitsCB->setCurrentIndex(index);
- }
-
- if ((firmware->getCapability(Telemetry)&TM_HASWSHH)) {
+ if (firmware->getCapability(Telemetry) & TM_HASWSHH) {
ui->frskyProtoCB->addItem(tr("Winged Shadow How High"));
}
else {
@@ -660,7 +653,6 @@ void TelemetryPanel::setup()
}
ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto);
- ui->frskyUnitsCB->setCurrentIndex(model.frsky.imperial);
ui->bladesCount->setValue(model.frsky.blades);
populateVoltsSource();
@@ -725,12 +717,6 @@ void TelemetryPanel::onAnalogModified()
emit modified();
}
-void TelemetryPanel::on_frskyUnitsCB_currentIndexChanged(int index)
-{
- model.frsky.imperial = index;
- emit modified();
-}
-
void TelemetryPanel::on_bladesCount_editingFinished()
{
model.frsky.blades = ui->bladesCount->value();
@@ -740,6 +726,8 @@ void TelemetryPanel::on_bladesCount_editingFinished()
void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index)
{
model.frsky.usrProto = index;
+ for (int i=0; igetCapability(TelemetryCustomScreens); i++)
+ telemetryCustomScreens[i]->update();
emit modified();
}
diff --git a/companion/src/modeledit/telemetry.h b/companion/src/modeledit/telemetry.h
index 6694ae319..e28ff6387 100644
--- a/companion/src/modeledit/telemetry.h
+++ b/companion/src/modeledit/telemetry.h
@@ -86,7 +86,6 @@ class TelemetryPanel : public ModelPanel
void on_telemetryProtocol_currentIndexChanged(int index);
void onAnalogModified();
void on_frskyProtoCB_currentIndexChanged(int index);
- void on_frskyUnitsCB_currentIndexChanged(int index);
void on_bladesCount_editingFinished();
void on_AltitudeToolbar_ChkB_toggled(bool checked);
void on_rssiAlarm1CB_currentIndexChanged(int index);
@@ -106,6 +105,7 @@ class TelemetryPanel : public ModelPanel
private:
Ui::Telemetry *ui;
TelemetryAnalog * analogs[4];
+ TelemetryCustomScreen * telemetryCustomScreens[4];
void setup();
void telBarUpdate();
diff --git a/companion/src/modeledit/telemetry.ui b/companion/src/modeledit/telemetry.ui
index 24ca7eb31..9a5facdf5 100644
--- a/companion/src/modeledit/telemetry.ui
+++ b/companion/src/modeledit/telemetry.ui
@@ -61,7 +61,7 @@
-
-
+
-
@@ -188,221 +188,6 @@
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 3
-
-
- 3
-
-
-
-
-
- 9
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
- Volt source
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
- Metric
-
-
- -
-
- Imperial
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
- Current source
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 100
- 0
-
-
-
- Protocol
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
- None
-
-
- -
-
- FrSky Sensor Hub
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
- Units
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Blades
-
-
-
- -
-
-
-
- 75
- true
-
-
-
- Serial Protocol
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 0
-
-
- 2.000000000000000
-
-
- 5.000000000000000
-
-
- 2.000000000000000
-
-
-
-
-
-
-
-
-
@@ -738,21 +523,121 @@
0
-
-
+
3
0
-
-
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Volt source
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+ Current source
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 0
+
+
+ 2.000000000000000
+
+
+ 5.000000000000000
+
+
+ 2.000000000000000
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Blades
+
+
+
+ -
mAh count
- -
+
-
@@ -768,7 +653,7 @@
- -
+
-
@@ -793,7 +678,7 @@
- -
+
-
@@ -806,26 +691,13 @@
- -
+
-
Persistent mAh
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
@@ -845,6 +717,39 @@
+ -
+
+
+
+ 75
+ true
+
+
+
+ Serial Protocol
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
-
+
+ None
+
+
+ -
+
+ FrSky Sensor Hub
+
+
+
+
-
diff --git a/companion/src/printdialog.cpp b/companion/src/printdialog.cpp
index 990f8c1d1..ec67f7533 100644
--- a/companion/src/printdialog.cpp
+++ b/companion/src/printdialog.cpp
@@ -238,9 +238,9 @@ void PrintDialog::printInputs()
str += " " + tr("Weight") + QString("(%1)").arg(getGVarString(ed->weight,true));
if (firmware->getCapability(VirtualInputs)) {
- str += " " + tr("Source") + QString("(%1)").arg(ed->srcRaw.toString());
+ str += " " + tr("Source") + QString("(%1)").arg(ed->srcRaw.toString(*g_model));
if (ed->carryTrim>0) str += " " + tr("NoTrim");
- else if (ed->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(ed->carryTrim)-1)).toString();
+ else if (ed->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(ed->carryTrim)-1)).toString(*g_model);
}
if (ed->curve.value) str += " " + Qt::escape(ed->curve.toString());
@@ -321,11 +321,8 @@ void PrintDialog::printMixes()
case (2): str += " R"; break;
default: str += " "; break;
};
- //set mixer src model if it is unset (srcRaw needs this to generate proper toString() for input source type)
- if (md->srcRaw.model == 0)
- md->srcRaw.model = g_model;
- str += " " + md->srcRaw.toString();
+ str += " " + md->srcRaw.toString(*g_model);
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(md->weight, true)));
QString phasesStr = getPhasesStr(md->phases, *g_model);
@@ -335,8 +332,10 @@ void PrintDialog::printMixes()
str += " " + Qt::escape(tr("Switch(%1)").arg(md->swtch.toString()));
}
- if (md->carryTrim>0) str += " " + Qt::escape(tr("NoTrim"));
- else if (md->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
+ if (md->carryTrim>0)
+ str += " " + Qt::escape(tr("NoTrim"));
+ else if (md->carryTrim<0)
+ str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(*g_model);
if (firmware->getCapability(HasNoExpo) && md->noExpo) str += " " + Qt::escape(tr("No DR/Expo"));
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
@@ -350,7 +349,8 @@ void PrintDialog::printMixes()
str += Qt::escape(tr(" Delay(u%1:d%2)").arg((double)md->delayUp/scale).arg((double)md->delayDown/scale));
if (md->speedDown || md->speedUp)
str += Qt::escape(tr(" Slow(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale));
- if (md->mixWarn) str += Qt::escape(tr(" Warn(%1)").arg(md->mixWarn));
+ if (md->mixWarn)
+ str += Qt::escape(tr(" Warn(%1)").arg(md->mixWarn));
if (firmware->getCapability(HasMixerNames)) {
QString MixerName;
MixerName.append(md->name);
@@ -588,7 +588,7 @@ void PrintDialog::printSwitches()
if (g_model->customSw[i].func) {
str.append("
");
str.append("| "+tr("L")+QString("%1 | ").arg(i+1));
- QString tstr = g_model->customSw[i].toString(*g_model);
+ QString tstr = g_model->customSw[i].toString(*g_model, *g_eeGeneral);
str.append(doTL(tstr,"green"));
str.append(" ");
sc++;
@@ -754,7 +754,6 @@ void PrintDialog::printFrSky()
str.append(""+getFrSkyAlarmType(fd->rssiAlarms[1].level)+" | < | "+QString::number(fd->rssiAlarms[1].value,10)+" | ");
str.append(" | ");
str.append("| "+tr("Frsky serial protocol")+" | "+getFrSkyProtocol(fd->usrProto)+" | ");
- str.append("| "+tr("Units system")+" | "+getFrSkyMeasure(fd->imperial)+" | ");
str.append("| "+tr("Blades")+" | "+fd->blades+" | ");
str.append(" | ");
}
diff --git a/companion/src/simulation/simulatordialog.cpp b/companion/src/simulation/simulatordialog.cpp
index 69f85346f..b3a6580a1 100644
--- a/companion/src/simulation/simulatordialog.cpp
+++ b/companion/src/simulation/simulatordialog.cpp
@@ -361,7 +361,8 @@ void SimulatorDialog::initUi(T * ui)
int column = i / (outputs/2);
int line = i % (outputs/2);
QLabel * label = new QLabel(tabWidget);
- label->setText(RawSource(SOURCE_TYPE_CH, i).toString());
+ ModelData model;
+ label->setText(RawSource(SOURCE_TYPE_CH, i).toString(model));
channelsLayout->addWidget(label, line, column == 0 ? 0 : 5, 1, 1);
QSlider * slider = new QSlider(tabWidget);
diff --git a/companion/src/wizarddata.cpp b/companion/src/wizarddata.cpp
index bcdc4dd16..62a9f1c7c 100644
--- a/companion/src/wizarddata.cpp
+++ b/companion/src/wizarddata.cpp
@@ -60,7 +60,7 @@ void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int
mix.destCh = channel+1;
if (isTaranis){
int channel = settings.getDefaultChannel(input-1);
- mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, channel, &model);
+ mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, channel);
}
else
mix.srcRaw = RawSource(SOURCE_TYPE_STICK, input-1);
diff --git a/radio/src/audio_arm.cpp b/radio/src/audio_arm.cpp
index a194e6a1c..1b69b1783 100644
--- a/radio/src/audio_arm.cpp
+++ b/radio/src/audio_arm.cpp
@@ -155,6 +155,19 @@ const char * audioFilenames[] = {
"eeformat",
"lowbatt",
"inactiv",
+ "a1_org",
+ "a1_red",
+ "a2_org",
+ "a2_red",
+ "a3_org",
+ "a3_red",
+ "a4_org",
+ "a4_red",
+ "rssi_org",
+ "rssi_red",
+ "swr_red",
+ "telemko",
+ "telemok",
#if defined(PCBSKY9X)
"highmah",
"hightemp",
@@ -189,20 +202,7 @@ const char * audioFilenames[] = {
"timer00",
"timer10",
"timer20",
- "timer30",
- "a1_org",
- "a1_red",
- "a2_org",
- "a2_red",
- "a3_org",
- "a3_red",
- "a4_org",
- "a4_red",
- "rssi_org",
- "rssi_red",
- "swr_red",
- "telemko",
- "telemok"
+ "timer30"
};
uint64_t sdAvailableSystemAudioFiles = 0;
diff --git a/radio/src/gui/menu_model.cpp b/radio/src/gui/menu_model.cpp
index 657efab88..7008d6fa6 100644
--- a/radio/src/gui/menu_model.cpp
+++ b/radio/src/gui/menu_model.cpp
@@ -1350,7 +1350,17 @@ void menuModelSetup(uint8_t event)
lcd_putsLeft(y, STR_BEEPCTR);
for (uint8_t i=0; i POT3) {
+ x -= FW;
+ }
+#endif
+ lcd_putsiAtt(x, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1< |