[Companion] Horus analog input names fixed
This commit is contained in:
@@ -489,22 +489,6 @@ RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSetting
|
||||
return result;
|
||||
}
|
||||
|
||||
QString AnalogString(int index)
|
||||
{
|
||||
static const QString sticks[] = { QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail") };
|
||||
static const QString pots9X[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3") };
|
||||
static const QString potsTaranisX9E[] = { QObject::tr("F1"), QObject::tr("F2"), QObject::tr("F3"), QObject::tr("F4"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS") };
|
||||
static const QString potsTaranis[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS") };
|
||||
if (index < 4)
|
||||
return CHECK_IN_ARRAY(sticks, index);
|
||||
else if (IS_TARANIS_X9E(GetEepromInterface()->getBoard()))
|
||||
return CHECK_IN_ARRAY(potsTaranisX9E, index-4);
|
||||
else if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
||||
return CHECK_IN_ARRAY(potsTaranis, index-4);
|
||||
else
|
||||
return CHECK_IN_ARRAY(pots9X, index-4);
|
||||
}
|
||||
|
||||
QString RotaryEncoderString(int index)
|
||||
{
|
||||
static const QString rotary[] = { QObject::tr("REa"), QObject::tr("REb") };
|
||||
@@ -552,7 +536,7 @@ QString RawSource::toString(const ModelData * model) const
|
||||
case SOURCE_TYPE_LUA_OUTPUT:
|
||||
return QObject::tr("LUA%1%2").arg(index/16+1).arg(QChar('a'+index%16));
|
||||
case SOURCE_TYPE_STICK:
|
||||
return AnalogString(index);
|
||||
return GetCurrentFirmware()->getAnalogInputName(index);
|
||||
case SOURCE_TYPE_TRIM:
|
||||
return CHECK_IN_ARRAY(trims, index);
|
||||
case SOURCE_TYPE_ROTARY_ENCODER:
|
||||
|
||||
@@ -242,7 +242,6 @@ enum RawSourceType {
|
||||
MAX_SOURCE_TYPE
|
||||
};
|
||||
|
||||
QString AnalogString(int index);
|
||||
QString RotaryEncoderString(int index);
|
||||
|
||||
class RawSourceRange
|
||||
@@ -1707,7 +1706,9 @@ class Firmware {
|
||||
};
|
||||
|
||||
virtual Switch getSwitch(unsigned int index) = 0;
|
||||
|
||||
|
||||
virtual QString getAnalogInputName(unsigned int index) = 0;
|
||||
|
||||
virtual QTime getMaxTimerStart() = 0;
|
||||
|
||||
virtual bool isTelemetrySourceAvailable(int source) = 0;
|
||||
|
||||
@@ -3444,7 +3444,7 @@ void OpenTxModelData::afterImport()
|
||||
break;
|
||||
}
|
||||
}
|
||||
strncpy(modelData.inputNames[i], AnalogString(i).toLatin1().constData(), sizeof(modelData.inputNames[i])-1);
|
||||
strncpy(modelData.inputNames[i], GetCurrentFirmware()->getAnalogInputName(i).toLatin1().constData(), sizeof(modelData.inputNames[i])-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -789,6 +789,58 @@ int OpenTxFirmware::getCapability(Capability capability)
|
||||
}
|
||||
}
|
||||
|
||||
QString OpenTxFirmware::getAnalogInputName(unsigned int index)
|
||||
{
|
||||
if (index < 4) {
|
||||
const QString sticks[] = { QObject::tr("Rud"),
|
||||
QObject::tr("Ele"),
|
||||
QObject::tr("Thr"),
|
||||
QObject::tr("Ail") };
|
||||
return sticks[index];
|
||||
}
|
||||
|
||||
index -= 4;
|
||||
|
||||
if (IS_9X(board) || IS_2560(board) || IS_SKY9X(board)) {
|
||||
const QString pots[] = { QObject::tr("P1"),
|
||||
QObject::tr("P2"),
|
||||
QObject::tr("P3") };
|
||||
return CHECK_IN_ARRAY(pots, index);
|
||||
}
|
||||
else if (IS_TARANIS_X9E(board)) {
|
||||
const QString pots[] = { QObject::tr("F1"),
|
||||
QObject::tr("F2"),
|
||||
QObject::tr("F3"),
|
||||
QObject::tr("F4"),
|
||||
QObject::tr("S1"),
|
||||
QObject::tr("S2"),
|
||||
QObject::tr("LS"),
|
||||
QObject::tr("RS") };
|
||||
return CHECK_IN_ARRAY(pots, index);
|
||||
}
|
||||
else if (IS_TARANIS(board)) {
|
||||
const QString pots[] = {QObject::tr("S1"),
|
||||
QObject::tr("S2"),
|
||||
QObject::tr("S3"),
|
||||
QObject::tr("LS"),
|
||||
QObject::tr("RS")};
|
||||
return CHECK_IN_ARRAY(pots, index);
|
||||
}
|
||||
else if (IS_HORUS(board)) {
|
||||
const QString pots[] = {QObject::tr("S1"),
|
||||
QObject::tr("6P"),
|
||||
QObject::tr("S2"),
|
||||
QObject::tr("L1"),
|
||||
QObject::tr("L2"),
|
||||
QObject::tr("LS"),
|
||||
QObject::tr("RS")};
|
||||
return CHECK_IN_ARRAY(pots, index);
|
||||
}
|
||||
else {
|
||||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
Firmware::Switch OpenTxFirmware::getSwitch(unsigned int index)
|
||||
{
|
||||
if (board == BOARD_X7D) {
|
||||
|
||||
@@ -136,6 +136,8 @@ class OpenTxFirmware: public Firmware
|
||||
|
||||
virtual Switch getSwitch(unsigned int index);
|
||||
|
||||
virtual QString getAnalogInputName(unsigned int index);
|
||||
|
||||
virtual QTime getMaxTimerStart();
|
||||
|
||||
virtual bool isTelemetrySourceAvailable(int source);
|
||||
|
||||
@@ -49,7 +49,7 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
|
||||
|
||||
for(int i = 0; i < rows; ++i) {
|
||||
|
||||
QTableWidgetItem *newItem = new QTableWidgetItem(AnalogString(i));
|
||||
QTableWidgetItem *newItem = new QTableWidgetItem(firmware->getAnalogInputName(i));
|
||||
newItem->setTextAlignment(Qt::AlignLeft);
|
||||
tableWidget->setVerticalHeaderItem(i, newItem);
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
}
|
||||
|
||||
for(int i=0; i < CPN_MAX_STICKS; i++) {
|
||||
ui->trimCB->addItem(AnalogString(i), i+1);
|
||||
ui->trimCB->addItem(firmware->getAnalogInputName(i), i+1);
|
||||
}
|
||||
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
// The trims
|
||||
QString labels[CPN_MAX_STICKS];
|
||||
for(int i=0; i < CPN_MAX_STICKS; i++) {
|
||||
labels[i] = AnalogString(i);
|
||||
labels[i] = firmware->getAnalogInputName(i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
||||
|
||||
if (!firmware->getCapability(VirtualInputs)) {
|
||||
for(int i=0; i < CPN_MAX_STICKS; i++) {
|
||||
ui->trimCB->addItem(AnalogString(i));
|
||||
ui->trimCB->addItem(firmware->getAnalogInputName(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -655,7 +655,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
||||
for (int i=0; i<analogs+firmware->getCapability(RotaryEncoders); i++) {
|
||||
QCheckBox * checkbox = new QCheckBox(this);
|
||||
checkbox->setProperty("index", i);
|
||||
checkbox->setText(i<analogs ? AnalogString(i) : RotaryEncoderString(i-analogs));
|
||||
checkbox->setText(i<analogs ? firmware->getAnalogInputName(i) : RotaryEncoderString(i-analogs));
|
||||
ui->centerBeepLayout->addWidget(checkbox, 0, i+1);
|
||||
connect(checkbox, SIGNAL(toggled(bool)), this, SLOT(onBeepCenterToggled(bool)));
|
||||
centerBeepCheckboxes << checkbox;
|
||||
@@ -718,7 +718,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
||||
for (int i=0; i<firmware->getCapability(Pots)+firmware->getCapability(Sliders); i++) {
|
||||
QCheckBox * cb = new QCheckBox(this);
|
||||
cb->setProperty("index", i);
|
||||
cb->setText(AnalogString(i+4));
|
||||
cb->setText(firmware->getAnalogInputName(i+4));
|
||||
ui->potWarningLayout->addWidget(cb, 0, i+1);
|
||||
connect(cb, SIGNAL(toggled(bool)), this, SLOT(potWarningToggled(bool)));
|
||||
potWarningCheckboxes << cb;
|
||||
|
||||
@@ -267,8 +267,8 @@ QString MultiModelPrinter::printFlightModes()
|
||||
columns.append("<td><b>" + tr("Switch") + "</b></td>");
|
||||
columns.append("<td><b>" + tr("Fade IN") + "</b></td>");
|
||||
columns.append("<td><b>" + tr("Fade OUT") + "</b></td>");
|
||||
for (int i=0; i<CPN_MAX_STICKS; i++) {
|
||||
columns.append("<td><b>" + AnalogString(i) + " trim</b></td>");
|
||||
for (int i=0; i<4; i++) {
|
||||
columns.append("<td><b>" + GetCurrentFirmware()->getAnalogInputName(i) + " trim</b></td>");
|
||||
}
|
||||
columns.append("</tr>");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user