FW however apparently also has an issue when turning extended limits off
This commit is contained in:
Andre Bernet
2014-03-23 15:57:33 +01:00
parent e9035d3649
commit 31823c0c95
5 changed files with 34 additions and 2 deletions
+16
View File
@@ -63,10 +63,12 @@ Channels::Channels(QWidget * parent, ModelData & model):
minSB->setAccelerated(true);
minSB->setDecimals(1);
minSB->setMinimum(model.extendedLimits ? -125 : -100);
minSB->setSingleStep(0.1);
minSB->setMaximum(0);
minSB->setValue(float(model.limitData[i].min) / 10);
connect(minSB, SIGNAL(editingFinished()), this, SLOT(minEdited()));
gridLayout->addWidget(minSB, i+1, col++, 1, 1);
minSpins << minSB;
// Channel max
QDoubleSpinBox * maxSB = new QDoubleSpinBox(this);
@@ -75,10 +77,12 @@ Channels::Channels(QWidget * parent, ModelData & model):
maxSB->setAccelerated(true);
maxSB->setDecimals(1);
maxSB->setMinimum(0);
maxSB->setSingleStep(0.1);
maxSB->setMaximum(model.extendedLimits ? 125 : 100);
maxSB->setValue(float(model.limitData[i].max) / 10);
connect(maxSB, SIGNAL(editingFinished()), this, SLOT(maxEdited()));
gridLayout->addWidget(maxSB, i+1, col++, 1, 1);
maxSpins << maxSB;
// Channel inversion
QComboBox * invCB = new QComboBox(this);
@@ -160,6 +164,18 @@ void Channels::maxEdited()
emit modified();
}
void Channels::refreshExtendedLimits()
{
for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
QDoubleSpinBox * minDSB = minSpins[i];
QDoubleSpinBox * maxDSB = maxSpins[i];
minDSB->setMinimum(model.extendedLimits ? -125 : -100);
maxDSB->setMaximum(model.extendedLimits ? 125 : 100);
}
emit modified();
}
void Channels::invEdited()
{
QComboBox *cb = qobject_cast<QComboBox*>(sender());
+8
View File
@@ -2,6 +2,7 @@
#define CHANNELS_H
#include "modelpanel.h"
#include <QSpinBox>
class Channels : public ModelPanel
{
@@ -10,6 +11,13 @@ class Channels : public ModelPanel
public:
Channels(QWidget *parent, ModelData & model);
~Channels();
private:
QVector<QDoubleSpinBox *> minSpins;
QVector<QDoubleSpinBox *> maxSpins;
public slots:
void refreshExtendedLimits();
private slots:
void symlimitsEdited();
+6 -2
View File
@@ -25,18 +25,22 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
setWindowIcon(CompanionIcon("edit.png"));
restoreGeometry(g.modelEditGeo());
ui->pushButton->setIcon(CompanionIcon("simulate.png"));
addTab(new Setup(this, model), tr("Setup"));
Setup * setupPanel = new Setup(this, model);
addTab(setupPanel, tr("Setup"));
addTab(new HeliPanel(this, model), tr("Heli"));
addTab(new FlightModes(this, model, radioData.generalSettings), tr("Flight Modes"));
addTab(new InputsPanel(this, model, radioData.generalSettings), tr("Inputs"));
addTab(new MixesPanel(this, model, radioData.generalSettings), tr("Mixes"));
addTab(new Channels(this, model), tr("Channels"));
Channels * chnPanel = new Channels(this, model);
addTab(chnPanel, tr("Channels"));
addTab(new LogicalSwitchesPanel(this, model), tr("Logical Switches"));
if (GetEepromInterface()->getCapability(CustomFunctions))
addTab(new CustomFunctionsPanel(this, model, radioData.generalSettings), tr("Switch Assignment"));
addTab(new Curves(this, model), tr("Curves"));
if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY)
addTab(new TelemetryPanel(this, model), tr("Telemetry"));
connect(setupPanel, SIGNAL(extendedLimitsToggled()), chnPanel, SLOT(refreshExtendedLimits()));
}
ModelEdit::~ModelEdit()
+1
View File
@@ -471,6 +471,7 @@ Setup::~Setup()
void Setup::on_extendedLimits_toggled(bool checked)
{
model.extendedLimits = checked;
emit extendedLimitsToggled();
emit modified();
}
+3
View File
@@ -76,6 +76,9 @@ class Setup : public ModelPanel
virtual void update();
signals:
void extendedLimitsToggled();
private slots:
void on_name_editingFinished();
void on_throttleSource_currentIndexChanged(int index);