Merge remote-tracking branch 'origin/next' into
bsongis/Issue554_trims_relative_default Conflicts: companion/src/eeprominterface.h companion/src/firmwares/er9x/er9xinterface.cpp companion/src/firmwares/ersky9x/ersky9xinterface.cpp
This commit is contained in:
@@ -42,6 +42,7 @@ set(modeledit_UIS
|
||||
setup_module.ui
|
||||
flightmode.ui
|
||||
telemetry_analog.ui
|
||||
telemetry_customscreen.ui
|
||||
)
|
||||
|
||||
foreach(name ${modeledit_NAMES})
|
||||
|
||||
@@ -146,36 +146,43 @@ void CustomSwitchesPanel::edited()
|
||||
{
|
||||
case (CS_FAMILY_VOFS):
|
||||
if (model.customSw[i].val1 != cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt()) {
|
||||
source=RawSource(model.customSw[i].val1);
|
||||
source = RawSource(model.customSw[i].val1, &model);
|
||||
model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
|
||||
RawSource newSource = RawSource(model.customSw[i].val1);
|
||||
RawSource newSource = RawSource(model.customSw[i].val1, &model);
|
||||
if (newSource.type == SOURCE_TYPE_TELEMETRY) {
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val2 = -128;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
RawSourceRange range = source.getRange();
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value()/source.getStep(model));
|
||||
} else {
|
||||
model.customSw[i].val2 = ((cswitchOffset[i]->value()-source.getOffset(model))/source.getStep(model))-source.getRawOffset(model);
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step/* TODO - source.getRawOffset(model)*/;
|
||||
}
|
||||
}
|
||||
setSwitchWidgetVisibility(i);
|
||||
} else {
|
||||
source=RawSource(model.customSw[i].val1);
|
||||
}
|
||||
else {
|
||||
source = RawSource(model.customSw[i].val1, &model);
|
||||
RawSourceRange range = source.getRange();
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value()/source.getStep(model));
|
||||
cswitchOffset[i]->setValue(model.customSw[i].val2*source.getStep(model));
|
||||
} else {
|
||||
model.customSw[i].val2 = ((cswitchOffset[i]->value()-source.getOffset(model))/source.getStep(model))-source.getRawOffset(model);
|
||||
cswitchOffset[i]->setValue((model.customSw[i].val2 +source.getRawOffset(model))*source.getStep(model)+source.getOffset(model));
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
||||
cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val2 = ((cswitchOffset[i]->value()-range.offset)/range.step)/* TODO - source.getRawOffset(model)*/;
|
||||
cswitchOffset[i]->setValue((model.customSw[i].val2 /* + TODO source.getRawOffset(model)*/)*range.step+range.offset);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (CS_FAMILY_TIMERS): {
|
||||
value=cswitchOffset[i]->value();
|
||||
value = cswitchOffset[i]->value();
|
||||
newval=TimToVal(value);
|
||||
if (newval>model.customSw[i].val2) {
|
||||
if (value >=60) {
|
||||
@@ -246,7 +253,9 @@ void CustomSwitchesPanel::edited()
|
||||
|
||||
void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
{
|
||||
RawSource source = RawSource(model.customSw[i].val1);
|
||||
RawSource source = RawSource(model.customSw[i].val1, &model);
|
||||
RawSourceRange range = source.getRange();
|
||||
|
||||
switch (getCSFunctionFamily(model.customSw[i].func))
|
||||
{
|
||||
case CS_FAMILY_VOFS:
|
||||
@@ -255,16 +264,16 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
cswitchValue[i]->setVisible(false);
|
||||
cswitchOffset[i]->setVisible(true);
|
||||
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
cswitchOffset[i]->setDecimals(source.getDecimals(model));
|
||||
cswitchOffset[i]->setSingleStep(source.getStep(model));
|
||||
cswitchOffset[i]->setDecimals(range.decimals);
|
||||
cswitchOffset[i]->setSingleStep(range.step);
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
cswitchOffset[i]->setMinimum(source.getStep(model)*-127);
|
||||
cswitchOffset[i]->setMaximum(source.getStep(model)*127);
|
||||
cswitchOffset[i]->setValue(source.getStep(model)*model.customSw[i].val2);
|
||||
cswitchOffset[i]->setMinimum(range.step*-127);
|
||||
cswitchOffset[i]->setMaximum(range.step*127);
|
||||
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
|
||||
} else {
|
||||
cswitchOffset[i]->setMinimum(source.getMin(model));
|
||||
cswitchOffset[i]->setMaximum(source.getMax(model));
|
||||
cswitchOffset[i]->setValue(source.getStep(model)*(model.customSw[i].val2+source.getRawOffset(model))+source.getOffset(model));
|
||||
cswitchOffset[i]->setMinimum(range.min);
|
||||
cswitchOffset[i]->setMaximum(range.max);
|
||||
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
|
||||
}
|
||||
break;
|
||||
case CS_FAMILY_VBOOL:
|
||||
|
||||
@@ -48,7 +48,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
|
||||
ui->sideLabel->hide();
|
||||
ui->sideCB->hide();
|
||||
ui->inputName->setMaxLength(4);
|
||||
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | (GetEepromInterface()->getCapability(GvarsAsSources) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
||||
ui->sourceCB->removeItem(0);
|
||||
}
|
||||
else {
|
||||
@@ -56,8 +56,6 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
|
||||
ui->inputName->hide();
|
||||
ui->sourceLabel->hide();
|
||||
ui->sourceCB->hide();
|
||||
ui->scaleLabel->hide();
|
||||
ui->scaleSB->hide();
|
||||
ui->trimLabel->hide();
|
||||
ui->trimCB->hide();
|
||||
}
|
||||
@@ -83,13 +81,15 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
|
||||
ui->lineName->setValidator(new QRegExpValidator(rx, this));
|
||||
ui->lineName->setText(ed->name);
|
||||
|
||||
updateScale();
|
||||
valuesChanged();
|
||||
|
||||
connect(ui->lineName,SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
|
||||
connect(ui->sourceCB,SIGNAL(currentIndexChanged(int)), 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()));
|
||||
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->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()));
|
||||
for (int i=0; i<9; i++) {
|
||||
connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged()));
|
||||
}
|
||||
@@ -103,23 +103,35 @@ ExpoDialog::~ExpoDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ExpoDialog::changeEvent(QEvent *e)
|
||||
void ExpoDialog::updateScale()
|
||||
{
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (GetEepromInterface()->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
|
||||
RawSourceRange range = ed->srcRaw.getRange();
|
||||
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));
|
||||
}
|
||||
else {
|
||||
ui->scaleLabel->hide();
|
||||
ui->scale->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void ExpoDialog::valuesChanged()
|
||||
{
|
||||
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 };
|
||||
|
||||
ed->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
||||
RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
||||
if (ed->srcRaw != srcRaw) {
|
||||
ed->srcRaw = srcRaw;
|
||||
updateScale();
|
||||
}
|
||||
|
||||
RawSourceRange range = srcRaw.getRange();
|
||||
ed->scale = round(float(ui->scale->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;
|
||||
@@ -173,5 +185,5 @@ void ExpoDialog::valuesChanged()
|
||||
|
||||
void ExpoDialog::shrink()
|
||||
{
|
||||
resize(0,0);
|
||||
resize(0, 0);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class ExpoDialog : public QDialog {
|
||||
~ExpoDialog();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void updateScale();
|
||||
|
||||
private slots:
|
||||
void valuesChanged();
|
||||
|
||||
@@ -330,7 +330,7 @@ If blank then the input is considered to be "ON" all the time.</string
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="scaleSB">
|
||||
<widget class="QDoubleSpinBox" name="scale">
|
||||
<property name="whatsThis">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
@@ -441,6 +441,32 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>inputName</tabstop>
|
||||
<tabstop>lineName</tabstop>
|
||||
<tabstop>sourceCB</tabstop>
|
||||
<tabstop>scale</tabstop>
|
||||
<tabstop>trimCB</tabstop>
|
||||
<tabstop>weightGV</tabstop>
|
||||
<tabstop>weightSB</tabstop>
|
||||
<tabstop>weightCB</tabstop>
|
||||
<tabstop>curveTypeCB</tabstop>
|
||||
<tabstop>curveGVarCB</tabstop>
|
||||
<tabstop>curveValueCB</tabstop>
|
||||
<tabstop>curveValueSB</tabstop>
|
||||
<tabstop>cb_FP0</tabstop>
|
||||
<tabstop>cb_FP1</tabstop>
|
||||
<tabstop>cb_FP2</tabstop>
|
||||
<tabstop>cb_FP3</tabstop>
|
||||
<tabstop>cb_FP4</tabstop>
|
||||
<tabstop>cb_FP5</tabstop>
|
||||
<tabstop>cb_FP6</tabstop>
|
||||
<tabstop>cb_FP7</tabstop>
|
||||
<tabstop>cb_FP8</tabstop>
|
||||
<tabstop>switchesCB</tabstop>
|
||||
<tabstop>sideCB</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../companion.qrc"/>
|
||||
</resources>
|
||||
|
||||
@@ -20,7 +20,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, i
|
||||
else
|
||||
this->setWindowTitle(tr("DEST -> CH%1%2").arg(md->destCh/10).arg(md->destCh%10));
|
||||
|
||||
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS | (GetEepromInterface()->getCapability(GvarsAsSources) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
ui->sourceCB->removeItem(0);
|
||||
|
||||
int limit = GetEepromInterface()->getCapability(OffsetWeight);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace Ui {
|
||||
class TelemetryAnalog;
|
||||
class TelemetryCustomScreen;
|
||||
class Telemetry;
|
||||
}
|
||||
|
||||
@@ -44,6 +45,32 @@ class TelemetryAnalog : public QWidget
|
||||
void update();
|
||||
};
|
||||
|
||||
class TelemetryCustomScreen : public ModelPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen);
|
||||
~TelemetryCustomScreen();
|
||||
void update();
|
||||
|
||||
private slots:
|
||||
void on_screenType_currentIndexChanged(int index);
|
||||
void customFieldChanged(int index);
|
||||
void barSourceChanged(int index);
|
||||
void barMinChanged(double value);
|
||||
void barMaxChanged(double value);
|
||||
|
||||
private:
|
||||
void updateBar(int line);
|
||||
Ui::TelemetryCustomScreen * ui;
|
||||
FrSkyScreenData & screen;
|
||||
QComboBox * fieldsCB[4][3];
|
||||
QComboBox * barsCB[4];
|
||||
QDoubleSpinBox * minSB[4];
|
||||
QDoubleSpinBox * maxSB[4];
|
||||
};
|
||||
|
||||
class TelemetryPanel : public ModelPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -77,24 +104,12 @@ class TelemetryPanel : public ModelPanel
|
||||
void on_fasOffset_DSB_editingFinished();
|
||||
void on_mahCount_SB_editingFinished();
|
||||
void on_mahCount_ChkB_toggled(bool checked);
|
||||
void telBarCBcurrentIndexChanged(int index);
|
||||
void ScreenTypeCBcurrentIndexChanged(int index);
|
||||
void telMaxSBeditingFinished();
|
||||
void telMinSBeditingFinished();
|
||||
void customFieldEdited();
|
||||
|
||||
private:
|
||||
Ui::Telemetry *ui;
|
||||
TelemetryAnalog * analogs[2];
|
||||
QGroupBox* barsGB[3];
|
||||
QGroupBox* numsGB[3];
|
||||
QComboBox* barsCB[12];
|
||||
QDoubleSpinBox* minSB[12];
|
||||
QDoubleSpinBox* maxSB[12];
|
||||
QComboBox* csf[36];
|
||||
|
||||
void setup();
|
||||
float getBarStep(int barId);
|
||||
void telBarUpdate();
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TelemetryCustomScreen</class>
|
||||
<widget class="QWidget" name="TelemetryCustomScreen">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>650</width>
|
||||
<height>393</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="screenTypeLabel">
|
||||
<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>Custom Screen Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="screenType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Nums</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Bars</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="screenNums">
|
||||
<layout class="QGridLayout" name="screenNumsLayout"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="screenBars">
|
||||
<layout class="QGridLayout" name="screenBarsLayout" columnstretch="1,0,1,0">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_266">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_265">
|
||||
<property name="text">
|
||||
<string>Source</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_267">
|
||||
<property name="text">
|
||||
<string>Gauge</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_268">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user