diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index 30750d807..bbf625e2e 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -67,42 +67,42 @@ void OutputCalibrationPage::setupVehicle() switch(getWizard()->getVehicleSubType()) { case SetupWizard::MULTI_ROTOR_TRI_Y: - m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 3 << 4 << 5; + m_wizardIndexes << 0 << 1 << 1 << 1 << 2 << 3 << 4; m_vehicleElementIds << "tri" << "tri-frame" << "tri-m1" << "tri-m2" << "tri-m3" << "tri-s1"; - m_vehicleHighlightElementIndexes << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 4; - m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 3; + m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 4 << 4; + m_channelIndex << 0 << 0 << 1 << 2 << 3 << 3 << 3; m_actuatorSettings[4].channelMin = 1500; m_actuatorSettings[4].channelMax = 1500; break; case SetupWizard::MULTI_ROTOR_QUAD_X: - m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2; + m_wizardIndexes << 0 << 1 << 1 << 1 << 1; m_vehicleElementIds << "quad-x" << "quad-x-frame" << "quad-x-m1" << "quad-x-m2" << "quad-x-m3" << "quad-x-m4"; - m_vehicleHighlightElementIndexes << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4; - m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3; + m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4; + m_channelIndex << 0 << 0 << 1 << 2 << 3; break; case SetupWizard::MULTI_ROTOR_QUAD_PLUS: - m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2; + m_wizardIndexes << 0 << 1 << 1 << 1 << 1; m_vehicleElementIds << "quad-p" << "quad-p-frame" << "quad-p-m1" << "quad-p-m2" << "quad-p-m3" << "quad-p-m4"; - m_vehicleHighlightElementIndexes << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4; - m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3; + m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4; + m_channelIndex << 0 << 0 << 1 << 2 << 3; break; case SetupWizard::MULTI_ROTOR_HEXA: - m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2; + m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1; m_vehicleElementIds << "hexa" << "hexa-frame" << "hexa-m1" << "hexa-m2" << "hexa-m3" << "hexa-m4" << "hexa-m5" << "hexa-m6"; - m_vehicleHighlightElementIndexes << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 5 << 5 << 6 << 6; - m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 5 << 5; + m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6; + m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5; break; case SetupWizard::MULTI_ROTOR_HEXA_COAX_Y: - m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2; + m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1; m_vehicleElementIds << "hexa-y6" << "hexa-y6-frame" << "hexa-y6-m2" << "hexa-y6-m1" << "hexa-y6-m4" << "hexa-y6-m3" << "hexa-y6-m6" << "hexa-y6-m5"; - m_vehicleHighlightElementIndexes << 0 << 2 << 2 << 1 << 1 << 4 << 4 << 3 << 3 << 6 << 6 << 5 << 5; - m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 5 << 5; + m_vehicleHighlightElementIndexes << 0 << 2 << 1 << 4 << 3 << 6 << 5; + m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5; break; case SetupWizard::MULTI_ROTOR_HEXA_H: - m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2; + m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1; m_vehicleElementIds << "hexa-h" << "hexa-h-frame" << "hexa-h-m1" << "hexa-h-m2" << "hexa-h-m3" << "hexa-h-m4" << "hexa-h-m5" << "hexa-h-m6"; - m_vehicleHighlightElementIndexes << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 5 << 5 << 6 << 6; - m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 5 << 5; + m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6; + m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5; break; default: break; @@ -184,16 +184,13 @@ void OutputCalibrationPage::setWizardPage() if(currentPageIndex == 1) { ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); } - else if (currentPageIndex == 2) { - ui->motorMaxSlider->setValue(m_actuatorSettings[currentChannel].channelMax); - } - else if(currentPageIndex == 3) { + else if(currentPageIndex == 2) { ui->servoCenterSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); } - else if(currentPageIndex == 4) { + else if(currentPageIndex == 3) { ui->servoMinAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMin); } - else if(currentPageIndex == 5) { + else if(currentPageIndex == 4) { ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax); } } @@ -246,8 +243,8 @@ quint16 OutputCalibrationPage::getCurrentChannel() void OutputCalibrationPage::enableButtons(bool enable) { - ui->nextPageButton->setEnabled(enable); - ui->backPageButton->setEnabled(enable); + ui->nextPageButton->setEnabled(enable && (m_currentWizardIndex < m_wizardIndexes.size() - 1)); + ui->backPageButton->setEnabled(enable && (m_currentWizardIndex > 0)); getWizard()->button(QWizard::NextButton)->setEnabled(enable); getWizard()->button(QWizard::CancelButton)->setEnabled(enable); getWizard()->button(QWizard::BackButton)->setEnabled(enable); @@ -313,22 +310,6 @@ void OutputCalibrationPage::on_motorNeutralSlider_valueChanged(int value) } } -void OutputCalibrationPage::on_motorMaxButton_toggled(bool checked) -{ - ui->motorMaxButton->setText(checked ? tr("Stop") : tr("Start")); - quint16 channel = getCurrentChannel(); - onStartButtonToggle(ui->motorMaxButton, channel, m_actuatorSettings[channel].channelMax, 1000, ui->motorMaxSlider); -} - -void OutputCalibrationPage::on_motorMaxSlider_valueChanged(int position) -{ - if(ui->motorMaxButton->isChecked()) { - quint16 value = ui->motorMaxSlider->value(); - m_calibrationUtil->setChannelOutputValue(value); - m_actuatorSettings[getCurrentChannel()].channelMax = value; - } -} - void OutputCalibrationPage::on_servoCenterButton_toggled(bool checked) { ui->servoCenterButton->setText(checked ? tr("Stop") : tr("Start")); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h index c67bff74b..f66e29e88 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h @@ -58,9 +58,6 @@ private slots: void on_motorNeutralButton_toggled(bool checked); void on_motorNeutralSlider_valueChanged(int value); - void on_motorMaxButton_toggled(bool checked); - void on_motorMaxSlider_valueChanged(int position); - void on_servoCenterButton_toggled(bool checked); void on_servoCenterSlider_valueChanged(int position); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui index f3c0652e2..470a79c4b 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui @@ -36,7 +36,7 @@ - 5 + 2 @@ -136,89 +136,6 @@ - - - - - 90 - 240 - 75 - 23 - - - - Start - - - true - - - false - - - - - - 0 - 10 - 261 - 171 - - - - <html><head/><body><p>Now it is time to find out the maximum rate for the motor highlighted in the illustration to the right. </p><p>To find the maximum rate for this engine, press the Start button below and slide the slider to the left until the engine just starts to slow down.</p><p>Running a brushless motor for a long time without proper cooling can in theory damage it. Therefore do not leave the motor running at full rate longer than neccesary.<br/><br/>When done press button again to stop.</p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - false - - - - 10 - 200 - 241 - 19 - - - - 1400 - - - 2000 - - - 10 - - - 20 - - - 2000 - - - Qt::Horizontal - - - false - - - false - - - QSlider::TicksBelow - - - 20 - - - @@ -550,25 +467,9 @@ - motorMaxButton + servoMinAngleButton toggled(bool) - motorMaxSlider - setEnabled(bool) - - - 147 - 291 - - - 150 - 249 - - - - - servoCenterButton - toggled(bool) - servoCenterSlider + servoMinAngleSlider setEnabled(bool) @@ -598,9 +499,9 @@ - servoMinAngleButton + servoCenterButton toggled(bool) - servoMinAngleSlider + servoCenterSlider setEnabled(bool) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h index f84d02316..41aca3e28 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h @@ -47,7 +47,7 @@ struct actuatorChannelSettings { quint16 channelMax; //Default values - actuatorChannelSettings(): channelMin(1000), channelNeutral(1080), channelMax(1800) {} + actuatorChannelSettings(): channelMin(1000), channelNeutral(1080), channelMax(1900) {} };