@@ -509,6 +509,12 @@ void ConfigInputWidget::resizeEvent(QResizeEvent *event)
509509
510510void ConfigInputWidget::goToWizard ()
511511{
512+ if (!safeOutputConfig) {
513+ QMessageBox::warning (this , tr (" Warning" ), tr (" There is something wrong in <b>Output tab</b>."
514+ " <p>Please fix the issue before starting the Transmitter wizard</p>" ), QMessageBox::Ok);
515+ return ;
516+ }
517+
512518 QMessageBox msgBox;
513519
514520 msgBox.setText (tr (" Arming Settings are now set to 'Always Disarmed' for your safety." ));
@@ -519,6 +525,9 @@ void ConfigInputWidget::goToWizard()
519525 msgBox.setDefaultButton (QMessageBox::Ok);
520526 msgBox.exec ();
521527
528+ // Tell Output tab we freeze actuators soon
529+ emit inputCalibrationStatus (true );
530+
522531 // Set correct tab visible before starting wizard.
523532 if (ui->tabWidget ->currentIndex () != 0 ) {
524533 ui->tabWidget ->setCurrentIndex (0 );
@@ -587,6 +596,9 @@ void ConfigInputWidget::wzCancel()
587596 flightModeSettingsObj->setData (memento.flightModeSettingsData );
588597 actuatorSettingsObj->setData (memento.actuatorSettingsData );
589598 systemSettingsObj->setData (memento.systemSettingsData );
599+
600+ // Tell Output tab the calibration is ended
601+ emit inputCalibrationStatus (false );
590602}
591603
592604void ConfigInputWidget::registerControlActivity ()
@@ -682,6 +694,9 @@ void ConfigInputWidget::wzNext()
682694 // move to Arming Settings tab
683695 ui->stackedWidget ->setCurrentIndex (0 );
684696 ui->tabWidget ->setCurrentIndex (3 );
697+
698+ // Tell Output tab the calibration is ended
699+ emit inputCalibrationStatus (false );
685700 break ;
686701 default :
687702 Q_ASSERT (0 );
@@ -1916,6 +1931,15 @@ void ConfigInputWidget::updateCalibration()
19161931
19171932void ConfigInputWidget::simpleCalibration (bool enable)
19181933{
1934+ if (!safeOutputConfig) {
1935+ if (enable) {
1936+ QMessageBox::warning (this , tr (" Warning" ), tr (" There is something wrong in <b>Output tab</b>."
1937+ " <p>Please fix the issue before starting the Manual Calibration</p>" ), QMessageBox::Ok);
1938+ ui->runCalibration ->setChecked (false );
1939+ }
1940+ return ;
1941+ }
1942+
19191943 if (enable) {
19201944 ui->configurationWizard ->setEnabled (false );
19211945 ui->applyButton ->setEnabled (false );
@@ -1932,6 +1956,9 @@ void ConfigInputWidget::simpleCalibration(bool enable)
19321956 msgBox.setDefaultButton (QMessageBox::Ok);
19331957 msgBox.exec ();
19341958
1959+ // Tell Output tab we freeze actuators soon
1960+ emit inputCalibrationStatus (true );
1961+
19351962 manualCommandData = manualCommandObj->getData ();
19361963
19371964 manualSettingsData = manualSettingsObj->getData ();
@@ -1999,6 +2026,9 @@ void ConfigInputWidget::simpleCalibration(bool enable)
19992026 ui->saveButton ->setEnabled (true );
20002027 ui->runCalibration ->setText (tr (" Start Manual Calibration" ));
20012028
2029+ // Tell Output tab the calibration is ended
2030+ emit inputCalibrationStatus (false );
2031+
20022032 disconnect (manualCommandObj, SIGNAL (objectUnpacked (UAVObject *)), this , SLOT (updateCalibration ()));
20032033 }
20042034}
@@ -2082,7 +2112,7 @@ void ConfigInputWidget::resetActuatorSettings()
20822112 QString mixerType;
20832113
20842114 // Clear all output data : Min, max, neutral at same value
2085- // 1000 for motors and 1500 for all others (Reversable motor included )
2115+ // min value for motors and neutral for all others (Reversable motor, servo )
20862116 for (unsigned int output = 0 ; output < ActuatorSettings::CHANNELMAX_NUMELEM; output++) {
20872117 QString mixerNumType = QString (" Mixer%1Type" ).arg (output + 1 );
20882118 UAVObjectField *field = mixer->getField (mixerNumType);
@@ -2092,13 +2122,13 @@ void ConfigInputWidget::resetActuatorSettings()
20922122 mixerType = field->getValue ().toString ();
20932123 }
20942124 if ((mixerType == " Motor" ) || (mixerType == " Disabled" )) {
2095- actuatorSettingsData. ChannelMax [output] = 1000 ;
2096- actuatorSettingsData.ChannelMin [output] = 1000 ;
2097- actuatorSettingsData.ChannelNeutral [output] = 1000 ;
2125+ // Apply current min setting to neutral/max values
2126+ actuatorSettingsData.ChannelMax [output] = actuatorSettingsData. ChannelMin [output] ;
2127+ actuatorSettingsData.ChannelNeutral [output] = actuatorSettingsData. ChannelMin [output] ;
20982128 } else {
2099- actuatorSettingsData. ChannelMax [output] = 1500 ;
2100- actuatorSettingsData.ChannelMin [output] = 1500 ;
2101- actuatorSettingsData.ChannelNeutral [output] = 1500 ;
2129+ // Apply current neutral setting to min/max values
2130+ actuatorSettingsData.ChannelMax [output] = actuatorSettingsData. ChannelNeutral [output] ;
2131+ actuatorSettingsData.ChannelMin [output] = actuatorSettingsData. ChannelNeutral [output] ;
21022132 }
21032133 UAVObjectUpdaterHelper updateHelper;
21042134 actuatorSettingsObj->setData (actuatorSettingsData, false );
@@ -2189,3 +2219,8 @@ void ConfigInputWidget::enableControlsChanged(bool enabled)
21892219 ui->failsafeBatteryWarningFlightModeCb ->setEnabled (enabled && batteryModuleEnabled);
21902220 ui->failsafeBatteryCriticalFlightModeCb ->setEnabled (enabled && batteryModuleEnabled);
21912221}
2222+
2223+ void ConfigInputWidget::outputConfigSafe (bool status)
2224+ {
2225+ safeOutputConfig = status;
2226+ }
0 commit comments