mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
LP-551 Disable Bank manipulation while testing output or calibrating inputs
This commit is contained in:
parent
f93ebd4891
commit
b5bce33ce2
@ -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);
|
||||
|
@ -107,6 +107,7 @@ private:
|
||||
QList<OutputBankControls> m_banks;
|
||||
|
||||
bool inputCalibrationStarted;
|
||||
bool channelTestsStarted;
|
||||
|
||||
OutputChannelForm *getOutputChannelForm(const int index) const;
|
||||
void updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, QCheckBox *rev, int value);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user