Skip to content

Commit a053c01

Browse files
committed
LP-551 Changes from review, change names and fix typos.
1 parent 5ecf3f2 commit a053c01

7 files changed

Lines changed: 90 additions & 86 deletions

File tree

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
7777
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
7878

7979
QWidget *widget;
80-
QWidget *inputWidget;
81-
QWidget *outputWidget;
8280
QIcon *icon;
8381

8482
icon = new QIcon();
@@ -100,15 +98,15 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
10098
widget = new ConfigInputWidget(this);
10199
static_cast<ConfigTaskWidget *>(widget)->bind();
102100
stackWidget->insertTab(ConfigGadgetWidget::Input, widget, *icon, QString("Input"));
103-
inputWidget = widget;
101+
QWidget *inputWidget = widget;
104102

105103
icon = new QIcon();
106104
icon->addFile(":/configgadget/images/output_normal.png", QSize(), QIcon::Normal, QIcon::Off);
107105
icon->addFile(":/configgadget/images/output_selected.png", QSize(), QIcon::Selected, QIcon::Off);
108106
widget = new ConfigOutputWidget(this);
109107
static_cast<ConfigTaskWidget *>(widget)->bind();
110108
stackWidget->insertTab(ConfigGadgetWidget::Output, widget, *icon, QString("Output"));
111-
outputWidget = widget;
109+
QWidget *outputWidget = widget;
112110

113111
icon = new QIcon();
114112
icon->addFile(":/configgadget/images/ins_normal.png", QSize(), QIcon::Normal, QIcon::Off);
@@ -169,10 +167,11 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
169167
onOPLinkConnect();
170168
}
171169

172-
// Connect output tab and input tab for safe
173-
// output config and input calibration
174-
connect(outputWidget, SIGNAL(outputConfigSafe(bool)), inputWidget, SLOT(outputConfigSafe(bool)));
175-
connect(inputWidget, SIGNAL(inputCalibrationStatus(bool)), outputWidget, SLOT(inputCalibrationStatus(bool)));
170+
// Connect output tab and input tab
171+
// Input tab do not start calibration if Output tab is not safe
172+
// Output tab uses the signal from Input tab and freeze all output UI while calibrating inputs
173+
connect(outputWidget, SIGNAL(outputConfigSafeChanged(bool)), inputWidget, SLOT(setOutputConfigSafe(bool)));
174+
connect(inputWidget, SIGNAL(inputCalibrationStateChanged(bool)), outputWidget, SLOT(setInputCalibrationState(bool)));
176175

177176
help = 0;
178177
connect(stackWidget, SIGNAL(currentAboutToShow(int, bool *)), this, SLOT(tabAboutToChange(int, bool *)));

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ void ConfigInputWidget::enableControls(bool enable)
505505
// Close manual calibration
506506
ui->runCalibration->setChecked(false);
507507
ui->runCalibration->setText(tr("Start Manual Calibration"));
508-
emit inputCalibrationStatus(false);
508+
emit inputCalibrationStateChanged(false);
509509
}
510510
}
511511
}
@@ -519,9 +519,9 @@ void ConfigInputWidget::resizeEvent(QResizeEvent *event)
519519

520520
void ConfigInputWidget::goToWizard()
521521
{
522-
if (!safeOutputConfig) {
523-
QMessageBox::warning(this, tr("Warning"), tr("There is something wrong in <b>Output tab</b>."
524-
"<p>Please fix the issue before starting the Transmitter wizard</p>"), QMessageBox::Ok);
522+
if (!outputConfigIsSafe) {
523+
QMessageBox::warning(this, tr("Warning"), tr("There is something wrong in <b>Output</b> tab."
524+
"<p>Please fix the issue before starting the Transmitter wizard.</p>"), QMessageBox::Ok);
525525
return;
526526
}
527527

@@ -536,7 +536,7 @@ void ConfigInputWidget::goToWizard()
536536
msgBox.exec();
537537

538538
// Tell Output tab we freeze actuators soon
539-
emit inputCalibrationStatus(true);
539+
emit inputCalibrationStateChanged(true);
540540

541541
// Set correct tab visible before starting wizard.
542542
if (ui->tabWidget->currentIndex() != 0) {
@@ -608,7 +608,7 @@ void ConfigInputWidget::wzCancel()
608608
systemSettingsObj->setData(memento.systemSettingsData);
609609

610610
// Tell Output tab the calibration is ended
611-
emit inputCalibrationStatus(false);
611+
emit inputCalibrationStateChanged(false);
612612
}
613613

614614
void ConfigInputWidget::registerControlActivity()
@@ -706,7 +706,7 @@ void ConfigInputWidget::wzNext()
706706
ui->tabWidget->setCurrentIndex(3);
707707

708708
// Tell Output tab the calibration is ended
709-
emit inputCalibrationStatus(false);
709+
emit inputCalibrationStateChanged(false);
710710
break;
711711
default:
712712
Q_ASSERT(0);
@@ -1897,7 +1897,7 @@ void ConfigInputWidget::updateConfigAlarmStatus()
18971897
switch (systemAlarms.ExtendedAlarmStatus[SystemAlarms::EXTENDEDALARMSTATUS_SYSTEMCONFIGURATION]) {
18981898
case SystemAlarms::EXTENDEDALARMSTATUS_FLIGHTMODE:
18991899
message = tr("Config error");
1900-
tooltipMessage = tr("There is something wrong with your config,\nusually a Thrust mode or Assisted mode not supported.\n\n"
1900+
tooltipMessage = tr("There is something wrong in the current config,\nusually a Thrust mode or Assisted mode not supported.\n\n"
19011901
"Tip: Reduce the Flight Mode Count to find the culprit.");
19021902
bgColor = "red";
19031903
}
@@ -1945,10 +1945,10 @@ void ConfigInputWidget::simpleCalibration(bool enable)
19451945
return;
19461946
}
19471947

1948-
if (!safeOutputConfig) {
1948+
if (!outputConfigIsSafe) {
19491949
if (enable) {
1950-
QMessageBox::warning(this, tr("Warning"), tr("There is something wrong in <b>Output tab</b>."
1951-
"<p>Please fix the issue before starting the Manual Calibration</p>"), QMessageBox::Ok);
1950+
QMessageBox::warning(this, tr("Warning"), tr("There is something wrong in <b>Output</b> tab."
1951+
"<p>Please fix the issue before starting the Manual Calibration.</p>"), QMessageBox::Ok);
19521952
ui->runCalibration->setChecked(false);
19531953
}
19541954
return;
@@ -1971,7 +1971,7 @@ void ConfigInputWidget::simpleCalibration(bool enable)
19711971
msgBox.exec();
19721972

19731973
// Tell Output tab we freeze actuators soon
1974-
emit inputCalibrationStatus(true);
1974+
emit inputCalibrationStateChanged(true);
19751975

19761976
manualCommandData = manualCommandObj->getData();
19771977

@@ -2041,7 +2041,7 @@ void ConfigInputWidget::simpleCalibration(bool enable)
20412041
ui->runCalibration->setText(tr("Start Manual Calibration"));
20422042

20432043
// Tell Output tab the calibration is ended
2044-
emit inputCalibrationStatus(false);
2044+
emit inputCalibrationStateChanged(false);
20452045

20462046
disconnect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject *)), this, SLOT(updateCalibration()));
20472047
}
@@ -2234,7 +2234,7 @@ void ConfigInputWidget::enableControlsChanged(bool enabled)
22342234
ui->failsafeBatteryCriticalFlightModeCb->setEnabled(enabled && batteryModuleEnabled);
22352235
}
22362236

2237-
void ConfigInputWidget::outputConfigSafe(bool status)
2237+
void ConfigInputWidget::setOutputConfigSafe(bool status)
22382238
{
2239-
safeOutputConfig = status;
2239+
outputConfigIsSafe = status;
22402240
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ class ConfigInputWidget : public ConfigTaskWidget {
7373
bool shouldObjectBeSaved(UAVObject *object);
7474

7575
public slots:
76-
void outputConfigSafe(bool status);
76+
void setOutputConfigSafe(bool status);
7777

7878
signals:
79-
void inputCalibrationStatus(bool started);
79+
void inputCalibrationStateChanged(bool newState);
8080

8181
private:
8282
bool throttleError;
8383
bool growing;
8484
bool reverse[ManualControlSettings::CHANNELNEUTRAL_NUMELEM];
85-
bool safeOutputConfig;
85+
bool outputConfigIsSafe;
8686
txMovements currentMovement;
8787
int movePos;
8888
void setTxMovement(txMovements movement);

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

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ void ConfigOutputWidget::runChannelTests(bool state)
193193
{
194194
if (!checkOutputConfig()) {
195195
m_ui->channelOutTest->setChecked(false);
196-
QMessageBox::warning(this, tr("Warning"), tr("There is something wrong in current config."
196+
QMessageBox::warning(this, tr("Warning"), tr("There is something wrong in the current config."
197197
"<p>Please fix the issue before starting testing outputs.</p>"), QMessageBox::Ok);
198198
return;
199199
}
@@ -233,13 +233,13 @@ void ConfigOutputWidget::runChannelTests(bool state)
233233
channelTestsStarted = state;
234234

235235
// Emit signal to be received by Input tab
236-
emit outputConfigSafe(!state);
236+
emit outputConfigSafeChanged(!state);
237237

238238
m_ui->spinningArmed->setEnabled(!state);
239239
m_ui->alwaysStabilizedSwitch->setEnabled((m_ui->spinningArmed->isChecked()) && !state);
240240
m_ui->alwayStabilizedLabel1->setEnabled((m_ui->spinningArmed->isChecked()) && !state);
241241
m_ui->alwayStabilizedLabel2->setEnabled((m_ui->spinningArmed->isChecked()) && !state);
242-
enableBanks(!state);
242+
setBanksEnabled(!state);
243243

244244
ActuatorCommand *obj = ActuatorCommand::GetInstance(getObjectManager());
245245
UAVObject::Metadata mdata = obj->getMetadata();
@@ -526,9 +526,9 @@ void ConfigOutputWidget::updateObjectsFromWidgetsImpl()
526526

527527
void ConfigOutputWidget::updateSpinStabilizeCheckComboBoxes()
528528
{
529-
m_ui->alwayStabilizedLabel1->setEnabled(m_ui->spinningArmed->isChecked());
530-
m_ui->alwayStabilizedLabel2->setEnabled(m_ui->spinningArmed->isChecked());
531-
m_ui->alwaysStabilizedSwitch->setEnabled(m_ui->spinningArmed->isChecked());
529+
m_ui->alwayStabilizedLabel1->setEnabled((m_ui->spinningArmed->isChecked()) && (m_ui->spinningArmed->isEnabled()));
530+
m_ui->alwayStabilizedLabel2->setEnabled((m_ui->spinningArmed->isChecked()) && (m_ui->spinningArmed->isEnabled()));
531+
m_ui->alwaysStabilizedSwitch->setEnabled((m_ui->spinningArmed->isChecked()) && (m_ui->spinningArmed->isEnabled()));
532532

533533
if (!m_ui->spinningArmed->isChecked()) {
534534
m_ui->alwaysStabilizedSwitch->setCurrentIndex(FlightModeSettings::ALWAYSSTABILIZEWHENARMEDSWITCH_DISABLED);
@@ -608,7 +608,7 @@ ConfigOutputWidget::ChannelConfigWarning ConfigOutputWidget::checkChannelConfig(
608608
int currentNeutralValue = channelForm->neutralValue();
609609

610610
// Check if RevMotor has neutral value around center
611-
if (channelForm->isReversableMotor()) {
611+
if (channelForm->isReversibleMotorOutput()) {
612612
warning = IsReversibleMotorCheckNeutral;
613613
int neutralDiff = qAbs(REVMOTOR_NEUTRAL_TARGET_VALUE - currentNeutralValue);
614614
if (neutralDiff < REVMOTOR_NEUTRAL_DIFF_VALUE) {
@@ -618,7 +618,7 @@ ConfigOutputWidget::ChannelConfigWarning ConfigOutputWidget::checkChannelConfig(
618618
}
619619

620620
// Check if NormalMotor neutral is not too high
621-
if (channelForm->isNormalMotor()) {
621+
if (channelForm->isNormalMotorOutput()) {
622622
warning = IsNormalMotorCheckNeutral;
623623
int neutralDiff = currentNeutralValue - DEFAULT_MINOUTPUT_VALUE;
624624
if (neutralDiff < MOTOR_NEUTRAL_DIFF_VALUE) {
@@ -632,7 +632,7 @@ ConfigOutputWidget::ChannelConfigWarning ConfigOutputWidget::checkChannelConfig(
632632
if (channelForm->isServoOutput()) {
633633
// Driving a servo using DShot doest not make sense
634634
warning = CannotDriveServo;
635-
} else if (channelForm->isReversableMotor()) {
635+
} else if (channelForm->isReversibleMotorOutput()) {
636636
// Bi-directional DShot not yet supported
637637
warning = BiDirectionalDShotNotSupported;
638638
}
@@ -659,8 +659,7 @@ void ConfigOutputWidget::onBankTypeChange()
659659
{
660660
QComboBox *bankModeCombo = qobject_cast<QComboBox *>(sender());
661661

662-
ChannelConfigWarning current_warning = None;
663-
ChannelConfigWarning warning_found = None;
662+
ChannelConfigWarning new_warning = None;
664663

665664
if (bankModeCombo != NULL) {
666665
int bankNumber = 1;
@@ -673,9 +672,9 @@ void ConfigOutputWidget::onBankTypeChange()
673672
foreach(OutputChannelForm * outputChannelForm, outputChannelForms) {
674673
if (outputChannelForm->bank().toInt() == bankNumber) {
675674
setChannelLimits(outputChannelForm, &controls);
676-
current_warning = checkChannelConfig(outputChannelForm, &controls);
677-
if (current_warning > None) {
678-
warning_found = current_warning;
675+
ChannelConfigWarning warning = checkChannelConfig(outputChannelForm, &controls);
676+
if (warning > None) {
677+
new_warning = warning;
679678
}
680679
}
681680
}
@@ -686,13 +685,12 @@ void ConfigOutputWidget::onBankTypeChange()
686685
}
687686
}
688687

689-
updateChannelConfigWarning(warning_found);
688+
updateChannelConfigWarning(new_warning);
690689
}
691690

692691
bool ConfigOutputWidget::checkOutputConfig()
693692
{
694-
ChannelConfigWarning current_warning = None;
695-
ChannelConfigWarning warning_found = None;
693+
ChannelConfigWarning new_warning = None;
696694

697695
int bankNumber = 1;
698696

@@ -701,22 +699,22 @@ bool ConfigOutputWidget::checkOutputConfig()
701699
foreach(OutputBankControls controls, m_banks) {
702700
foreach(OutputChannelForm * outputChannelForm, outputChannelForms) {
703701
if (!outputChannelForm->isDisabledOutput() && (outputChannelForm->bank().toInt() == bankNumber)) {
704-
current_warning = checkChannelConfig(outputChannelForm, &controls);
705-
if (current_warning > None) {
706-
warning_found = current_warning;
702+
ChannelConfigWarning warning = checkChannelConfig(outputChannelForm, &controls);
703+
if (warning > None) {
704+
new_warning = warning;
707705
}
708706
}
709707
}
710708

711709
bankNumber++;
712710
}
713711

714-
updateChannelConfigWarning(warning_found);
712+
updateChannelConfigWarning(new_warning);
715713

716714
// Emit signal to be received by Input tab
717-
emit outputConfigSafe(warning_found == None);
715+
emit outputConfigSafeChanged(new_warning == None);
718716

719-
return warning_found == None;
717+
return new_warning == None;
720718
}
721719

722720
void ConfigOutputWidget::stopTests()
@@ -749,29 +747,29 @@ void ConfigOutputWidget::updateChannelConfigWarning(ChannelConfigWarning warning
749747

750748
if (warning == BiDirectionalDShotNotSupported) {
751749
// TODO: Implement bi-directional DShot
752-
warning_str = "There is at least <b>one reversable motor using DShot</b> in your configuration.<br>"
753-
"Bi-directional DShot is not currently supported, you should use PWM, OneShotXXX or MultiShot.";
750+
warning_str = "There is <b>one reversible motor</b> using DShot is configured.<br>"
751+
"Bi-directional DShot is currently not supported. Please use PWM, OneShotXXX or MultiShot.";
754752
}
755753

756754
if (warning == IsNormalMotorCheckNeutral) {
757-
warning_str = "Seems there is at least one pretty <b>high neutral value</b> set in your configuration.<br>"
758-
"Be sure all Esc are calibrated and no mechanical stress in all motors.";
755+
warning_str = "There is at least one pretty <b>high neutral value</b> set in your configuration.<br>"
756+
"Make sure all ESCs are calibrated and no mechanical stress in all motors.";
759757
}
760758

761759
if (warning == IsReversibleMotorCheckNeutral) {
762-
warning_str = "There is at least one <b>reversable motor</b> in your configuration.<br>"
763-
"Be sure you set a appropriate neutral value before saving and applying power to the vehicule.";
760+
warning_str = "A least one <b>reversible motor</b> is configured.<br>"
761+
"Make sure a appropriate neutral value is set before saving and applying power to the vehicule.";
764762
}
765763

766764
if (warning == CannotDriveServo) {
767-
warning_str = "One Bank cannot drive a <b>servo output!</b><br>"
765+
warning_str = "One bank cannot drive a <b>servo output</b>!<br>"
768766
"You must use PWM for this bank or move the servo output to another compatible bank.";
769767
}
770768

771769
setConfigWarning(warning_str);
772770
}
773771

774-
void ConfigOutputWidget::enableBanks(bool state)
772+
void ConfigOutputWidget::setBanksEnabled(bool state)
775773
{
776774
// Disable/Enable banks
777775
for (int i = 0; i < m_banks.count(); i++) {
@@ -800,22 +798,27 @@ void ConfigOutputWidget::setConfigWarning(QString message)
800798
m_ui->configWarningTxt->setText(message);
801799
}
802800

803-
void ConfigOutputWidget::inputCalibrationStatus(bool started)
801+
void ConfigOutputWidget::setInputCalibrationState(bool started)
804802
{
805803
inputCalibrationStarted = started;
806804

807805
// Disable UI when a input calibration is started
808806
// so user cannot manipulate settings.
809807
enableControls(!started);
810-
enableBanks(!started);
808+
setBanksEnabled(!started);
809+
// Disable ASWA
810+
m_ui->spinningArmed->setEnabled(!started);
811+
m_ui->alwaysStabilizedSwitch->setEnabled((m_ui->spinningArmed->isChecked()) && !started);
812+
m_ui->alwayStabilizedLabel1->setEnabled((m_ui->spinningArmed->isChecked()) && !started);
813+
m_ui->alwayStabilizedLabel2->setEnabled((m_ui->spinningArmed->isChecked()) && !started);
811814

812815
// Disable every channel form when needed
813816
for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) {
814817
OutputChannelForm *form = getOutputChannelForm(i);
815818
form->ui->actuatorRev->setChecked(false);
816819
form->ui->actuatorLink->setChecked(false);
817-
form->inputCalibrationStatus(started);
818-
form->enableControls(!started);
820+
form->setChannelRangeEnabled(!started);
821+
form->setControlsEnabled(!started);
819822
}
820823
}
821824

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ class ConfigOutputWidget : public ConfigTaskWidget {
8686
~ConfigOutputWidget();
8787

8888
public slots:
89-
void inputCalibrationStatus(bool started);
89+
void setInputCalibrationState(bool state);
9090

9191
signals:
92-
void outputConfigSafe(bool status);
92+
void outputConfigSafeChanged(bool newStatus);
9393

9494
protected:
9595
void enableControls(bool enable);
@@ -106,7 +106,7 @@ public slots:
106106
UAVObject::Metadata m_accInitialData;
107107
QList<OutputBankControls> m_banks;
108108
int activeBanksCount;
109-
void enableBanks(bool state);
109+
void setBanksEnabled(bool state);
110110

111111
bool inputCalibrationStarted;
112112
bool channelTestsStarted;

0 commit comments

Comments
 (0)