mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
GCS-Auto Tuning
Added code to allow module to be enabled using the checkbox
This commit is contained in:
parent
de924ccf5f
commit
4e1081179b
@ -13,6 +13,7 @@
|
||||
#include "relaytuningsettings.h"
|
||||
#include "relaytuning.h"
|
||||
#include "stabilizationsettings.h"
|
||||
#include "hwsettings.h"
|
||||
|
||||
ConfigAutotuneWidget::ConfigAutotuneWidget(QWidget *parent) :
|
||||
ConfigTaskWidget(parent)
|
||||
@ -28,6 +29,9 @@ ConfigAutotuneWidget::ConfigAutotuneWidget(QWidget *parent) :
|
||||
connect(m_autotune->rateTuning, SIGNAL(valueChanged(int)), this, SLOT(recomputeStabilization()));
|
||||
connect(m_autotune->attitudeTuning, SIGNAL(valueChanged(int)), this, SLOT(recomputeStabilization()));
|
||||
|
||||
addUAVObject("HwSettings");
|
||||
addWidget(m_autotune->enableAutoTune);
|
||||
|
||||
RelayTuning *relayTuning = RelayTuning::GetInstance(getObjectManager());
|
||||
Q_ASSERT(relayTuning);
|
||||
if(relayTuning)
|
||||
@ -134,3 +138,25 @@ void ConfigAutotuneWidget::recomputeStabilization()
|
||||
m_autotune->pitchAttitudeKp->setText(QString().number(stabSettings.PitchPI[StabilizationSettings::PITCHPI_KP]));
|
||||
m_autotune->pitchAttitudeKi->setText(QString().number(stabSettings.PitchPI[StabilizationSettings::PITCHPI_KI]));
|
||||
}
|
||||
void ConfigAutotuneWidget::refreshWidgetsValues(UAVObject *obj)
|
||||
{
|
||||
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
||||
if(obj==hwSettings)
|
||||
{
|
||||
bool dirtyBack=isDirty();
|
||||
HwSettings::DataFields hwSettingsData = hwSettings->getData();
|
||||
m_autotune->enableAutoTune->setChecked(
|
||||
hwSettingsData.OptionalModules[HwSettings::OPTIONALMODULES_AUTOTUNE] == HwSettings::OPTIONALMODULES_ENABLED);
|
||||
setDirty(dirtyBack);
|
||||
}
|
||||
ConfigTaskWidget::refreshWidgetsValues(obj);
|
||||
}
|
||||
void ConfigAutotuneWidget::updateObjectsFromWidgets()
|
||||
{
|
||||
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
||||
HwSettings::DataFields hwSettingsData = hwSettings->getData();
|
||||
hwSettingsData.OptionalModules[HwSettings::OPTIONALMODULES_AUTOTUNE] =
|
||||
m_autotune->enableAutoTune->isChecked() ? HwSettings::OPTIONALMODULES_ENABLED : HwSettings::OPTIONALMODULES_DISABLED;
|
||||
hwSettings->setData(hwSettingsData);
|
||||
ConfigTaskWidget::updateObjectsFromWidgets();
|
||||
}
|
||||
|
@ -51,10 +51,12 @@ private:
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
void refreshWidgetsValues(UAVObject *obj);
|
||||
void updateObjectsFromWidgets();
|
||||
private slots:
|
||||
void recomputeStabilization();
|
||||
void saveStabilization();
|
||||
void refreshValues();
|
||||
};
|
||||
|
||||
#endif // CONFIGAUTOTUNE_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user