Merge branch 'next-upstream'

This commit is contained in:
Damjan Adamic
2014-06-19 15:40:02 +02:00
26 changed files with 372 additions and 424 deletions
+5 -4
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);
+1
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;
+73 -41
View File
@@ -1,5 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <list> #include <list>
#include <float.h>
#include "eeprominterface.h" #include "eeprominterface.h"
#include "firmwares/er9x/er9xinterface.h" #include "firmwares/er9x/er9xinterface.h"
#include "firmwares/th9x/th9xinterface.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; 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;
@@ -103,11 +105,16 @@ RawSourceRange RawSource::getRange(bool singleprec)
switch (type) { switch (type) {
case SOURCE_TYPE_TELEMETRY: case SOURCE_TYPE_TELEMETRY:
if (singleprec) {
result.offset = -DBL_MAX;
}
switch (index) { switch (index) {
case TELEMETRY_SOURCE_TX_BATT: case TELEMETRY_SOURCE_TX_BATT:
result.step = 0.1; result.step = 0.1;
result.decimals = 1; result.decimals = 1;
result.max = 25.5; result.max = 25.5;
result.unit = QObject::tr("V");
break; break;
case TELEMETRY_SOURCE_TX_TIME: case TELEMETRY_SOURCE_TX_TIME:
result.step = 1; result.step = 1;
@@ -117,6 +124,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_TIMER2: case TELEMETRY_SOURCE_TIMER2:
result.step = singleprec ? 5 : 1; result.step = singleprec ? 5 : 1;
result.max = singleprec ? 255*5 : 60*60; result.max = singleprec ? 255*5 : 60*60;
result.unit = QObject::tr("s");
break; break;
case TELEMETRY_SOURCE_RSSI_TX: case TELEMETRY_SOURCE_RSSI_TX:
case TELEMETRY_SOURCE_RSSI_RX: case TELEMETRY_SOURCE_RSSI_RX:
@@ -127,23 +135,33 @@ 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;
else else
result.decimals = 0; result.decimals = 0;
result.step = ratio / 255; result.step = ratio / 255;
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");
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");
}
break; break;
case TELEMETRY_SOURCE_T1: case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T1_MAX: case TELEMETRY_SOURCE_T1_MAX:
@@ -151,11 +169,13 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_T2_MAX: case TELEMETRY_SOURCE_T2_MAX:
result.min = -30; result.min = -30;
result.max = 225; result.max = 225;
result.unit = QObject::tr("°C");
break; break;
case TELEMETRY_SOURCE_HDG: case TELEMETRY_SOURCE_HDG:
result.step = singleprec ? 2 : 1; result.step = singleprec ? 2 : 1;
result.max = 360; result.max = 360;
if (singleprec) result.offset = 256; if (singleprec) result.offset = 256;
result.unit = QObject::tr("°");
break; break;
case TELEMETRY_SOURCE_RPM: case TELEMETRY_SOURCE_RPM:
case TELEMETRY_SOURCE_RPM_MAX: case TELEMETRY_SOURCE_RPM_MAX:
@@ -164,14 +184,21 @@ RawSourceRange RawSource::getRange(bool singleprec)
break; break;
case TELEMETRY_SOURCE_FUEL: case TELEMETRY_SOURCE_FUEL:
result.max = 100; result.max = 100;
result.unit = QObject::tr("%");
break; break;
case TELEMETRY_SOURCE_ASPEED:
case TELEMETRY_SOURCE_ASPEED_MAX:
case TELEMETRY_SOURCE_SPEED: case TELEMETRY_SOURCE_SPEED:
case TELEMETRY_SOURCE_SPEED_MAX: case TELEMETRY_SOURCE_SPEED_MAX:
result.step = singleprec ? 4 : 1; result.step = singleprec ? 2 : 1;
result.max = singleprec ? (4*236) : 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");
} }
break; break;
case TELEMETRY_SOURCE_VERTICAL_SPEED: case TELEMETRY_SOURCE_VERTICAL_SPEED:
@@ -179,17 +206,20 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.min = -12.5; result.min = -12.5;
result.max = 13.0; result.max = 13.0;
result.decimals = 1; result.decimals = 1;
result.unit = QObject::tr("m/s");
break; break;
case TELEMETRY_SOURCE_DIST: case TELEMETRY_SOURCE_DIST:
case TELEMETRY_SOURCE_DIST_MAX: case TELEMETRY_SOURCE_DIST_MAX:
result.step = singleprec ? 8 : 1; result.step = singleprec ? 8 : 1;
result.max = singleprec ? 2040 : 10000; result.max = singleprec ? 2040 : 10000;
result.unit = QObject::tr("m");
break; break;
case TELEMETRY_SOURCE_CELL: case TELEMETRY_SOURCE_CELL:
case TELEMETRY_SOURCE_CELL_MIN: case TELEMETRY_SOURCE_CELL_MIN:
result.step = singleprec ? 0.02 : 0.01; result.step = singleprec ? 0.02 : 0.01;
result.max = 5.1; result.max = 5.1;
result.decimals = 2; result.decimals = 2;
result.unit = QObject::tr("V");
break; break;
case TELEMETRY_SOURCE_CELLS_SUM: case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_CELLS_MIN: case TELEMETRY_SOURCE_CELLS_MIN:
@@ -198,21 +228,25 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.step = 0.1; result.step = 0.1;
result.max = 25.5; result.max = 25.5;
result.decimals = 1; result.decimals = 1;
result.unit = QObject::tr("V");
break; break;
case TELEMETRY_SOURCE_CURRENT: case TELEMETRY_SOURCE_CURRENT:
case TELEMETRY_SOURCE_CURRENT_MAX: case TELEMETRY_SOURCE_CURRENT_MAX:
result.step = singleprec ? 0.5 : 0.1; result.step = singleprec ? 0.5 : 0.1;
result.max = singleprec ? 127.5 : 200.0; result.max = singleprec ? 127.5 : 200.0;
result.decimals = 1; result.decimals = 1;
result.unit = QObject::tr("A");
break; break;
case TELEMETRY_SOURCE_CONSUMPTION: case TELEMETRY_SOURCE_CONSUMPTION:
result.step = singleprec ? 100 : 1; result.step = singleprec ? 100 : 1;
result.max = singleprec ? 25500 : 10000; result.max = singleprec ? 25500 : 10000;
result.unit = QObject::tr("mAh");
break; break;
case TELEMETRY_SOURCE_POWER: case TELEMETRY_SOURCE_POWER:
case TELEMETRY_SOURCE_POWER_MAX: case TELEMETRY_SOURCE_POWER_MAX:
result.step = singleprec ? 5 : 1; result.step = singleprec ? 5 : 1;
result.max = singleprec ? 1275 : 2000; result.max = singleprec ? 1275 : 2000;
result.unit = QObject::tr("W");
break; break;
case TELEMETRY_SOURCE_ACCX: case TELEMETRY_SOURCE_ACCX:
case TELEMETRY_SOURCE_ACCY: case TELEMETRY_SOURCE_ACCY:
@@ -220,19 +254,21 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.step = 0.01; result.step = 0.01;
result.decimals = 2; result.decimals = 2;
result.max = 2.55; result.max = 2.55;
result.unit = QObject::tr("g");
break; break;
default: default:
result.max = 125; result.max = 125;
break; break;
} }
if (singleprec && !result.offset) {
if (singleprec && result.offset==-DBL_MAX) {
result.offset = result.max - (127*result.step); result.offset = result.max - (127*result.step);
} }
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;
} }
@@ -257,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")
@@ -292,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;
} }
@@ -514,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 = "";
@@ -535,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(" ");
@@ -582,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) {
@@ -610,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;
@@ -720,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)
@@ -800,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)) {
@@ -810,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) {
@@ -1020,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;
} }
@@ -1137,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);
} }
} }
} }
@@ -1153,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);
+12 -15
View File
@@ -252,7 +252,7 @@ enum TelemetrySource {
TELEMETRY_SOURCE_ACCZ, TELEMETRY_SOURCE_ACCZ,
TELEMETRY_SOURCE_HDG, TELEMETRY_SOURCE_HDG,
TELEMETRY_SOURCE_VERTICAL_SPEED, TELEMETRY_SOURCE_VERTICAL_SPEED,
TELEMETRY_SOURCE_ASPD, TELEMETRY_SOURCE_ASPEED,
TELEMETRY_SOURCE_DTE, TELEMETRY_SOURCE_DTE,
TELEMETRY_SOURCE_A1_MIN, TELEMETRY_SOURCE_A1_MIN,
TELEMETRY_SOURCE_A2_MIN, TELEMETRY_SOURCE_A2_MIN,
@@ -327,29 +327,27 @@ class RawSourceRange
double max; double max;
double step; double step;
double offset; double offset;
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,
@@ -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;
} }
@@ -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;
@@ -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++)
@@ -46,6 +46,8 @@
#define GPS #define GPS
#define FAI_CHOICE #define FAI_CHOICE
#define FRSKY_STICKS #define FRSKY_STICKS
#define DSM2
#define DSM2_PPM
#define EEPROM_VARIANT SIMU_M128_VARIANTS #define EEPROM_VARIANT SIMU_M128_VARIANTS
#define GAUGES #define GAUGES
@@ -260,7 +260,7 @@ class SourcesConversionTable: public ConversionTable {
for (int i=0; i<TELEMETRY_SOURCE_ACC; i++) { for (int i=0; i<TELEMETRY_SOURCE_ACC; i++) {
if (version < 216) { if (version < 216) {
if (i==TELEMETRY_SOURCE_TX_TIME || i==TELEMETRY_SOURCE_SWR || i==TELEMETRY_SOURCE_A3 || i==TELEMETRY_SOURCE_A4 || i==TELEMETRY_SOURCE_ASPD || i==TELEMETRY_SOURCE_DTE || i==TELEMETRY_SOURCE_CELL_MIN || i==TELEMETRY_SOURCE_CELLS_MIN || i==TELEMETRY_SOURCE_VFAS_MIN) if (i==TELEMETRY_SOURCE_TX_TIME || i==TELEMETRY_SOURCE_SWR || i==TELEMETRY_SOURCE_A3 || i==TELEMETRY_SOURCE_A4 || i==TELEMETRY_SOURCE_ASPEED || i==TELEMETRY_SOURCE_DTE || i==TELEMETRY_SOURCE_CELL_MIN || i==TELEMETRY_SOURCE_CELLS_MIN || i==TELEMETRY_SOURCE_VFAS_MIN)
continue; continue;
} }
if (!IS_ARM(board)) { if (!IS_ARM(board)) {
@@ -443,7 +443,7 @@ class TelemetrySourcesConversionTable: public ConversionTable {
addConversion(1+TELEMETRY_SOURCE_HDG, val++); addConversion(1+TELEMETRY_SOURCE_HDG, val++);
addConversion(1+TELEMETRY_SOURCE_VERTICAL_SPEED, val++); addConversion(1+TELEMETRY_SOURCE_VERTICAL_SPEED, val++);
if (version >= 216) { if (version >= 216) {
addConversion(1+TELEMETRY_SOURCE_ASPD, val++); addConversion(1+TELEMETRY_SOURCE_ASPEED, val++);
addConversion(1+TELEMETRY_SOURCE_DTE, val++); addConversion(1+TELEMETRY_SOURCE_DTE, val++);
} }
if (IS_ARM(board) && version >= 216) { if (IS_ARM(board) && version >= 216) {
@@ -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:
@@ -2424,7 +2424,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_ARM(board)) if (IS_ARM(board))
internalField.Append(new UnsignedField<3>(modelData.telemetryProtocol)); internalField.Append(new UnsignedField<3>(modelData.telemetryProtocol));
else 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)); internalField.Append(new BoolField<1>(modelData.thrTrim));
@@ -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;
+19 -18
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;
@@ -158,7 +158,7 @@ GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightC
} }
else { else {
weightGV->hide(); weightGV->hide();
if (weight > maxi || weight < -mini) { if (weight > maxi || weight < mini) {
weight = deflt; weight = deflt;
} }
} }
@@ -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)
+2 -2
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());
+2 -2
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);
} }
} }
+16 -10
View File
@@ -138,13 +138,13 @@ 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);
} }
else { 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); setSwitchWidgetVisibility(i);
} }
@@ -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);
double value = source.isTimeBased() ? QTimeS(cswitchTOffset[i]->time()).seconds() : cswitchOffset[i]->value(); double 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*/
@@ -230,10 +230,12 @@ void LogicalSwitchesPanel::edited()
} }
else { else {
model.customSw[i].val2 = round((value-range.offset)/range.step);; 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))); if (source.isTimeBased())
else cswitchOffset[i]->setValue(value); cswitchTOffset[i]->setTime(QTimeS(round(value)));
else
cswitchOffset[i]->setValue(value);
break; break;
} }
case LS_FAMILY_TIMER: case LS_FAMILY_TIMER:
@@ -288,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())
{ {
@@ -316,6 +318,10 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
} }
else { else {
mask |= VALUE2_VISIBLE; mask |= VALUE2_VISIBLE;
if (range.unit.isEmpty())
cswitchOffset[i]->setSuffix("");
else
cswitchOffset[i]->setSuffix(" " + range.unit);
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*/
cswitchOffset[i]->setMinimum(range.step*-127); cswitchOffset[i]->setMinimum(range.step*-127);
+1 -1
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);
+4 -8
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) // highlight source if needed
if (md->srcRaw.model == 0)
md->srcRaw.model = &model;
//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)));
+22 -34
View File
@@ -168,7 +168,8 @@ void TelemetryAnalog::on_RatioSB_editingFinished()
if (calib<0) { if (calib<0) {
if (calib<((ratio*-128)/255)) { if (calib<((ratio*-128)/255)) {
analog.offset=-128; analog.offset=-128;
} else { }
else {
analog.offset=round(calib*255/ratio); analog.offset=round(calib*255/ratio);
} }
} }
@@ -294,7 +295,6 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) { for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c] = new QComboBox(this); fieldsCB[l][c] = new QComboBox(this);
fieldsCB[l][c]->setProperty("index", c + (l<<8)); 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); ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int))); 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++) { for (int l=0; l<4; l++) {
barsCB[l] = new QComboBox(this); barsCB[l] = new QComboBox(this);
barsCB[l]->setProperty("index", l); 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))); connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1); 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}; 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);
@@ -375,6 +374,16 @@ void TelemetryCustomScreen::update()
ui->screenNums->setVisible(screen.type == 0); ui->screenNums->setVisible(screen.type == 0);
ui->screenBars->setVisible(screen.type != 0); ui->screenBars->setVisible(screen.type != 0);
for (int l=0; l<4; l++) {
for (int c=0; c<firmware->getCapability(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) { if (screen.type == 0) {
for (int l=0; l<4; l++) { for (int l=0; l<4; l++) {
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) { for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
@@ -398,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;
@@ -519,6 +528,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++) { for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++) {
TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings, firmware); TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings, firmware);
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1)); ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
telemetryCustomScreens[i] = tab;
} }
if (IS_ARM(GetEepromInterface()->getBoard())) { if (IS_ARM(GetEepromInterface()->getBoard())) {
@@ -606,27 +616,10 @@ void TelemetryPanel::setup()
} }
} }
if (!(firmware->getCapability(HasAltitudeSel)||firmware->getCapability(HasVario))) { ui->altimetryGB->setVisible(firmware->getCapability(HasAltitudeSel) || firmware->getCapability(HasVario)),
ui->altimetryGB->hide(); ui->frskyProtoCB->setDisabled(firmware->getCapability(NoTelemetryProtocol));
}
if (firmware->getCapability(NoTelemetryProtocol)) { if (firmware->getCapability(Telemetry) & TM_HASWSHH) {
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)) {
ui->frskyProtoCB->addItem(tr("Winged Shadow How High")); ui->frskyProtoCB->addItem(tr("Winged Shadow How High"));
} }
else { else {
@@ -660,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();
@@ -725,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();
@@ -740,6 +726,8 @@ void TelemetryPanel::on_bladesCount_editingFinished()
void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index) void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index)
{ {
model.frsky.usrProto = index; model.frsky.usrProto = index;
for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++)
telemetryCustomScreens[i]->update();
emit modified(); emit modified();
} }
+1 -1
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);
@@ -106,6 +105,7 @@ class TelemetryPanel : public ModelPanel
private: private:
Ui::Telemetry *ui; Ui::Telemetry *ui;
TelemetryAnalog * analogs[4]; TelemetryAnalog * analogs[4];
TelemetryCustomScreen * telemetryCustomScreens[4];
void setup(); void setup();
void telBarUpdate(); void telBarUpdate();
+140 -235
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">
+10 -11
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>");
} }
+2 -1
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);
+1 -1
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);
+14 -14
View File
@@ -155,6 +155,19 @@ const char * audioFilenames[] = {
"eeformat", "eeformat",
"lowbatt", "lowbatt",
"inactiv", "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) #if defined(PCBSKY9X)
"highmah", "highmah",
"hightemp", "hightemp",
@@ -189,20 +202,7 @@ const char * audioFilenames[] = {
"timer00", "timer00",
"timer10", "timer10",
"timer20", "timer20",
"timer30", "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"
}; };
uint64_t sdAvailableSystemAudioFiles = 0; uint64_t sdAvailableSystemAudioFiles = 0;
+11 -1
View File
@@ -1350,7 +1350,17 @@ void menuModelSetup(uint8_t event)
lcd_putsLeft(y, STR_BEEPCTR); lcd_putsLeft(y, STR_BEEPCTR);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++) { for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++) {
// TODO flash saving, \001 not needed in STR_RETA123 // TODO flash saving, \001 not needed in STR_RETA123
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+i*FW, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<<i)) || (attr && m_posHorz<0)) ? INVERS : 0 ) ); uint8_t x = MODEL_SETUP_2ND_COLUMN+i*FW;
#if defined(PCBTARANIS) && !defined(REVPLUS)
if (i == POT3) {
if (m_posHorz == POT3) REPEAT_LAST_CURSOR_MOVE();
continue;
}
else if (i > POT3) {
x -= FW;
}
#endif
lcd_putsiAtt(x, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<<i)) || (attr && m_posHorz<0)) ? INVERS : 0 ) );
} }
if (attr && CURSOR_ON_CELL) { if (attr && CURSOR_ON_CELL) {
if (event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff) { if (event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff) {
+9
View File
@@ -745,6 +745,11 @@ ls_telemetry_value_t maxTelemValue(uint8_t channel)
case TELEM_HDG: case TELEM_HDG:
return 180; return 180;
#if defined(CPUARM) #if defined(CPUARM)
case TELEM_SPEED:
case TELEM_MAX_SPEED:
case TELEM_ASPEED:
case TELEM_MAX_ASPEED:
return 2000;
default: default:
return 30000; return 30000;
#else #else
@@ -813,6 +818,10 @@ getvalue_t convert8bitsTelemValue(uint8_t channel, ls_telemetry_value_t value)
break; break;
case TELEM_CELL: case TELEM_CELL:
case TELEM_HDG: case TELEM_HDG:
case TELEM_ASPEED:
case TELEM_MAX_ASPEED:
case TELEM_SPEED:
case TELEM_MAX_SPEED:
result = value * 2; result = value * 2;
break; break;
case TELEM_DIST: case TELEM_DIST:
+15 -15
View File
@@ -1318,6 +1318,21 @@ enum AUDIO_SOUNDS {
#endif #endif
AU_TX_BATTERY_LOW, AU_TX_BATTERY_LOW,
AU_INACTIVITY, AU_INACTIVITY,
#if defined(CPUARM)
AU_A1_ORANGE,
AU_A1_RED,
AU_A2_ORANGE,
AU_A2_RED,
AU_A3_ORANGE,
AU_A3_RED,
AU_A4_ORANGE,
AU_A4_RED,
AU_RSSI_ORANGE,
AU_RSSI_RED,
AU_SWR_RED,
AU_TELEMETRY_LOST,
AU_TELEMETRY_BACK,
#endif
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
AU_TX_MAH_HIGH, AU_TX_MAH_HIGH,
AU_TX_TEMP_HIGH, AU_TX_TEMP_HIGH,
@@ -1361,21 +1376,6 @@ enum AUDIO_SOUNDS {
AU_TIMER_LT10, AU_TIMER_LT10,
AU_TIMER_20, AU_TIMER_20,
AU_TIMER_30, AU_TIMER_30,
#if defined(CPUARM)
AU_A1_ORANGE,
AU_A1_RED,
AU_A2_ORANGE,
AU_A2_RED,
AU_A3_ORANGE,
AU_A3_RED,
AU_A4_ORANGE,
AU_A4_RED,
AU_RSSI_ORANGE,
AU_RSSI_RED,
AU_SWR_RED,
AU_TELEMETRY_LOST,
AU_TELEMETRY_BACK,
#endif
AU_FRSKY_FIRST, AU_FRSKY_FIRST,
AU_FRSKY_BEEP1 = AU_FRSKY_FIRST, AU_FRSKY_BEEP1 = AU_FRSKY_FIRST,
AU_FRSKY_BEEP2, AU_FRSKY_BEEP2,