diff --git a/ground/openpilotgcs/src/plugins/config/configtxpidwidget.cpp b/ground/openpilotgcs/src/plugins/config/configtxpidwidget.cpp index 4e58d2357..01930f17a 100644 --- a/ground/openpilotgcs/src/plugins/config/configtxpidwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configtxpidwidget.cpp @@ -92,12 +92,22 @@ ConfigTxPIDWidget::~ConfigTxPIDWidget() // Do nothing } -void ConfigTxPIDWidget::updateSpinBoxProperties(const QString & selected_pid_type) +static bool isResponsivenessType(const QString & pidType) +{ + return pidType.endsWith(".Resp"); +} + +static bool isAttitudeType(const QString & pidType) +{ + return pidType.contains("Attitude"); +} + +void ConfigTxPIDWidget::updateSpinBoxProperties(const QString & selectedPidType) { QDoubleSpinBox *minPID; QDoubleSpinBox *maxPID; - qDebug() << "ConfigTxPIDWidget::updateSpinBoxProperties(" << selected_pid_type << ")"; + qDebug() << "ConfigTxPIDWidget::updateSpinBoxProperties(" << selectedPidType << ")"; QObject *obj = sender(); if (obj == m_txpid->PID1) { @@ -114,9 +124,15 @@ void ConfigTxPIDWidget::updateSpinBoxProperties(const QString & selected_pid_typ return; } - if (selected_pid_type.endsWith(".Resp")) { - minPID->setRange(0, 999); - maxPID->setRange(0, 999); + if (isResponsivenessType(selectedPidType)) { + if (isAttitudeType(selectedPidType)) { + // Limit to 180 degrees. + minPID->setRange(0, 180); + maxPID->setRange(0, 180); + } else { + minPID->setRange(0, 999); + maxPID->setRange(0, 999); + } minPID->setSingleStep(1); maxPID->setSingleStep(1); minPID->setDecimals(0); diff --git a/ground/openpilotgcs/src/plugins/config/configtxpidwidget.h b/ground/openpilotgcs/src/plugins/config/configtxpidwidget.h index 212bc2880..ca4c61d55 100644 --- a/ground/openpilotgcs/src/plugins/config/configtxpidwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configtxpidwidget.h @@ -40,7 +40,7 @@ private: Ui_TxPIDWidget *m_txpid; private slots: - void updateSpinBoxProperties(const QString & selected_pid_type); + void updateSpinBoxProperties(const QString & selectedPidType); void refreshValues(); void applySettings(); void saveSettings();