1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-14 11:59:50 +03:00
This commit is contained in:
bsongis 2014-06-19 11:59:18 +02:00
parent 6ef4134b2d
commit ed90015503
21 changed files with 260 additions and 371 deletions

View file

@ -803,7 +803,7 @@ void CompareDialog::printMixers()
break; break;
}; };
str += QString(" %1").arg(getGVarString(md->weight)).rightJustified(6, ' '); 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->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
if (md->carryTrim) str += " " + tr("noTrim"); if (md->carryTrim) str += " " + tr("noTrim");
if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset)); if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
@ -881,7 +881,7 @@ void CompareDialog::printMixers()
break; break;
}; };
str += QString(" %1").arg(getGVarString(md->weight)).rightJustified(6, ' '); 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->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
if (md->carryTrim) str += " " + tr("noTrim"); if (md->carryTrim) str += " " + tr("noTrim");
if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset)); if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
@ -1025,8 +1025,9 @@ void CompareDialog::printSwitches()
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>"); str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">"); str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
QString sw1 = g_model1->customSw[i].toString(*g_model1); GeneralSettings settings;
QString sw2 = g_model2->customSw[i].toString(*g_model2); 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())) { if (!(sw1.isEmpty() && sw2.isEmpty())) {
str.append("<tr>"); str.append("<tr>");
color=getColor1(sw1,sw2); color=getColor1(sw1,sw2);

View file

@ -19,6 +19,7 @@ class CompareDialog : public QDialog
~CompareDialog(); ~CompareDialog();
protected: protected:
GeneralSettings * settings;
ModelData * g_model1; ModelData * g_model1;
ModelData * g_model2; ModelData * g_model2;
ModelData * modeltemp; ModelData * modeltemp;

View file

@ -92,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; RawSourceRange result;
int board = GetEepromInterface()->getBoard(); FirmwareInterface * firmware = GetCurrentFirmware();
int board = firmware->getBoard();
if (!singleprec && !IS_ARM(board)) { if (!singleprec && !IS_ARM(board)) {
singleprec = true; singleprec = true;
@ -134,8 +135,8 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_A2: case TELEMETRY_SOURCE_A2:
case TELEMETRY_SOURCE_A3: case TELEMETRY_SOURCE_A3:
case TELEMETRY_SOURCE_A4: case TELEMETRY_SOURCE_A4:
if (model) { {
const FrSkyChannelData & channel = model->frsky.channels[index-TELEMETRY_SOURCE_A1]; const FrSkyChannelData & channel = model.frsky.channels[index-TELEMETRY_SOURCE_A1];
float ratio = channel.getRatio(); float ratio = channel.getRatio();
if (channel.type==0 || channel.type==1 || channel.type==2) if (channel.type==0 || channel.type==1 || channel.type==2)
result.decimals = 2; result.decimals = 2;
@ -145,14 +146,22 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.min = channel.offset * result.step; result.min = channel.offset * result.step;
result.max = ratio + result.min; result.max = ratio + result.min;
result.unit = QObject::tr("V"); result.unit = QObject::tr("V");
}
break; break;
}
case TELEMETRY_SOURCE_ALT: case TELEMETRY_SOURCE_ALT:
case TELEMETRY_SOURCE_GPS_ALT: case TELEMETRY_SOURCE_GPS_ALT:
result.step = singleprec ? 8 : 1; result.step = singleprec ? 8 : 1;
result.min = -500; result.min = -500;
result.max = singleprec ? 1540 : 3000; 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"); result.unit = QObject::tr("m");
}
break; break;
case TELEMETRY_SOURCE_T1: case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T1_MAX: case TELEMETRY_SOURCE_T1_MAX:
@ -183,14 +192,14 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_SPEED_MAX: case TELEMETRY_SOURCE_SPEED_MAX:
result.step = singleprec ? 2 : 1; result.step = singleprec ? 2 : 1;
result.max = singleprec ? (2*255) : 2000; result.max = singleprec ? (2*255) : 2000;
if (model && !model->frsky.imperial) { if (firmware->getCapability(Imperial) || settings.imperial) {
result.unit = QObject::tr("MPH");
}
else {
result.step *= 1.852; result.step *= 1.852;
result.max *= 1.852; result.max *= 1.852;
result.unit = QObject::tr("km/h"); result.unit = QObject::tr("km/h");
} }
else {
result.unit = QObject::tr("MPH");
}
break; break;
case TELEMETRY_SOURCE_VERTICAL_SPEED: case TELEMETRY_SOURCE_VERTICAL_SPEED:
result.step = 0.1; result.step = 0.1;
@ -258,7 +267,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
break; break;
default: default:
result.max = (model && model->extendedLimits ? 125 : 100); result.max = (model.extendedLimits ? 125 : 100);
result.min = -result.max; result.min = -result.max;
break; break;
} }
@ -284,7 +293,7 @@ QString RotaryEncoderString(int index)
return CHECK_IN_ARRAY(rotary, index); return CHECK_IN_ARRAY(rotary, index);
} }
QString RawSource::toString() QString RawSource::toString(const ModelData & model)
{ {
static const QString trims[] = { static const QString trims[] = {
QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA") QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA")
@ -319,8 +328,8 @@ QString RawSource::toString()
case SOURCE_TYPE_VIRTUAL_INPUT: case SOURCE_TYPE_VIRTUAL_INPUT:
{ {
QString result = QObject::tr("[I%1]").arg(index+1); QString result = QObject::tr("[I%1]").arg(index+1);
if (model && strlen(model->inputNames[index]) > 0) { if (strlen(model.inputNames[index]) > 0) {
result += QString(model->inputNames[index]); result += QString(model.inputNames[index]);
} }
return result; return result;
} }
@ -541,7 +550,7 @@ QString LogicalSwitchData::funcToString()
} }
} }
QString LogicalSwitchData::toString(const ModelData & model) QString LogicalSwitchData::toString(const ModelData & model, const GeneralSettings & settings)
{ {
QString result = ""; QString result = "";
@ -562,11 +571,11 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += QObject::tr("Timer(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2)); result += QObject::tr("Timer(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
break; break;
case LS_FAMILY_VOFS: { case LS_FAMILY_VOFS: {
RawSource source = RawSource(val1, &model); RawSource source = RawSource(val1);
RawSourceRange range = source.getRange(); RawSourceRange range = source.getRange(model, settings);
QString res; QString res;
if (val1) if (val1)
res += source.toString(); res += source.toString(model);
else else
res += "0"; res += "0";
res.remove(" "); res.remove(" ");
@ -609,7 +618,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
case LS_FAMILY_VCOMP: case LS_FAMILY_VCOMP:
if (val1) if (val1)
result += RawSource(val1).toString(); result += RawSource(val1).toString(model);
else else
result += "0"; result += "0";
switch (func) { switch (func) {
@ -637,7 +646,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
break; break;
} }
if (val2) if (val2)
result += RawSource(val2).toString(); result += RawSource(val2).toString(model);
else else
result += "0"; result += "0";
break; break;
@ -747,8 +756,9 @@ QStringList FuncSwData::toStringList()
QString FuncSwData::funcToString() QString FuncSwData::funcToString()
{ {
ModelData model;
if (func >= FuncSafetyCh1 && func <= FuncSafetyCh32) 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) else if (func == FuncTrainer)
return QObject::tr("Trainer"); return QObject::tr("Trainer");
else if (func == FuncTrainerRUD) else if (func == FuncTrainerRUD)
@ -827,7 +837,8 @@ QString FuncSwData::paramToString()
} }
else if ((func==FuncVolume)|| (func==FuncPlayValue)) { else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
RawSource item(param); RawSource item(param);
return item.toString(); ModelData model;
return item.toString(model);
} }
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) { else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) { if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
@ -837,15 +848,16 @@ QString FuncSwData::paramToString()
} }
} }
else if ((func>FuncBackgroundMusicPause) && (func<FuncCount)) { else if ((func>FuncBackgroundMusicPause) && (func<FuncCount)) {
ModelData model;
switch (adjustMode) { switch (adjustMode) {
case 0: case 0:
return QObject::tr("Value ")+QString("%1").arg(param); return QObject::tr("Value ")+QString("%1").arg(param);
break; break;
case 1: case 1:
return RawSource(param).toString(); return RawSource(param).toString(model);
break; break;
case 2: case 2:
return RawSource(param).toString(); return RawSource(param).toString(model);
break; break;
case 3: case 3:
if (param==0) { if (param==0) {
@ -1047,13 +1059,6 @@ ModelData::ModelData(const ModelData & src)
ModelData & ModelData::operator = (const ModelData & src) ModelData & ModelData::operator = (const ModelData & src)
{ {
memcpy(this, &src, sizeof(ModelData)); memcpy(this, &src, sizeof(ModelData));
for (int i=0; i<C9X_MAX_MIXERS; i++)
mixData[i].srcRaw.model = this;
for (int i=0; i<C9X_MAX_EXPOS; i++)
expoData[i].srcRaw.model = this;
swashRingData.collectiveSource.model = this;
return *this; return *this;
} }
@ -1164,7 +1169,7 @@ void ModelData::setDefaultInputs(const GeneralSettings & settings)
expo->mode = INPUT_MODE_BOTH; expo->mode = INPUT_MODE_BOTH;
expo->srcRaw = settings.getDefaultSource(i); expo->srcRaw = settings.getDefaultSource(i);
expo->weight = 100; 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);
} }
} }
} }
@ -1180,7 +1185,7 @@ void ModelData::setDefaultMixes(const GeneralSettings & settings)
mix->destCh = i+1; mix->destCh = i+1;
mix->weight = 100; mix->weight = 100;
if (IS_TARANIS(GetEepromInterface()->getBoard())) { if (IS_TARANIS(GetEepromInterface()->getBoard())) {
mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, this); mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i);
} }
else { else {
mix->srcRaw = RawSource(SOURCE_TYPE_STICK, i); mix->srcRaw = RawSource(SOURCE_TYPE_STICK, i);

View file

@ -330,26 +330,24 @@ class RawSourceRange
QString unit; QString unit;
}; };
class GeneralSettings;
class RawSource { class RawSource {
public: public:
RawSource(): RawSource():
type(SOURCE_TYPE_NONE), type(SOURCE_TYPE_NONE),
index(0), index(0)
model(NULL)
{ {
} }
RawSource(int value, const ModelData * model=NULL): RawSource(int value):
type(RawSourceType(abs(value)/65536)), type(RawSourceType(abs(value)/65536)),
index(value >= 0 ? abs(value)%65536 : -(abs(value)%65536)), index(value >= 0 ? abs(value)%65536 : -(abs(value)%65536))
model(model)
{ {
} }
RawSource(RawSourceType type, int index=0, const ModelData * model=NULL): RawSource(RawSourceType type, int index=0):
type(type), type(type),
index(index), index(index)
model(model)
{ {
} }
@ -358,9 +356,9 @@ class RawSource {
return index >= 0 ? (type * 65536 + index) : -(type * 65536 - index); 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) { bool operator == ( const RawSource & other) {
return (this->type == other.type) && (this->index == other.index); return (this->type == other.type) && (this->index == other.index);
@ -377,7 +375,6 @@ class RawSource {
RawSourceType type; RawSourceType type;
int index; int index;
const ModelData * model;
}; };
enum RawSwitchType { enum RawSwitchType {
@ -717,7 +714,7 @@ class LogicalSwitchData { // Logical Switches data
CSFunctionFamily getFunctionFamily(); CSFunctionFamily getFunctionFamily();
bool isDeltaFunction(); bool isDeltaFunction();
QString funcToString(); QString funcToString();
QString toString(const ModelData & model); QString toString(const ModelData & model, const GeneralSettings & settings);
}; };
enum AssignFunc { enum AssignFunc {
@ -888,7 +885,6 @@ class FrSkyData {
FrSkyData() { clear(); } FrSkyData() { clear(); }
FrSkyChannelData channels[4]; FrSkyChannelData channels[4];
unsigned int usrProto; unsigned int usrProto;
unsigned int imperial;
int blades; int blades;
unsigned int voltsSource; unsigned int voltsSource;
bool altitudeDisplayed; bool altitudeDisplayed;
@ -1064,6 +1060,7 @@ enum Capability {
FlightModes, FlightModes,
FlightModesName, FlightModesName,
FlightModesHaveFades, FlightModesHaveFades,
Imperial,
Mixes, Mixes,
Timers, Timers,
TimeDivisions, TimeDivisions,

View file

@ -468,7 +468,6 @@ t_Er9xModelData::operator ModelData ()
c9x.frsky = frsky; c9x.frsky = frsky;
c9x.frsky.usrProto=FrSkyUsrProto; c9x.frsky.usrProto=FrSkyUsrProto;
c9x.frsky.imperial=FrSkyImperial;
c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt; c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt;
return c9x; return c9x;
} }

View file

@ -596,7 +596,6 @@ t_Ersky9xModelData_v10::operator ModelData ()
c9x.frsky = frsky; c9x.frsky = frsky;
c9x.frsky.usrProto=FrSkyUsrProto; c9x.frsky.usrProto=FrSkyUsrProto;
c9x.frsky.imperial=FrSkyImperial;
c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt; c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt;
return c9x; return c9x;
} }
@ -715,7 +714,6 @@ t_Ersky9xModelData_v11::operator ModelData ()
c9x.frsky = frsky; c9x.frsky = frsky;
c9x.frsky.usrProto=FrSkyUsrProto; c9x.frsky.usrProto=FrSkyUsrProto;
c9x.frsky.imperial=FrSkyImperial;
c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt; c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt;
// for (int i=0; i<8; i++) { // for (int i=0; i<8; i++) {
// c9x.frskyalarms[i].frskyAlarmLimit=frskyAlarms.alarmData[i].frskyAlarmLimit; // c9x.frskyalarms[i].frskyAlarmLimit=frskyAlarms.alarmData[i].frskyAlarmLimit;

View file

@ -842,7 +842,6 @@ t_Open9xFrSkyData_v204::operator FrSkyData ()
c9x.channels[0] = channels[0]; c9x.channels[0] = channels[0];
c9x.channels[1] = channels[1]; c9x.channels[1] = channels[1];
c9x.usrProto = usrProto; c9x.usrProto = usrProto;
c9x.imperial = imperial;
c9x.blades = blades+2; c9x.blades = blades+2;
c9x.screens[0].type = 1; c9x.screens[0].type = 1;
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
@ -856,7 +855,6 @@ t_Open9xFrSkyData_v205::operator FrSkyData ()
c9x.channels[0] = channels[0]; c9x.channels[0] = channels[0];
c9x.channels[1] = channels[1]; c9x.channels[1] = channels[1];
c9x.usrProto = usrProto; c9x.usrProto = usrProto;
c9x.imperial = imperial;
c9x.blades = blades+2; c9x.blades = blades+2;
c9x.screens[0].type = 1; c9x.screens[0].type = 1;
for (int i=0; i<4; i++) for (int i=0; i<4; i++)

View file

@ -1009,7 +1009,7 @@ class MixField: public TransformedField {
if (IS_TARANIS(board) && version < 216) { if (IS_TARANIS(board) && version < 216) {
if (mix.srcRaw.type == SOURCE_TYPE_STICK && mix.srcRaw.index < NUM_STICKS) { if (mix.srcRaw.type == SOURCE_TYPE_STICK && mix.srcRaw.index < NUM_STICKS) {
if (!mix.noExpo) { 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) { else if (csw.func != LS_FN_OFF) {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1); sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
csw.val2 = v2; csw.val2 = v2;
RawSource val1(csw.val1, model); RawSource val1(csw.val1);
if (IS_ARM(board) && version < 216 && val1.type == SOURCE_TYPE_TELEMETRY) { if (IS_ARM(board) && version < 216 && val1.type == SOURCE_TYPE_TELEMETRY) {
switch (val1.index) { switch (val1.index) {
case TELEMETRY_SOURCE_TIMER1: case TELEMETRY_SOURCE_TIMER1:

View file

@ -468,6 +468,11 @@ FirmwareInterface * OpenTxFirmware::getFirmwareVariant(const QString & id)
int OpenTxFirmware::getCapability(const Capability capability) int OpenTxFirmware::getCapability(const Capability capability)
{ {
switch (capability) { switch (capability) {
case Imperial:
if (IS_ARM(board))
return 0;
else
return id.contains("imperial") ? 1 : 0;
case ModelImage: case ModelImage:
if (IS_TARANIS(board)) if (IS_TARANIS(board))
return 1; return 1;

View file

@ -72,7 +72,7 @@ QString getInputStr(ModelData & model, int index)
} }
} }
else { else {
result = RawSource(SOURCE_TYPE_STICK, index).toString(); result = RawSource(SOURCE_TYPE_STICK, index).toString(model);
} }
return result; return result;
@ -553,7 +553,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_SOURCES) { if (flags & POPULATE_SOURCES) {
item = RawSource(SOURCE_TYPE_NONE); 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); 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); int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
for (int i=0; i<virtualInputs; i++) { for (int i=0; i<virtualInputs; i++) {
if (model.isInputValid(i)) { if (model.isInputValid(i)) {
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, &model); item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); 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) { if (flags & POPULATE_SOURCES) {
for (int i=0; i<4+GetCurrentFirmware()->getCapability(Pots); i++) { for (int i=0; i<4+GetCurrentFirmware()->getCapability(Pots); i++) {
item = RawSource(SOURCE_TYPE_STICK, 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); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, 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); 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) { if (flags & POPULATE_TRIMS) {
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
item = RawSource(SOURCE_TYPE_TRIM, 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 (item == source) b->setCurrentIndex(b->count()-1);
} }
} }
if (flags & POPULATE_SOURCES) { if (flags & POPULATE_SOURCES) {
item = RawSource(SOURCE_TYPE_MAX); 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 (item == source) b->setCurrentIndex(b->count()-1);
} }
if (flags & POPULATE_SWITCHES) { if (flags & POPULATE_SWITCHES) {
for (int i=0; i<GetCurrentFirmware()->getCapability(Switches); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Switches); i++) {
item = RawSource(SOURCE_TYPE_SWITCH, 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); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, 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); 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) { if (flags & POPULATE_SOURCES) {
for (int i=0; i<NUM_CYC; i++) { for (int i=0; i<NUM_CYC; i++) {
item = RawSource(SOURCE_TYPE_CYC, i); item = RawSource(SOURCE_TYPE_CYC, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetCurrentFirmware()->getCapability(TrainerInputs); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(TrainerInputs); i++) {
item = RawSource(SOURCE_TYPE_PPM, 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); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
item = RawSource(SOURCE_TYPE_CH, 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); 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())) if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(GetCurrentFirmware()->getBoard()))
continue; continue;
item = RawSource(SOURCE_TYPE_TELEMETRY, i); 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); 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())) if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(GetCurrentFirmware()->getBoard()))
continue; continue;
item = RawSource(SOURCE_TYPE_TELEMETRY, i); 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); 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) { if (flags & POPULATE_GVARS) {
for (int i=0; i<GetCurrentFirmware()->getCapability(Gvars); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Gvars); i++) {
item = RawSource(SOURCE_TYPE_GVAR, 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); if (item == source) b->setCurrentIndex(b->count()-1);
} }
} }
@ -777,7 +777,8 @@ QString getFrSkyMeasure(int units)
QString getFrSkySrc(int index) 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) QString getTrimInc(ModelData * g_model)

View file

@ -122,7 +122,7 @@ ExpoDialog::~ExpoDialog()
void ExpoDialog::updateScale() void ExpoDialog::updateScale()
{ {
if (firmware->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) { 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->scaleLabel->show();
ui->scale->show(); ui->scale->show();
ui->scale->setDecimals(range.decimals); ui->scale->setDecimals(range.decimals);
@ -146,7 +146,7 @@ void ExpoDialog::valuesChanged()
updateScale(); updateScale();
} }
RawSourceRange range = srcRaw.getRange(); RawSourceRange range = srcRaw.getRange(model, generalSettings);
ed->scale = round(float(ui->scale->value()) / range.step); ed->scale = round(float(ui->scale->value()) / range.step);
ed->carryTrim = 1 - ui->trimCB->currentIndex(); ed->carryTrim = 1 - ui->trimCB->currentIndex();
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt()); ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());

View file

@ -165,12 +165,12 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
if (md->offset) str += " " + tr("Offset(%1)").arg(getGVarString(md->offset)); if (md->offset) str += " " + tr("Offset(%1)").arg(getGVarString(md->offset));
if (firmware->getCapability(VirtualInputs)) { 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) { if (md->carryTrim>0) {
str += " " + tr("NoTrim"); str += " " + tr("NoTrim");
} }
else if (md->carryTrim<0) { else if (md->carryTrim<0) {
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(); str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
} }
} }

View file

@ -138,8 +138,8 @@ void LogicalSwitchesPanel::v1Edited(int value)
int i = sender()->property("index").toInt(); int i = sender()->property("index").toInt();
model.customSw[i].val1 = cswitchSource1[i]->itemData(value).toInt(); model.customSw[i].val1 = cswitchSource1[i]->itemData(value).toInt();
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_VOFS) { if (model.customSw[i].getFunctionFamily() == LS_FAMILY_VOFS) {
RawSource source = RawSource(model.customSw[i].val1, &model); RawSource source = RawSource(model.customSw[i].val1);
RawSourceRange range = source.getRange(); RawSourceRange range = source.getRange(model, generalSettings);
if (model.customSw[i].isDeltaFunction()) { if (model.customSw[i].isDeltaFunction()) {
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step); model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
} }
@ -220,8 +220,8 @@ void LogicalSwitchesPanel::edited()
{ {
case LS_FAMILY_VOFS: case LS_FAMILY_VOFS:
{ {
source = RawSource(model.customSw[i].val1, &model); source = RawSource(model.customSw[i].val1);
RawSourceRange range = source.getRange(); RawSourceRange range = source.getRange(model, generalSettings);
int value = source.isTimeBased() ? QTimeS(cswitchTOffset[i]->time()).seconds() : cswitchOffset[i]->value(); int value = source.isTimeBased() ? QTimeS(cswitchTOffset[i]->time()).seconds() : cswitchOffset[i]->value();
if (model.customSw[i].isDeltaFunction()) { if (model.customSw[i].isDeltaFunction()) {
/*TODO: is this delta function value set correctly*/ /*TODO: is this delta function value set correctly*/
@ -290,8 +290,8 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
lock = true; lock = true;
unsigned int mask = 0; unsigned int mask = 0;
RawSource source = RawSource(model.customSw[i].val1, &model); RawSource source = RawSource(model.customSw[i].val1);
RawSourceRange range = source.getRange(); RawSourceRange range = source.getRange(model, generalSettings);
switch (model.customSw[i].getFunctionFamily()) switch (model.customSw[i].getFunctionFamily())
{ {

View file

@ -142,7 +142,7 @@ void MixerDialog::valuesChanged()
if (!lock) { if (!lock) {
lock = true; 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 }; 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)) { if (firmware->getCapability(HasNoExpo)) {
bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < NUM_STICKS); bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < NUM_STICKS);
ui->MixDR_CB->setEnabled(drVisible); ui->MixDR_CB->setEnabled(drVisible);

View file

@ -170,16 +170,12 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
default: str += " "; 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 = &model;
// highlight source if needed // highlight source if needed
if ( (md->srcRaw.type == SOURCE_TYPE_CH) && (md->srcRaw.index+1 == (int)highlightedSource) ) { if ( (md->srcRaw.type == SOURCE_TYPE_CH) && (md->srcRaw.index+1 == (int)highlightedSource) ) {
str += " <b>" + Qt::escape(md->srcRaw.toString()) + "</b>"; str += " <b>" + Qt::escape(md->srcRaw.toString(model)) + "</b>";
} }
else { 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))); 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")); 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 (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))); if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));

View file

@ -335,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}; 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->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++) { 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)) { if (!firmware->isTelemetrySourceAvailable(i)) {
//disable item //disable item
QModelIndex index = b->model()->index(i+1, 0); QModelIndex index = b->model()->index(i+1, 0);
@ -407,8 +407,8 @@ void TelemetryCustomScreen::updateBar(int line)
int index = screen.body.bars[line].source; int index = screen.body.bars[line].source;
barsCB[line]->setCurrentIndex(index); barsCB[line]->setCurrentIndex(index);
if (index) { if (index) {
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1, &model); RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1);
RawSourceRange range = source.getRange(true); RawSourceRange range = source.getRange(model, generalSettings, true);
int max = round((range.max - range.min) / range.step); int max = round((range.max - range.min) / range.step);
if (int(255-screen.body.bars[line].barMax) > max) if (int(255-screen.body.bars[line].barMax) > max)
screen.body.bars[line].barMax = 255 - max; screen.body.bars[line].barMax = 255 - max;
@ -619,15 +619,6 @@ void TelemetryPanel::setup()
ui->altimetryGB->setVisible(firmware->getCapability(HasAltitudeSel) || firmware->getCapability(HasVario)), ui->altimetryGB->setVisible(firmware->getCapability(HasAltitudeSel) || firmware->getCapability(HasVario)),
ui->frskyProtoCB->setDisabled(firmware->getCapability(NoTelemetryProtocol)); ui->frskyProtoCB->setDisabled(firmware->getCapability(NoTelemetryProtocol));
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")); ui->frskyProtoCB->addItem(tr("Winged Shadow How High"));
} }
@ -662,7 +653,6 @@ void TelemetryPanel::setup()
} }
ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto); ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto);
ui->frskyUnitsCB->setCurrentIndex(model.frsky.imperial);
ui->bladesCount->setValue(model.frsky.blades); ui->bladesCount->setValue(model.frsky.blades);
populateVoltsSource(); populateVoltsSource();
@ -727,12 +717,6 @@ void TelemetryPanel::onAnalogModified()
emit modified(); emit modified();
} }
void TelemetryPanel::on_frskyUnitsCB_currentIndexChanged(int index)
{
model.frsky.imperial = index;
emit modified();
}
void TelemetryPanel::on_bladesCount_editingFinished() void TelemetryPanel::on_bladesCount_editingFinished()
{ {
model.frsky.blades = ui->bladesCount->value(); model.frsky.blades = ui->bladesCount->value();

View file

@ -86,7 +86,6 @@ class TelemetryPanel : public ModelPanel
void on_telemetryProtocol_currentIndexChanged(int index); void on_telemetryProtocol_currentIndexChanged(int index);
void onAnalogModified(); void onAnalogModified();
void on_frskyProtoCB_currentIndexChanged(int index); void on_frskyProtoCB_currentIndexChanged(int index);
void on_frskyUnitsCB_currentIndexChanged(int index);
void on_bladesCount_editingFinished(); void on_bladesCount_editingFinished();
void on_AltitudeToolbar_ChkB_toggled(bool checked); void on_AltitudeToolbar_ChkB_toggled(bool checked);
void on_rssiAlarm1CB_currentIndexChanged(int index); void on_rssiAlarm1CB_currentIndexChanged(int index);

View file

@ -61,7 +61,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0">
<item row="1" column="0"> <item row="1" column="0">
<widget class="QGroupBox" name="A1GB"> <widget class="QGroupBox" name="A1GB">
<property name="sizePolicy"> <property name="sizePolicy">
@ -188,221 +188,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QGroupBox" name="serialGB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_34" columnstretch="0,1,1,1">
<property name="horizontalSpacing">
<number>9</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Volt source</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="frskyUnitsCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Metric</string>
</property>
</item>
<item>
<property name="text">
<string>Imperial</string>
</property>
</item>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="current_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Current source</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_112">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Protocol</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QUnsignedAutoComboBox" name="frskyCurrentCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="frskyProtoCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>FrSky Sensor Hub</string>
</property>
</item>
</widget>
</item>
<item row="3" column="1">
<widget class="QUnsignedAutoComboBox" name="frskyVoltCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_113">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Units</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="blades_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Blades</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Serial Protocol</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="bladesCount">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>5.000000000000000</double>
</property>
<property name="value">
<double>2.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QGroupBox" name="A2GB"> <widget class="QGroupBox" name="A2GB">
<property name="flat"> <property name="flat">
@ -738,21 +523,121 @@
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1"> <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0">
<property name="horizontalSpacing"> <property name="horizontalSpacing">
<number>3</number> <number>3</number>
</property> </property>
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>0</number> <number>0</number>
</property> </property>
<item row="1" column="2"> <item row="3" column="1">
<widget class="QUnsignedAutoComboBox" name="frskyVoltCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Volt source</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QUnsignedAutoComboBox" name="frskyCurrentCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="5">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QLabel" name="current_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Current source</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="bladesCount">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>5.000000000000000</double>
</property>
<property name="value">
<double>2.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="blades_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Blades</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="mahCount_label"> <widget class="QLabel" name="mahCount_label">
<property name="text"> <property name="text">
<string>mAh count</string> <string>mAh count</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="3"> <item row="2" column="3">
<widget class="QSpinBox" name="mahCount_SB"> <widget class="QSpinBox" name="mahCount_SB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@ -768,7 +653,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QDoubleSpinBox" name="fasOffset_DSB"> <widget class="QDoubleSpinBox" name="fasOffset_DSB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@ -793,7 +678,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="fasOffset_label"> <widget class="QLabel" name="fasOffset_label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@ -806,26 +691,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item row="2" column="4">
<widget class="QCheckBox" name="mahCount_ChkB"> <widget class="QCheckBox" name="mahCount_ChkB">
<property name="text"> <property name="text">
<string>Persistent mAh</string> <string>Persistent mAh</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="5">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="sizePolicy"> <property name="sizePolicy">
@ -845,6 +717,39 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Serial Protocol</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="frskyProtoCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>FrSky Sensor Hub</string>
</property>
</item>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">

View file

@ -238,9 +238,9 @@ void PrintDialog::printInputs()
str += "&nbsp;" + tr("Weight") + QString("(%1)").arg(getGVarString(ed->weight,true)); str += "&nbsp;" + tr("Weight") + QString("(%1)").arg(getGVarString(ed->weight,true));
if (firmware->getCapability(VirtualInputs)) { 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"); 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()); if (ed->curve.value) str += " " + Qt::escape(ed->curve.toString());
@ -321,11 +321,8 @@ void PrintDialog::printMixes()
case (2): str += "&nbsp;R"; break; case (2): str += "&nbsp;R"; break;
default: str += "&nbsp;&nbsp;"; break; default: str += "&nbsp;&nbsp;"; 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))); str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(md->weight, true)));
QString phasesStr = getPhasesStr(md->phases, *g_model); QString phasesStr = getPhasesStr(md->phases, *g_model);
@ -335,8 +332,10 @@ void PrintDialog::printMixes()
str += " " + Qt::escape(tr("Switch(%1)").arg(md->swtch.toString())); str += " " + Qt::escape(tr("Switch(%1)").arg(md->swtch.toString()));
} }
if (md->carryTrim>0) str += " " + Qt::escape(tr("NoTrim")); if (md->carryTrim>0)
else if (md->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(); 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 (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))); 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)); str += Qt::escape(tr(" Delay(u%1:d%2)").arg((double)md->delayUp/scale).arg((double)md->delayDown/scale));
if (md->speedDown || md->speedUp) if (md->speedDown || md->speedUp)
str += Qt::escape(tr(" Slow(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale)); 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)) { if (firmware->getCapability(HasMixerNames)) {
QString MixerName; QString MixerName;
MixerName.append(md->name); MixerName.append(md->name);
@ -588,7 +588,7 @@ void PrintDialog::printSwitches()
if (g_model->customSw[i].func) { if (g_model->customSw[i].func) {
str.append("<tr>"); str.append("<tr>");
str.append("<td width=\"60\"><b>"+tr("L")+QString("%1</b></td>").arg(i+1)); str.append("<td width=\"60\"><b>"+tr("L")+QString("%1</b></td>").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(doTL(tstr,"green"));
str.append("</tr>"); str.append("</tr>");
sc++; sc++;
@ -754,7 +754,6 @@ void PrintDialog::printFrSky()
str.append("<td width=\"40\" align=\"center\"><b>"+getFrSkyAlarmType(fd->rssiAlarms[1].level)+"</b></td><td width=\"40\" align=\"center\"><b>&lt;</b></td><td width=\"40\" align=\"center\"><b>"+QString::number(fd->rssiAlarms[1].value,10)+"</b></td></tr>"); str.append("<td width=\"40\" align=\"center\"><b>"+getFrSkyAlarmType(fd->rssiAlarms[1].level)+"</b></td><td width=\"40\" align=\"center\"><b>&lt;</b></td><td width=\"40\" align=\"center\"><b>"+QString::number(fd->rssiAlarms[1].value,10)+"</b></td></tr>");
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr>"); str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Frsky serial protocol")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyProtocol(fd->usrProto)+"</td></tr>"); str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Frsky serial protocol")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyProtocol(fd->usrProto)+"</td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Units system")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyMeasure(fd->imperial)+"</td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Blades")+"</b></td><td colspan=8 align=\"left\">"+fd->blades+"</td></tr>"); str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Blades")+"</b></td><td colspan=8 align=\"left\">"+fd->blades+"</td></tr>");
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>"); str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>");
} }

View file

@ -361,7 +361,8 @@ void SimulatorDialog::initUi(T * ui)
int column = i / (outputs/2); int column = i / (outputs/2);
int line = i % (outputs/2); int line = i % (outputs/2);
QLabel * label = new QLabel(tabWidget); 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); channelsLayout->addWidget(label, line, column == 0 ? 0 : 5, 1, 1);
QSlider * slider = new QSlider(tabWidget); QSlider * slider = new QSlider(tabWidget);

View file

@ -60,7 +60,7 @@ void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int
mix.destCh = channel+1; mix.destCh = channel+1;
if (isTaranis){ if (isTaranis){
int channel = settings.getDefaultChannel(input-1); int channel = settings.getDefaultChannel(input-1);
mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, channel, &model); mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, channel);
} }
else else
mix.srcRaw = RawSource(SOURCE_TYPE_STICK, input-1); mix.srcRaw = RawSource(SOURCE_TYPE_STICK, input-1);