1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

OP-1397 Limit the Attitude Responsiveness values to 180 degrees

This commit is contained in:
Stefan Karlsson 2014-07-17 12:21:12 +02:00
parent 14770876cd
commit 0416c39cdb
2 changed files with 22 additions and 6 deletions

View File

@ -92,12 +92,22 @@ ConfigTxPIDWidget::~ConfigTxPIDWidget()
// Do nothing // 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 *minPID;
QDoubleSpinBox *maxPID; QDoubleSpinBox *maxPID;
qDebug() << "ConfigTxPIDWidget::updateSpinBoxProperties(" << selected_pid_type << ")"; qDebug() << "ConfigTxPIDWidget::updateSpinBoxProperties(" << selectedPidType << ")";
QObject *obj = sender(); QObject *obj = sender();
if (obj == m_txpid->PID1) { if (obj == m_txpid->PID1) {
@ -114,9 +124,15 @@ void ConfigTxPIDWidget::updateSpinBoxProperties(const QString & selected_pid_typ
return; return;
} }
if (selected_pid_type.endsWith(".Resp")) { if (isResponsivenessType(selectedPidType)) {
minPID->setRange(0, 999); if (isAttitudeType(selectedPidType)) {
maxPID->setRange(0, 999); // Limit to 180 degrees.
minPID->setRange(0, 180);
maxPID->setRange(0, 180);
} else {
minPID->setRange(0, 999);
maxPID->setRange(0, 999);
}
minPID->setSingleStep(1); minPID->setSingleStep(1);
maxPID->setSingleStep(1); maxPID->setSingleStep(1);
minPID->setDecimals(0); minPID->setDecimals(0);

View File

@ -40,7 +40,7 @@ private:
Ui_TxPIDWidget *m_txpid; Ui_TxPIDWidget *m_txpid;
private slots: private slots:
void updateSpinBoxProperties(const QString & selected_pid_type); void updateSpinBoxProperties(const QString & selectedPidType);
void refreshValues(); void refreshValues();
void applySettings(); void applySettings();
void saveSettings(); void saveSettings();