@@ -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
527527void 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
692691bool 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
722720void 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
0 commit comments