1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-31 16:52:10 +01:00

OP-1222 Fixed false positive dirty indication for stabilization tab in configplugin.

Added tracking of TPS curve changes.
This commit is contained in:
m_thread 2014-09-28 02:00:54 +02:00
parent 012c1ae940
commit 7a00c7f905
3 changed files with 12 additions and 2 deletions

View File

@ -134,6 +134,7 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
ui->thrustPIDScalingCurve->setMin(-0.5);
ui->thrustPIDScalingCurve->setMax(0.5);
ui->thrustPIDScalingCurve->initLinearCurve(5, -0.25, 0.25);
connect(ui->thrustPIDScalingCurve, SIGNAL(curveUpdated()), this, SLOT(throttleCurveUpdated()));
addWidget(ui->defaultThrottleCurveButton);
addWidget(ui->enableThrustPIDScalingCheckBox);
@ -170,6 +171,7 @@ void ConfigStabilizationWidget::updateObjectsFromWidgets()
void ConfigStabilizationWidget::updateThrottleCurveFromObject()
{
bool dirty = isDirty();
UAVObject *stabBank = getObjectManager()->getObject(QString(m_pidTabBars.at(0)->tabData(m_currentPIDBank).toString()));
Q_ASSERT(stabBank);
@ -192,6 +194,7 @@ void ConfigStabilizationWidget::updateThrottleCurveFromObject()
bool enabled = field->getValue() == "TRUE";
ui->enableThrustPIDScalingCheckBox->setChecked(enabled);
ui->thrustPIDScalingCurve->setEnabled(enabled);
setDirty(dirty);
}
void ConfigStabilizationWidget::updateObjectFromThrottleCurve()
@ -242,6 +245,11 @@ void ConfigStabilizationWidget::resetThrottleCurveToDefault()
delete defaultStabBank;
}
void ConfigStabilizationWidget::throttleCurveUpdated()
{
setDirty(true);
}
void ConfigStabilizationWidget::realtimeUpdatesSlot(bool value)
{
ui->realTimeUpdates_6->setChecked(value);
@ -335,6 +343,7 @@ void ConfigStabilizationWidget::onBoardConnected()
void ConfigStabilizationWidget::pidBankChanged(int index)
{
bool dirty = isDirty();
updateObjectFromThrottleCurve();
foreach(QTabBar * tabBar, m_pidTabBars) {
disconnect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(pidBankChanged(int)));
@ -351,6 +360,7 @@ void ConfigStabilizationWidget::pidBankChanged(int index)
m_currentPIDBank = index;
qDebug() << "current bank:" << m_currentPIDBank;
updateThrottleCurveFromObject();
setDirty(dirty);
}
bool ConfigStabilizationWidget::shouldObjectBeSaved(UAVObject *object)

View File

@ -74,6 +74,6 @@ private slots:
void onBoardConnected();
void pidBankChanged(int index);
void resetThrottleCurveToDefault();
void throttleCurveUpdated();
};
#endif // ConfigStabilizationWidget_H

View File

@ -139,7 +139,7 @@ public:
void autoLoadWidgets();
bool isDirty();
void setDirty(bool value);
virtual void setDirty(bool value);
bool allObjectsUpdated();
void setOutOfLimitsStyle(QString style)