diff --git a/companion/src/modeledit/expodialog.cpp b/companion/src/modeledit/expodialog.cpp index be549144c..7edebb1b1 100644 --- a/companion/src/modeledit/expodialog.cpp +++ b/companion/src/modeledit/expodialog.cpp @@ -133,7 +133,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G connect(ui->lineName, SIGNAL(editingFinished()), this, SLOT(valuesChanged())); connect(ui->sourceCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged())); - connect(ui->scale, SIGNAL(editingFinished()), this, SLOT(valuesChanged())); + connect(ui->dsbScale, SIGNAL(editingFinished()), this, SLOT(valuesChanged())); connect(ui->trimCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged())); connect(ui->switchesCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged())); connect(ui->sideCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged())); @@ -159,16 +159,20 @@ void ExpoDialog::updateScale() { if (firmware->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) { RawSourceRange range = ed->srcRaw.getRange(&model, generalSettings); - ui->scaleLabel->show(); - ui->scale->show(); - ui->scale->setDecimals(range.decimals); - ui->scale->setMinimum(range.min); - ui->scale->setMaximum(range.max); - ui->scale->setValue(round(range.step * ed->scale)); + ui->lblScale->show(); + ui->dsbScale->show(); + ui->lblScaleUnit->show(); + ui->dsbScale->setDecimals(range.decimals); + ui->dsbScale->setMinimum(range.min); + ui->dsbScale->setMaximum(range.max); + ui->dsbScale->setSingleStep(range.step); + ui->dsbScale->setValue(range.step * ed->scale); + ui->lblScaleUnit->setText(range.unit); } else { - ui->scaleLabel->hide(); - ui->scale->hide(); + ui->lblScale->hide(); + ui->dsbScale->hide(); + ui->lblScaleUnit->hide(); } } @@ -179,11 +183,12 @@ void ExpoDialog::valuesChanged() RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt()); if (ed->srcRaw != srcRaw) { ed->srcRaw = srcRaw; + ed->scale= 0; updateScale(); } RawSourceRange range = srcRaw.getRange(&model, generalSettings); - ed->scale = round(float(ui->scale->value()) / range.step); + ed->scale = round(float(ui->dsbScale->value()) / range.step); ed->carryTrim = 1 - ui->trimCB->currentIndex(); ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt()); ed->mode = ui->sideCB->currentIndex() + 1; diff --git a/companion/src/modeledit/expodialog.ui b/companion/src/modeledit/expodialog.ui index 133a2ae43..acd003e68 100644 --- a/companion/src/modeledit/expodialog.ui +++ b/companion/src/modeledit/expodialog.ui @@ -6,7 +6,7 @@ 0 0 - 389 + 394 488 @@ -30,76 +30,7 @@ :/icon.png:/icon.png - - - - Flight modes - - - - - - - Input name - - - - - - - - - GV - - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 6 - - - - - - - Source for the mixer. - - - - - - - Weight - - - - + @@ -256,107 +187,21 @@ - - + + + + 6 + + + + + - Switch + Offset - - - - Switch used to enable the line. -If blank then the input is considered to be "ON" all the time. - - - - - - - Stick Side - - - - - - - - NEG - - - - - POS - - - - - ALL - - - - - - - - - 0 - 25 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - true - - - - - - - Qt::Vertical - - - - 20 - 30 - - - - - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 1 - - - - - - - Scale - - - - - - - Include Trim - - - - + @@ -370,14 +215,7 @@ If blank then the input is considered to be "ON" all the time. - - - - Curve - - - - + @@ -408,35 +246,21 @@ If blank then the input is considered to be "ON" all the time. - - + + - Source + Stick Side - - - - Line name + + + + Source for the mixer. - - - - 6 - - - - - - - Offset - - - - + @@ -470,13 +294,213 @@ If blank then the input is considered to be "ON" all the time. + + + + + NEG + + + + + POS + + + + + ALL + + + + + + + + Qt::Vertical + + + + 20 + 30 + + + + + + + + Switch + + + + + + + 6 + + + + + + + Include Trim + + + + + + + Flight modes + + + + + + + Input name + + + + + + + + + GV + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Switch used to enable the line. +If blank then the input is considered to be "ON" all the time. + + + + + + + Weight + + + + + + + Source + + + + + + + Line name + + + + + + + Curve + + + + + + + Scale + + + + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + + unit + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 25 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + true + + + inputName lineName sourceCB - scale + dsbScale trimCB weightGV weightSB diff --git a/companion/src/modelprinter.cpp b/companion/src/modelprinter.cpp index 1d7df4f93..f5a8b987d 100644 --- a/companion/src/modelprinter.cpp +++ b/companion/src/modelprinter.cpp @@ -376,6 +376,11 @@ QString ModelPrinter::printInputLine(const ExpoData & input) str += input.srcRaw.toString(&model, &generalSettings).toHtmlEscaped(); } + if (input.srcRaw.type == SOURCE_TYPE_TELEMETRY && input.scale != 0){ + RawSourceRange range = input.srcRaw.getRange(&model, generalSettings); + str += " " + tr("Scale(%1)").arg(input.scale * range.step).toHtmlEscaped(); + } + str += " " + tr("Weight(%1)").arg(AdjustmentReference(input.weight).toString(&model, true)).toHtmlEscaped(); if (input.curve.value) str += " " + input.curve.toString(&model).toHtmlEscaped();