diff --git a/ground/gcs/src/plugins/config/configoutputwidget.cpp b/ground/gcs/src/plugins/config/configoutputwidget.cpp index 12ebb09c7..028009c11 100644 --- a/ground/gcs/src/plugins/config/configoutputwidget.cpp +++ b/ground/gcs/src/plugins/config/configoutputwidget.cpp @@ -146,6 +146,9 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager()); connect(systemAlarmsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateBoardWarnings(UAVObject *))); + inputCalibrationStarted = false; + channelTestsStarted = false; + // TODO why do we do that ? disconnect(this, SLOT(refreshWidgetsValues(UAVObject *))); } @@ -219,6 +222,17 @@ void ConfigOutputWidget::runChannelTests(bool state) } } + channelTestsStarted = state; + + // Disable/Enable banks + for (int i = 0; i < m_banks.count(); i++) { + OutputBankControls controls = m_banks.at(i); + bool isUsed = !(controls.rateCombo()->currentText() == "-" && controls.modeCombo()->currentText() == "PWM"); + if (isUsed) { + controls.modeCombo()->setEnabled(!state); + } + } + ActuatorCommand *obj = ActuatorCommand::GetInstance(getObjectManager()); UAVObject::Metadata mdata = obj->getMetadata(); if (state) { @@ -418,8 +432,8 @@ void ConfigOutputWidget::refreshWidgetsValuesImpl(UAVObject *obj) controls.rateCombo()->setCurrentIndex(index); controls.rateCombo()->setEnabled(controls.modeCombo()->currentIndex() == ActuatorSettings::BANKMODE_PWM); setColor(controls.rateCombo(), controls.color()); - controls.modeCombo()->setEnabled(true); setColor(controls.modeCombo(), controls.color()); + controls.modeCombo()->setEnabled((inputCalibrationStarted || channelTestsStarted) ? false : true); i++; } @@ -698,6 +712,7 @@ void ConfigOutputWidget::checkOutputConfig() void ConfigOutputWidget::stopTests() { m_ui->channelOutTest->setChecked(false); + channelTestsStarted = false; } void ConfigOutputWidget::updateBoardWarnings(UAVObject *) @@ -778,11 +793,13 @@ QString ConfigOutputWidget::bankModeName(int index) void ConfigOutputWidget::inputCalibrationStatus(bool started) { + inputCalibrationStarted = started; + // Disable UI when a input calibration is started // so user cannot manipulate settings. enableControls(!started); - // Disable every channel form + // Disable every channel form when needed for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) { OutputChannelForm *form = getOutputChannelForm(i); form->ui->actuatorRev->setChecked(false); diff --git a/ground/gcs/src/plugins/config/configoutputwidget.h b/ground/gcs/src/plugins/config/configoutputwidget.h index 6313fff9c..1789da3e8 100644 --- a/ground/gcs/src/plugins/config/configoutputwidget.h +++ b/ground/gcs/src/plugins/config/configoutputwidget.h @@ -107,6 +107,7 @@ private: QList m_banks; bool inputCalibrationStarted; + bool channelTestsStarted; OutputChannelForm *getOutputChannelForm(const int index) const; void updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, QCheckBox *rev, int value); diff --git a/ground/gcs/src/plugins/config/outputchannelform.cpp b/ground/gcs/src/plugins/config/outputchannelform.cpp index 193e75e96..683469632 100644 --- a/ground/gcs/src/plugins/config/outputchannelform.cpp +++ b/ground/gcs/src/plugins/config/outputchannelform.cpp @@ -111,7 +111,7 @@ void OutputChannelForm::enableChannelTest(bool state) ui->actuatorMin->setEnabled(false); ui->actuatorMax->setEnabled(false); ui->actuatorRev->setEnabled(false); - } else if (m_mixerType != "Disabled") { + } else if (!isDisabledOutput()) { ui->actuatorMin->setEnabled(true); ui->actuatorMax->setEnabled(true); if (!isNormalMotor()) { @@ -332,10 +332,13 @@ void OutputChannelForm::reverseChannel(bool state) } /** - * Enable/Disable all UI controls + * Enable/Disable UI controls */ void OutputChannelForm::enableControls(bool state) { + if (isDisabledOutput()) { + state = false; + } ui->actuatorMin->setEnabled(state); ui->actuatorMax->setEnabled(state); ui->actuatorValue->setEnabled(state);