Skip to content

Commit f93ebd4

Browse files
committed
LP-551 Really disable all UI in Output tab while calibrating inputs
1 parent 5f72771 commit f93ebd4

3 files changed

Lines changed: 52 additions & 12 deletions

File tree

ground/gcs/src/plugins/config/configoutputwidget.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,18 @@ QString ConfigOutputWidget::bankModeName(int index)
778778

779779
void ConfigOutputWidget::inputCalibrationStatus(bool started)
780780
{
781-
// Disable controls if a input calibration is started
781+
// Disable UI when a input calibration is started
782+
// so user cannot manipulate settings.
782783
enableControls(!started);
784+
785+
// Disable every channel form
786+
for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) {
787+
OutputChannelForm *form = getOutputChannelForm(i);
788+
form->ui->actuatorRev->setChecked(false);
789+
form->ui->actuatorLink->setChecked(false);
790+
form->inputCalibrationStatus(started);
791+
form->enableControls(!started);
792+
}
783793
}
784794

785795
OutputBankControls::OutputBankControls(MixerSettings *mixer, QLabel *label, QColor color, QComboBox *rateCombo, QComboBox *modeCombo) :

ground/gcs/src/plugins/config/outputchannelform.cpp

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <QDebug>
3232

3333
OutputChannelForm::OutputChannelForm(const int index, QWidget *parent) :
34-
ChannelForm(index, parent), ui(new Ui::outputChannelForm), m_inChannelTest(false)
34+
ChannelForm(index, parent), ui(new Ui::outputChannelForm), m_inChannelTest(false), m_isCalibratingInput(false)
3535
{
3636
ui->setupUi(this);
3737

@@ -120,6 +120,17 @@ void OutputChannelForm::enableChannelTest(bool state)
120120
}
121121
}
122122

123+
/**
124+
* Update the input calibration status
125+
*/
126+
void OutputChannelForm::inputCalibrationStatus(bool state)
127+
{
128+
if (m_isCalibratingInput == state) {
129+
return;
130+
}
131+
m_isCalibratingInput = state;
132+
}
133+
123134
/**
124135
* Toggles the channel linked state for use in testing mode
125136
*/
@@ -242,21 +253,18 @@ void OutputChannelForm::setChannelRange()
242253
setLimits(1000, 1000, 1000, 1000);
243254
ui->actuatorMin->setValue(1000);
244255
ui->actuatorMax->setValue(1000);
245-
ui->actuatorMin->setEnabled(false);
246-
ui->actuatorMax->setEnabled(false);
247-
ui->actuatorRev->setEnabled(false);
248-
ui->actuatorLink->setEnabled(false);
249-
ui->actuatorValue->setEnabled(false);
250256
ui->actuatorRev->setChecked(false);
251257
ui->actuatorLink->setChecked(false);
258+
enableControls(false);
252259
return;
253260
}
254261

255-
ui->actuatorMin->setEnabled(true);
256-
ui->actuatorMax->setEnabled(true);
257-
ui->actuatorNeutral->setEnabled(true);
258-
ui->actuatorValue->setEnabled(true);
259-
ui->actuatorLink->setEnabled(true);
262+
if (m_isCalibratingInput) {
263+
// Nothing to do here
264+
return;
265+
}
266+
267+
enableControls(true);
260268

261269
int minValue = ui->actuatorMin->value();
262270
int maxValue = ui->actuatorMax->value();
@@ -323,6 +331,25 @@ void OutputChannelForm::reverseChannel(bool state)
323331
}
324332
}
325333

334+
/**
335+
* Enable/Disable all UI controls
336+
*/
337+
void OutputChannelForm::enableControls(bool state)
338+
{
339+
ui->actuatorMin->setEnabled(state);
340+
ui->actuatorMax->setEnabled(state);
341+
ui->actuatorValue->setEnabled(state);
342+
ui->actuatorLink->setEnabled(state);
343+
// Reverse checkbox will be never checked
344+
// or enabled for normal motor
345+
if (isNormalMotor()) {
346+
ui->actuatorRev->setChecked(false);
347+
ui->actuatorRev->setEnabled(false);
348+
} else {
349+
ui->actuatorRev->setEnabled(state);
350+
}
351+
}
352+
326353
/**
327354
* Emits the channel value which will be send to the UAV to move the servo.
328355
* Returns immediately if we are not in testing mode.

ground/gcs/src/plugins/config/outputchannelform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public slots:
6161
void setNeutral(int value);
6262
void setRange(int minimum, int maximum);
6363
void enableChannelTest(bool state);
64+
void inputCalibrationStatus(bool state);
65+
void enableControls(bool state);
6466
QString outputMixerType();
6567
void setLimits(int actuatorMinMinimum, int actuatorMinMaximum, int actuatorMaxMinimum, int actuatorMaxMaximum);
6668
int neutralValue();
@@ -75,6 +77,7 @@ public slots:
7577
private:
7678
Ui::outputChannelForm *ui;
7779
bool m_inChannelTest;
80+
bool m_isCalibratingInput;
7881
QString m_mixerType;
7982

8083
private slots:

0 commit comments

Comments
 (0)