diff --git a/src/ui/configuration/ArduCopterPidConfig.cc b/src/ui/configuration/ArduCopterPidConfig.cc index ad7211ed399a5c79c2786769c97bc34002a42083..7d5f274cbd4b8822e3ee09c64df79230148271da 100644 --- a/src/ui/configuration/ArduCopterPidConfig.cc +++ b/src/ui/configuration/ArduCopterPidConfig.cc @@ -3,6 +3,11 @@ ArduCopterPidConfig::ArduCopterPidConfig(QWidget *parent) : AP2ConfigWidget(parent) { ui.setupUi(this); + m_pitchRollLocked = false; + connect(ui.checkBox,SIGNAL(clicked(bool)),this,SLOT(lockCheckBoxClicked(bool))); + connect(ui.stabilPitchPSpinBox,SIGNAL(valueChanged(double)),this,SLOT(stabilLockedChanged(double))); + connect(ui.stabilRollPSpinBox,SIGNAL(valueChanged(double)),this,SLOT(stabilLockedChanged(double))); + connect(ui.stabilYawPSpinBox,SIGNAL(valueChanged(double)),this,SLOT(stabilLockedChanged(double))); m_nameToBoxMap["STB_RLL_P"] = ui.stabilPitchPSpinBox; m_nameToBoxMap["STB_PIT_P"] = ui.stabilRollPSpinBox; m_nameToBoxMap["STB_YAW_P"] = ui.stabilYawPSpinBox; @@ -109,6 +114,25 @@ ArduCopterPidConfig::ArduCopterPidConfig(QWidget *parent) : AP2ConfigWidget(pare } initConnections(); } +void ArduCopterPidConfig::lockCheckBoxClicked(bool checked) +{ + m_pitchRollLocked = checked; +} +void ArduCopterPidConfig::stabilLockedChanged(double value) +{ + if (m_pitchRollLocked) + { + disconnect(ui.stabilPitchPSpinBox,SIGNAL(valueChanged(double)),this,SLOT(stabilLockedChanged(double))); + disconnect(ui.stabilRollPSpinBox,SIGNAL(valueChanged(double)),this,SLOT(stabilLockedChanged(double))); + disconnect(ui.stabilYawPSpinBox,SIGNAL(valueChanged(double)),this,SLOT(stabilLockedChanged(double))); + ui.stabilPitchPSpinBox->setValue(value); + ui.stabilRollPSpinBox->setValue(value); + ui.stabilYawPSpinBox->setValue(value); + connect(ui.stabilPitchPSpinBox,SIGNAL(valueChanged(double)),this,SLOT(stabilLockedChanged(double))); + connect(ui.stabilRollPSpinBox,SIGNAL(valueChanged(double)),this,SLOT(stabilLockedChanged(double))); + connect(ui.stabilYawPSpinBox,SIGNAL(valueChanged(double)),this,SLOT(stabilLockedChanged(double))); + } +} ArduCopterPidConfig::~ArduCopterPidConfig() { diff --git a/src/ui/configuration/ArduCopterPidConfig.h b/src/ui/configuration/ArduCopterPidConfig.h index bc3ac3a693619c1f0d23bf11b0dee1ec3723da99..d8a1360b882e67f07e31283ae9e17ed8557538ac 100644 --- a/src/ui/configuration/ArduCopterPidConfig.h +++ b/src/ui/configuration/ArduCopterPidConfig.h @@ -17,7 +17,10 @@ private slots: void writeButtonClicked(); void refreshButtonClicked(); void parameterChanged(int uas, int component, QString parameterName, QVariant value); + void lockCheckBoxClicked(bool checked); + void stabilLockedChanged(double value); private: + bool m_pitchRollLocked; QList > m_ch6ValueToTextList; QList > m_ch78ValueToTextList; QMap m_nameToBoxMap;