From b31ee46724d0016bf9c54f494438d0380d23510b Mon Sep 17 00:00:00 2001 From: m_thread Date: Tue, 26 Aug 2014 22:34:58 +0200 Subject: [PATCH] OP-1222 Uncrustify --- .../configfixedwingwidget.cpp | 75 +++++++++---------- .../cfg_vehicletypes/configfixedwingwidget.h | 4 +- .../configmultirotorwidget.cpp | 6 +- .../config/configvehicletypewidget.cpp | 2 +- .../setupwizard/outputcalibrationutil.cpp | 10 +-- .../setupwizard/pages/airspeedpage.cpp | 10 +-- .../plugins/setupwizard/pages/airspeedpage.h | 1 - .../setupwizard/pages/fixedwingpage.cpp | 4 +- .../plugins/setupwizard/pages/fixedwingpage.h | 1 - .../pages/outputcalibrationpage.cpp | 28 +++---- .../plugins/setupwizard/pages/vehiclepage.cpp | 4 +- .../src/plugins/setupwizard/setupwizard.cpp | 7 +- .../vehicleconfigurationhelper.cpp | 54 ++++++------- .../setupwizard/vehicleconfigurationsource.h | 4 +- 14 files changed, 99 insertions(+), 111 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp index 948d99dfa..43291e243 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp @@ -124,8 +124,8 @@ void ConfigFixedWingWidget::setupUI(QString frameType) Q_ASSERT(m_aircraft); Q_ASSERT(plane); - // This had to be moved from ConfigFixedWingWidget() here since m_aircraft->fixedWingType->currentText() - // did not seem to work properly to choose alternate .svg files. + // This had to be moved from ConfigFixedWingWidget() here since m_aircraft->fixedWingType->currentText() + // did not seem to work properly to choose alternate .svg files. m_aircraft->planeShape->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_aircraft->planeShape->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); QSvgRenderer *renderer = new QSvgRenderer(); @@ -151,9 +151,8 @@ void ConfigFixedWingWidget::setupUI(QString frameType) m_aircraft->fwAileron2Label->setText("Aileron 2"); m_aircraft->fwElevator1Label->setText("Elevator 1"); m_aircraft->fwElevator2Label->setText("Elevator 2"); - } else if (frameType == "FixedWingVtail" || frameType == "Vtail") { - // do nothing for now + // do nothing for now } else if (frameType == "FixedWingElevon" || frameType == "Elevon") { plane->setElementId("elevon"); setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Elevon")); @@ -187,7 +186,6 @@ void ConfigFixedWingWidget::setupUI(QString frameType) void ConfigFixedWingWidget::setupEnabledControls(QString frameType) { - // disable all motor channel boxes for (int i = 1; i <= 8; i++) { // do it manually so we can turn off any error decorations @@ -204,7 +202,7 @@ void ConfigFixedWingWidget::setupEnabledControls(QString frameType) enableComboBoxes(this, CHANNELBOXNAME, 3, true); } else if (frameType == "aileron" || frameType == "Aileron") { enableComboBoxes(this, CHANNELBOXNAME, 4, true); - } + } } void ConfigFixedWingWidget::registerWidgets(ConfigTaskWidget &parent) @@ -306,41 +304,38 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets() motor_servo_List << "FixedWingThrottle" << "FixedWingPitch1" << "FixedWingPitch2" << "FixedWingRoll1" << "FixedWingRoll2" << "FixedWingYaw1" << "FixedWingYaw2"; setupMotors(motor_servo_List); - - GUIConfigDataUnion config = getConfigData(); - setConfigData(config); - m_aircraft->fwStatusLabel->setText(tr("Configuration OK")); + GUIConfigDataUnion config = getConfigData(); + setConfigData(config); - } - else if (m_aircraft->fixedWingType->currentText() == "elevon") { + m_aircraft->fwStatusLabel->setText(tr("Configuration OK")); + } else if (m_aircraft->fixedWingType->currentText() == "elevon") { airframeType = "FixedWingElevon"; setupFrameElevon(airframeType); motor_servo_List << "FixedWingThrottle" << "FixedWingRoll1" << "FixedWingRoll2"; setupMotors(motor_servo_List); - - GUIConfigDataUnion config = getConfigData(); - setConfigData(config); + + GUIConfigDataUnion config = getConfigData(); + setConfigData(config); // Elevon Layout: // pitch roll yaw double mixerMatrix[8][3] = { - { 0, 0, 0 }, - { 1, -1, 0 }, - { -1, 1, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 } + { 0, 0, 0 }, + { 1, -1, 0 }, + { -1, 1, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 } }; - setupFixedWingElevonMixer(mixerMatrix); - - m_aircraft->fwStatusLabel->setText(tr("Configuration OK")); + setupFixedWingElevonMixer(mixerMatrix); + m_aircraft->fwStatusLabel->setText(tr("Configuration OK")); } - + // Remove Feed Forward, it is pointless on a plane: setMixerValue(mixer, "FeedForward", 0.0); @@ -383,8 +378,8 @@ void ConfigFixedWingWidget::setupMotors(QList motorList) void ConfigFixedWingWidget::updateAirframe(QString frameType) { qDebug() << "ConfigFixedWingWidget::updateAirframe - frame type" << frameType; - - // this is not doing anything right now + + // this is not doing anything right now m_aircraft->planeShape->setSceneRect(plane->boundingRect()); m_aircraft->planeShape->fitInView(plane, Qt::KeepAspectRatio); @@ -481,7 +476,7 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType) resetActuators(&config); config.fixedwing.FixedWingPitch1 = m_aircraft->fwElevator1ChannelBox->currentIndex(); - config.fixedwing.FixedWingPitch2 = m_aircraft->fwElevator2ChannelBox->currentIndex(); + config.fixedwing.FixedWingPitch2 = m_aircraft->fwElevator2ChannelBox->currentIndex(); config.fixedwing.FixedWingRoll1 = m_aircraft->fwAileron1ChannelBox->currentIndex(); config.fixedwing.FixedWingRoll2 = m_aircraft->fwAileron2ChannelBox->currentIndex(); config.fixedwing.FixedWingThrottle = m_aircraft->fwEngineChannelBox->currentIndex(); @@ -508,11 +503,11 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType) channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1; if (channel > -1) { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); - setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, 127); + setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, 127); channel = m_aircraft->fwAileron2ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); - setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, -127); + setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, -127); } // elevon @@ -528,8 +523,6 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType) m_aircraft->fwStatusLabel->setText("Mixer generated"); return true; - - } /** @@ -549,8 +542,9 @@ void ConfigFixedWingWidget::setupElevonServo(int channel, double pitch, double r /** This function sets up the elevon fixed wing mixer values. - */ -bool ConfigFixedWingWidget::setupFixedWingElevonMixer(double mixerFactors[8][3]){ + */ +bool ConfigFixedWingWidget::setupFixedWingElevonMixer(double mixerFactors[8][3]) +{ UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); Q_ASSERT(mixer); @@ -563,13 +557,13 @@ bool ConfigFixedWingWidget::setupFixedWingElevonMixer(double mixerFactors[8][3]) QList mmList; mmList << m_aircraft->fwEngineChannelBox << m_aircraft->fwAileron1ChannelBox << m_aircraft->fwAileron2ChannelBox << m_aircraft->fwElevator1ChannelBox - << m_aircraft->fwElevator2ChannelBox; + << m_aircraft->fwElevator2ChannelBox; for (int i = 0; i < 8; i++) { if (mmList.at(i)->isEnabled()) { int channel = mmList.at(i)->currentIndex() - 1; if (channel > -1) { - setupElevonServo(channel, mixerFactors[i][0] * pFactor, rFactor * mixerFactors[i][1]); + setupElevonServo(channel, mixerFactors[i][0] * pFactor, rFactor * mixerFactors[i][1]); } } } @@ -635,9 +629,9 @@ bool ConfigFixedWingWidget::throwConfigError(QString airframeType) m_aircraft->fwElevator2ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes error = true; } else { - m_aircraft->fwElevator2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes + m_aircraft->fwElevator2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes } -*/ + */ } if (error) { @@ -672,4 +666,3 @@ void ConfigFixedWingWidget::enableControls(bool enable) setupEnabledControls(m_aircraft->fixedWingType->currentText()); } } - diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h index 295be3b4c..9fd56f8aa 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h @@ -54,8 +54,8 @@ public: virtual QString updateConfigObjectsFromWidgets(); void resetChannelboxesAndSliders(); -protected: - void showEvent(QShowEvent *event); +protected: + void showEvent(QShowEvent *event); void resizeEvent(QResizeEvent *event); void enableControls(bool enable); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp index 8216ca7d3..42b06f4d0 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp @@ -481,11 +481,11 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) // get motor 2 value for Yaw and Roll channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; - value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); + value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); setYawMixLevel(qRound(value / 1.27)); - channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; - value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); + channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; + value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27)); } } else if (frameType == "HexaCoax") { diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp index 44b4dcc4a..e113a921c 100644 --- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp @@ -74,7 +74,7 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions() channelDesc = ConfigFixedWingWidget::getChannelDescriptions(); break; case SystemSettings::AIRFRAMETYPE_FIXEDWINGVTAIL: - // do nothing for vtail support for the time being. + // do nothing for vtail support for the time being. // channelDesc = ConfigFixedWingWidget::getChannelDescriptions(); break; case SystemSettings::AIRFRAMETYPE_HELICP: diff --git a/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.cpp b/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.cpp index 9cbf911fb..a4cee9d88 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.cpp @@ -52,7 +52,7 @@ void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValu m_outputChannel = channel; m_safeValue = safeValue; - qDebug() << "Starting output for channel " << m_outputChannel+1 << "..."; + qDebug() << "Starting output for channel " << m_outputChannel + 1 << "..."; ActuatorCommand *actuatorCommand = ActuatorCommand::GetInstance(m_uavObjectManager); Q_ASSERT(actuatorCommand); @@ -74,17 +74,17 @@ void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValu actuatorCommand->setMetadata(metaData); actuatorCommand->updated(); - qDebug() << "Output for channel " << m_outputChannel+1 << " started."; + qDebug() << "Output for channel " << m_outputChannel + 1 << " started."; } } void OutputCalibrationUtil::stopChannelOutput() { if (m_outputChannel >= 0) { - qDebug() << "Stopping output for channel " << m_outputChannel+1 << "..."; + qDebug() << "Stopping output for channel " << m_outputChannel + 1 << "..."; // Stop output... setChannelOutputValue(m_safeValue); - qDebug() << "Settings output for channel " << m_outputChannel+1 << " to " << m_safeValue; + qDebug() << "Settings output for channel " << m_outputChannel + 1 << " to " << m_safeValue; // Restore metadata to what it was before ActuatorCommand *actuatorCommand = ActuatorCommand::GetInstance(m_uavObjectManager); @@ -93,7 +93,7 @@ void OutputCalibrationUtil::stopChannelOutput() actuatorCommand->setMetadata(m_savedActuatorCommandMetadata); actuatorCommand->updated(); - qDebug() << "Output for channel " << m_outputChannel+1 << " stopped."; + qDebug() << "Output for channel " << m_outputChannel + 1 << " stopped."; m_outputChannel = -1; } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.cpp index de8ab0bcd..3c7834e2d 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.cpp @@ -60,7 +60,7 @@ void AirSpeedPage::initializePage() updateImageAndDescription(); } -//TODO +// TODO bool AirSpeedPage::validatePage() { SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt(); @@ -89,7 +89,7 @@ void AirSpeedPage::showEvent(QShowEvent *event) fitInView(); } -//TODO +// TODO void AirSpeedPage::setupAirSpeedPageTypesCombo() { ui->typeCombo->addItem(tr("Aileron Dual Servos"), SetupWizard::FIXED_WING_DUAL_AILERON); @@ -103,10 +103,9 @@ void AirSpeedPage::setupAirSpeedPageTypesCombo() } void AirSpeedPage::updateAvailableTypes() -{ -} +{} -//TODO +// TODO void AirSpeedPage::updateImageAndDescription() { SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt(); @@ -132,5 +131,4 @@ void AirSpeedPage::updateImageAndDescription() ui->typeGraphicsView->fitInView(m_airspeedPic, Qt::KeepAspectRatio); ui->typeDescription->setText(description); - } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.h index 757d25661..0e3940c67 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.h @@ -62,7 +62,6 @@ private: private slots: void updateImageAndDescription(); - }; #endif // AIRSPEEDPAGE_H diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.cpp index bc8e96d05..3574887d8 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.cpp @@ -101,8 +101,7 @@ void FixedWingPage::setupFixedWingTypesCombo() } void FixedWingPage::updateAvailableTypes() -{ -} +{} void FixedWingPage::updateImageAndDescription() { @@ -129,5 +128,4 @@ void FixedWingPage::updateImageAndDescription() ui->typeGraphicsView->fitInView(m_fixedwingPic, Qt::KeepAspectRatio); ui->typeDescription->setText(description); - } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.h index 5c50adcba..e74d91f67 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.h @@ -62,7 +62,6 @@ private: private slots: void updateImageAndDescription(); - }; #endif // FIXEDWINGPAGE_H diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index 385e4705b..41f92770e 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -30,7 +30,7 @@ #include "systemalarms.h" #include "uavobjectmanager.h" -const QString OutputCalibrationPage::MULTI_SVG_FILE = QString(":/setupwizard/resources/multirotor-shapes.svg"); +const QString OutputCalibrationPage::MULTI_SVG_FILE = QString(":/setupwizard/resources/multirotor-shapes.svg"); const QString OutputCalibrationPage::FIXEDWING_SVG_FILE = QString(":/setupwizard/resources/fixedwing-shapes-wizard.svg"); OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *parent) : @@ -42,8 +42,8 @@ OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *paren qDebug() << "calling output calibration page"; m_vehicleRenderer = new QSvgRenderer(); - // move the code that was here to setupVehicle() so we can determine which image to use. - m_vehicleScene = new QGraphicsScene(this); + // move the code that was here to setupVehicle() so we can determine which image to use. + m_vehicleScene = new QGraphicsScene(this); ui->vehicleView->setScene(m_vehicleScene); } @@ -283,7 +283,7 @@ void OutputCalibrationPage::setWizardPage() ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); } else if (currentPageIndex == 2) { if (m_actuatorSettings[currentChannel].channelMax < m_actuatorSettings[currentChannel].channelMin && - !ui->reverseCheckbox->isChecked()) { + !ui->reverseCheckbox->isChecked()) { ui->reverseCheckbox->setChecked(true); } else { ui->reverseCheckbox->setChecked(false); @@ -369,7 +369,7 @@ void OutputCalibrationPage::on_motorNeutralButton_toggled(bool checked) { ui->motorNeutralButton->setText(checked ? tr("Stop") : tr("Start")); ui->motorNeutralSlider->setEnabled(checked); - quint16 channel = getCurrentChannel(); + quint16 channel = getCurrentChannel(); quint16 safeValue = m_actuatorSettings[channel].channelNeutral; onStartButtonToggle(ui->motorNeutralButton, channel, m_actuatorSettings[channel].channelNeutral, safeValue, ui->motorNeutralSlider); } @@ -457,7 +457,7 @@ void OutputCalibrationPage::on_servoButton_toggled(bool checked) { ui->servoButton->setText(checked ? tr("Stop") : tr("Start")); quint16 channel = getCurrentChannel(); - quint16 safeValue = m_actuatorSettings[channel].channelNeutral; + quint16 safeValue = m_actuatorSettings[channel].channelNeutral; onStartButtonToggle(ui->servoButton, channel, safeValue, safeValue, ui->servoCenterAngleSlider); } @@ -497,17 +497,17 @@ void OutputCalibrationPage::on_servoMinAngleSlider_valueChanged(int position) // Adjust neutral and max if (ui->reverseCheckbox->isChecked()) { - if(value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + if (value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) { ui->servoCenterAngleSlider->setValue(value); } - if(value <= m_actuatorSettings[getCurrentChannel()].channelMax) { + if (value <= m_actuatorSettings[getCurrentChannel()].channelMax) { ui->servoMaxAngleSlider->setValue(value); } } else { - if(value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + if (value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) { ui->servoCenterAngleSlider->setValue(value); } - if(value >= m_actuatorSettings[getCurrentChannel()].channelMax) { + if (value >= m_actuatorSettings[getCurrentChannel()].channelMax) { ui->servoMaxAngleSlider->setValue(value); } } @@ -523,17 +523,17 @@ void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position) // Adjust neutral and min if (ui->reverseCheckbox->isChecked()) { - if(value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + if (value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) { ui->servoCenterAngleSlider->setValue(value); } - if(value >= m_actuatorSettings[getCurrentChannel()].channelMin) { + if (value >= m_actuatorSettings[getCurrentChannel()].channelMin) { ui->servoMinAngleSlider->setValue(value); } } else { - if(value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + if (value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) { ui->servoCenterAngleSlider->setValue(value); } - if(value <= m_actuatorSettings[getCurrentChannel()].channelMin) { + if (value <= m_actuatorSettings[getCurrentChannel()].channelMin) { ui->servoMinAngleSlider->setValue(value); } } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/vehiclepage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/vehiclepage.cpp index a9c476cdc..6f1e25359 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/vehiclepage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/vehiclepage.cpp @@ -59,6 +59,6 @@ bool VehiclePage::validatePage() void VehiclePage::initializePage() { - //ui->fixedwingButton->setEnabled(getWizard()->getControllerType() == SetupWizard::CONTROLLER_REVO || - // getWizard()->getControllerType() == SetupWizard::CONTROLLER_NANO); + // ui->fixedwingButton->setEnabled(getWizard()->getControllerType() == SetupWizard::CONTROLLER_REVO || + // getWizard()->getControllerType() == SetupWizard::CONTROLLER_NANO); } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp index d18e59345..4598f02f9 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp @@ -148,7 +148,8 @@ int SetupWizard::nextId() const switch (getVehicleType()) { case VEHICLE_FIXEDWING: return PAGE_AIRFRAMESTAB_FIXEDWING; - //TODO: Pages for Multi and heli + + // TODO: Pages for Multi and heli case VEHICLE_MULTI: case VEHICLE_HELI: case VEHICLE_SURFACE: @@ -255,7 +256,7 @@ QString SetupWizard::getSummaryText() break; case VEHICLE_FIXEDWING: - summary.append(tr("Fixed wing")); + summary.append(tr("Fixed wing")); summary.append("
"); summary.append("").append(tr("Vehicle sub type: ")).append(""); @@ -272,7 +273,7 @@ QString SetupWizard::getSummaryText() default: summary.append(tr("Unknown")); break; - } + } break; case VEHICLE_HELI: diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index 148604c47..c5c8b8536 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -40,10 +40,10 @@ #include "revocalibration.h" #include "accelgyrosettings.h" -const qint16 VehicleConfigurationHelper::LEGACY_ESC_FREQUENCE = 50; -const qint16 VehicleConfigurationHelper::RAPID_ESC_FREQUENCE = 400; -const qint16 VehicleConfigurationHelper::ANALOG_SERVO_FREQUENCE = 50; -const qint16 VehicleConfigurationHelper::DIGITAL_SERVO_FREQUENCE = 333; +const qint16 VehicleConfigurationHelper::LEGACY_ESC_FREQUENCE = 50; +const qint16 VehicleConfigurationHelper::RAPID_ESC_FREQUENCE = 400; +const qint16 VehicleConfigurationHelper::ANALOG_SERVO_FREQUENCE = 50; +const qint16 VehicleConfigurationHelper::DIGITAL_SERVO_FREQUENCE = 333; VehicleConfigurationHelper::VehicleConfigurationHelper(VehicleConfigurationSource *configSource) : m_configSource(configSource), m_uavoManager(0), @@ -254,6 +254,7 @@ void VehicleConfigurationHelper::applyActuatorConfiguration() ActuatorSettings *actSettings = ActuatorSettings::GetInstance(m_uavoManager); qint16 escFrequence = LEGACY_ESC_FREQUENCE; + switch (m_configSource->getEscType()) { case VehicleConfigurationSource::ESC_STANDARD: escFrequence = LEGACY_ESC_FREQUENCE; @@ -302,7 +303,7 @@ void VehicleConfigurationHelper::applyActuatorConfiguration() // Servo always on channel 4 data.ChannelUpdateFreq[0] = escFrequence; if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC || - m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC3D) { + m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC3D) { data.ChannelUpdateFreq[1] = servoFrequence; } else if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) { data.ChannelUpdateFreq[1] = escFrequence; @@ -1549,7 +1550,6 @@ void VehicleConfigurationHelper::setupOctoCopter() void VehicleConfigurationHelper::setupElevon() { - mixerChannelSettings channels[10]; GUIConfigDataUnion guiSettings = getGUIConfigData(); @@ -1559,7 +1559,7 @@ void VehicleConfigurationHelper::setupElevon() channels[2].throttle2 = 0; channels[2].roll = 0; channels[2].pitch = 0; - channels[2].yaw = 0; + channels[2].yaw = 0; // Elevon Servo 1 (Chan 1) channels[0].type = MIXER_TYPE_SERVO; @@ -1567,7 +1567,7 @@ void VehicleConfigurationHelper::setupElevon() channels[0].throttle2 = 0; channels[0].roll = -100; channels[0].pitch = 100; - channels[0].yaw = 0; + channels[0].yaw = 0; // Elevon Servo 1 (Chan 2) channels[1].type = MIXER_TYPE_SERVO; @@ -1575,11 +1575,11 @@ void VehicleConfigurationHelper::setupElevon() channels[1].throttle2 = 0; channels[1].roll = 100; channels[1].pitch = -100; - channels[1].yaw = 0; + channels[1].yaw = 0; guiSettings.fixedwing.FixedWingThrottle = 3; - guiSettings.fixedwing.FixedWingPitch1 = 1; - guiSettings.fixedwing.FixedWingPitch2 = 2; + guiSettings.fixedwing.FixedWingPitch1 = 1; + guiSettings.fixedwing.FixedWingPitch2 = 2; applyMixerConfiguration(channels); applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON, guiSettings); @@ -1601,7 +1601,7 @@ void VehicleConfigurationHelper::setupDualAileron() channels[2].throttle2 = 0; channels[2].roll = 0; channels[2].pitch = 0; - channels[2].yaw = 0; + channels[2].yaw = 0; // Aileron Servo 1 (Chan 1) channels[0].type = MIXER_TYPE_SERVO; @@ -1609,7 +1609,7 @@ void VehicleConfigurationHelper::setupDualAileron() channels[0].throttle2 = 0; channels[0].roll = -100; channels[0].pitch = 0; - channels[0].yaw = 0; + channels[0].yaw = 0; // Aileron Servo 2 (Chan 6) channels[5].type = MIXER_TYPE_SERVO; @@ -1617,7 +1617,7 @@ void VehicleConfigurationHelper::setupDualAileron() channels[5].throttle2 = 0; channels[5].roll = 100; channels[5].pitch = 0; - channels[5].yaw = 0; + channels[5].yaw = 0; // Elevator Servo (Chan 2) channels[1].type = MIXER_TYPE_SERVO; @@ -1625,7 +1625,7 @@ void VehicleConfigurationHelper::setupDualAileron() channels[1].throttle2 = 0; channels[1].roll = 0; channels[1].pitch = 100; - channels[1].yaw = 0; + channels[1].yaw = 0; // Rudder Servo (Chan 4) channels[3].type = MIXER_TYPE_SERVO; @@ -1633,13 +1633,13 @@ void VehicleConfigurationHelper::setupDualAileron() channels[3].throttle2 = 0; channels[3].roll = 0; channels[3].pitch = 0; - channels[3].yaw = 100; + channels[3].yaw = 100; guiSettings.fixedwing.FixedWingThrottle = 3; - guiSettings.fixedwing.FixedWingRoll1 = 1; - guiSettings.fixedwing.FixedWingRoll2 = 6; - guiSettings.fixedwing.FixedWingPitch1 = 2; - guiSettings.fixedwing.FixedWingYaw1 = 4; + guiSettings.fixedwing.FixedWingRoll1 = 1; + guiSettings.fixedwing.FixedWingRoll2 = 6; + guiSettings.fixedwing.FixedWingPitch1 = 2; + guiSettings.fixedwing.FixedWingYaw1 = 4; applyMixerConfiguration(channels); applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWING, guiSettings); @@ -1661,7 +1661,7 @@ void VehicleConfigurationHelper::setupAileron() channels[2].throttle2 = 0; channels[2].roll = 0; channels[2].pitch = 0; - channels[2].yaw = 0; + channels[2].yaw = 0; // Aileron Servo (Chan 1) channels[0].type = MIXER_TYPE_SERVO; @@ -1669,7 +1669,7 @@ void VehicleConfigurationHelper::setupAileron() channels[0].throttle2 = 0; channels[0].roll = 100; channels[0].pitch = 0; - channels[0].yaw = 0; + channels[0].yaw = 0; // Elevator Servo (Chan 2) channels[1].type = MIXER_TYPE_SERVO; @@ -1677,7 +1677,7 @@ void VehicleConfigurationHelper::setupAileron() channels[1].throttle2 = 0; channels[1].roll = 0; channels[1].pitch = 100; - channels[1].yaw = 0; + channels[1].yaw = 0; // Rudder Servo (Chan 4) channels[3].type = MIXER_TYPE_SERVO; @@ -1685,12 +1685,12 @@ void VehicleConfigurationHelper::setupAileron() channels[3].throttle2 = 0; channels[3].roll = 0; channels[3].pitch = 0; - channels[3].yaw = 100; + channels[3].yaw = 100; guiSettings.fixedwing.FixedWingThrottle = 3; - guiSettings.fixedwing.FixedWingRoll1 = 1; - guiSettings.fixedwing.FixedWingPitch1 = 2; - guiSettings.fixedwing.FixedWingYaw1 = 4; + guiSettings.fixedwing.FixedWingRoll1 = 1; + guiSettings.fixedwing.FixedWingPitch1 = 2; + guiSettings.fixedwing.FixedWingYaw1 = 4; applyMixerConfiguration(channels); applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWING, guiSettings); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h index 2102bf4d9..f666a1d35 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h @@ -72,8 +72,8 @@ public: virtual VehicleConfigurationSource::VEHICLE_TYPE getVehicleType() const = 0; virtual VehicleConfigurationSource::VEHICLE_SUB_TYPE getVehicleSubType() const = 0; virtual VehicleConfigurationSource::INPUT_TYPE getInputType() const = 0; - virtual VehicleConfigurationSource::ESC_TYPE getEscType() const = 0; - virtual VehicleConfigurationSource::SERVO_TYPE getServoType() const = 0; + virtual VehicleConfigurationSource::ESC_TYPE getEscType() const = 0; + virtual VehicleConfigurationSource::SERVO_TYPE getServoType() const = 0; virtual VehicleConfigurationSource::GPS_SETTING getGPSSetting() const = 0; virtual VehicleConfigurationSource::RADIO_SETTING getRadioSetting() const = 0;