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