Fix input scale decimals, add sensor unit, add scale to inputs list and model print
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>389</width>
|
||||
<width>394</width>
|
||||
<height>488</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -30,76 +30,7 @@
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_phases">
|
||||
<property name="text">
|
||||
<string>Flight modes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="inputNameLabel">
|
||||
<property name="text">
|
||||
<string>Input name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1,0">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="weightGV">
|
||||
<property name="text">
|
||||
<string>GV</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="weightSB"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="weightCB">
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="inputName">
|
||||
<property name="maxLength">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="sourceCB">
|
||||
<property name="whatsThis">
|
||||
<string>Source for the mixer.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Weight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lb_FP0">
|
||||
@@ -256,107 +187,21 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="inputName">
|
||||
<property name="maxLength">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="offsetLabel">
|
||||
<property name="text">
|
||||
<string>Switch</string>
|
||||
<string>Offset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QComboBox" name="switchesCB">
|
||||
<property name="whatsThis">
|
||||
<string>Switch used to enable the line.
|
||||
If blank then the input is considered to be "ON" all the time.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="sideLabel">
|
||||
<property name="text">
|
||||
<string>Stick Side</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QComboBox" name="sideCB">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>NEG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>POS</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ALL</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="scale">
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="scaleLabel">
|
||||
<property name="text">
|
||||
<string>Scale</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="trimLabel">
|
||||
<property name="text">
|
||||
<string>Include Trim</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="trimCB">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -370,14 +215,7 @@ If blank then the input is considered to be "ON" all the time.</string
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_curves">
|
||||
<property name="text">
|
||||
<string>Curve</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="9" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1,0">
|
||||
<item>
|
||||
<widget class="QComboBox" name="curveTypeCB">
|
||||
@@ -408,35 +246,21 @@ If blank then the input is considered to be "ON" all the time.</string
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="sourceLabel">
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="sideLabel">
|
||||
<property name="text">
|
||||
<string>Source</string>
|
||||
<string>Stick Side</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lineNameLabel">
|
||||
<property name="text">
|
||||
<string>Line name</string>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="sourceCB">
|
||||
<property name="whatsThis">
|
||||
<string>Source for the mixer.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineName">
|
||||
<property name="maxLength">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="offsetLabel">
|
||||
<property name="text">
|
||||
<string>Offset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<layout class="QHBoxLayout" name="offsetLayout" stretch="0,0,1,0">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="offsetGV">
|
||||
@@ -470,13 +294,213 @@ If blank then the input is considered to be "ON" all the time.</string
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QComboBox" name="sideCB">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>NEG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>POS</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ALL</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Switch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineName">
|
||||
<property name="maxLength">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="trimLabel">
|
||||
<property name="text">
|
||||
<string>Include Trim</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_phases">
|
||||
<property name="text">
|
||||
<string>Flight modes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="inputNameLabel">
|
||||
<property name="text">
|
||||
<string>Input name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1,0">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="weightGV">
|
||||
<property name="text">
|
||||
<string>GV</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="weightSB"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="weightCB">
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QComboBox" name="switchesCB">
|
||||
<property name="whatsThis">
|
||||
<string>Switch used to enable the line.
|
||||
If blank then the input is considered to be "ON" all the time.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Weight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="sourceLabel">
|
||||
<property name="text">
|
||||
<string>Source</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lineNameLabel">
|
||||
<property name="text">
|
||||
<string>Line name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_curves">
|
||||
<property name="text">
|
||||
<string>Curve</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblScale">
|
||||
<property name="text">
|
||||
<string>Scale</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="dsbScale">
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblScaleUnit">
|
||||
<property name="text">
|
||||
<string>unit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="15" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>inputName</tabstop>
|
||||
<tabstop>lineName</tabstop>
|
||||
<tabstop>sourceCB</tabstop>
|
||||
<tabstop>scale</tabstop>
|
||||
<tabstop>dsbScale</tabstop>
|
||||
<tabstop>trimCB</tabstop>
|
||||
<tabstop>weightGV</tabstop>
|
||||
<tabstop>weightSB</tabstop>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user