1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-01 18:29:16 +01:00

OP-1222 Uncrustify

This commit is contained in:
m_thread 2014-08-26 22:34:58 +02:00
parent a4d2582cec
commit b31ee46724
14 changed files with 99 additions and 111 deletions

View File

@ -124,8 +124,8 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
Q_ASSERT(m_aircraft); Q_ASSERT(m_aircraft);
Q_ASSERT(plane); Q_ASSERT(plane);
// This had to be moved from ConfigFixedWingWidget() here since m_aircraft->fixedWingType->currentText() // This had to be moved from ConfigFixedWingWidget() here since m_aircraft->fixedWingType->currentText()
// did not seem to work properly to choose alternate .svg files. // did not seem to work properly to choose alternate .svg files.
m_aircraft->planeShape->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_aircraft->planeShape->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_aircraft->planeShape->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_aircraft->planeShape->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
QSvgRenderer *renderer = new QSvgRenderer(); QSvgRenderer *renderer = new QSvgRenderer();
@ -151,9 +151,8 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
m_aircraft->fwAileron2Label->setText("Aileron 2"); m_aircraft->fwAileron2Label->setText("Aileron 2");
m_aircraft->fwElevator1Label->setText("Elevator 1"); m_aircraft->fwElevator1Label->setText("Elevator 1");
m_aircraft->fwElevator2Label->setText("Elevator 2"); m_aircraft->fwElevator2Label->setText("Elevator 2");
} else if (frameType == "FixedWingVtail" || frameType == "Vtail") { } else if (frameType == "FixedWingVtail" || frameType == "Vtail") {
// do nothing for now // do nothing for now
} else if (frameType == "FixedWingElevon" || frameType == "Elevon") { } else if (frameType == "FixedWingElevon" || frameType == "Elevon") {
plane->setElementId("elevon"); plane->setElementId("elevon");
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Elevon")); setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Elevon"));
@ -187,7 +186,6 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
void ConfigFixedWingWidget::setupEnabledControls(QString frameType) void ConfigFixedWingWidget::setupEnabledControls(QString frameType)
{ {
// disable all motor channel boxes // disable all motor channel boxes
for (int i = 1; i <= 8; i++) { for (int i = 1; i <= 8; i++) {
// do it manually so we can turn off any error decorations // 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); enableComboBoxes(this, CHANNELBOXNAME, 3, true);
} else if (frameType == "aileron" || frameType == "Aileron") { } else if (frameType == "aileron" || frameType == "Aileron") {
enableComboBoxes(this, CHANNELBOXNAME, 4, true); enableComboBoxes(this, CHANNELBOXNAME, 4, true);
} }
} }
void ConfigFixedWingWidget::registerWidgets(ConfigTaskWidget &parent) void ConfigFixedWingWidget::registerWidgets(ConfigTaskWidget &parent)
@ -306,41 +304,38 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets()
motor_servo_List << "FixedWingThrottle" << "FixedWingPitch1" << "FixedWingPitch2" << "FixedWingRoll1" << "FixedWingRoll2" << "FixedWingYaw1" << "FixedWingYaw2"; motor_servo_List << "FixedWingThrottle" << "FixedWingPitch1" << "FixedWingPitch2" << "FixedWingRoll1" << "FixedWingRoll2" << "FixedWingYaw1" << "FixedWingYaw2";
setupMotors(motor_servo_List); setupMotors(motor_servo_List);
GUIConfigDataUnion config = getConfigData();
setConfigData(config);
m_aircraft->fwStatusLabel->setText(tr("Configuration OK")); GUIConfigDataUnion config = getConfigData();
setConfigData(config);
} m_aircraft->fwStatusLabel->setText(tr("Configuration OK"));
else if (m_aircraft->fixedWingType->currentText() == "elevon") { } else if (m_aircraft->fixedWingType->currentText() == "elevon") {
airframeType = "FixedWingElevon"; airframeType = "FixedWingElevon";
setupFrameElevon(airframeType); setupFrameElevon(airframeType);
motor_servo_List << "FixedWingThrottle" << "FixedWingRoll1" << "FixedWingRoll2"; motor_servo_List << "FixedWingThrottle" << "FixedWingRoll1" << "FixedWingRoll2";
setupMotors(motor_servo_List); setupMotors(motor_servo_List);
GUIConfigDataUnion config = getConfigData(); GUIConfigDataUnion config = getConfigData();
setConfigData(config); setConfigData(config);
// Elevon Layout: // Elevon Layout:
// pitch roll yaw // pitch roll yaw
double mixerMatrix[8][3] = { double mixerMatrix[8][3] = {
{ 0, 0, 0 }, { 0, 0, 0 },
{ 1, -1, 0 }, { 1, -1, 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 },
{ 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 } { 0, 0, 0 }
}; };
setupFixedWingElevonMixer(mixerMatrix); setupFixedWingElevonMixer(mixerMatrix);
m_aircraft->fwStatusLabel->setText(tr("Configuration OK"));
m_aircraft->fwStatusLabel->setText(tr("Configuration OK"));
} }
// Remove Feed Forward, it is pointless on a plane: // Remove Feed Forward, it is pointless on a plane:
setMixerValue(mixer, "FeedForward", 0.0); setMixerValue(mixer, "FeedForward", 0.0);
@ -383,8 +378,8 @@ void ConfigFixedWingWidget::setupMotors(QList<QString> motorList)
void ConfigFixedWingWidget::updateAirframe(QString frameType) void ConfigFixedWingWidget::updateAirframe(QString frameType)
{ {
qDebug() << "ConfigFixedWingWidget::updateAirframe - frame type" << 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->setSceneRect(plane->boundingRect());
m_aircraft->planeShape->fitInView(plane, Qt::KeepAspectRatio); m_aircraft->planeShape->fitInView(plane, Qt::KeepAspectRatio);
@ -481,7 +476,7 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
resetActuators(&config); resetActuators(&config);
config.fixedwing.FixedWingPitch1 = m_aircraft->fwElevator1ChannelBox->currentIndex(); 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.FixedWingRoll1 = m_aircraft->fwAileron1ChannelBox->currentIndex();
config.fixedwing.FixedWingRoll2 = m_aircraft->fwAileron2ChannelBox->currentIndex(); config.fixedwing.FixedWingRoll2 = m_aircraft->fwAileron2ChannelBox->currentIndex();
config.fixedwing.FixedWingThrottle = m_aircraft->fwEngineChannelBox->currentIndex(); config.fixedwing.FixedWingThrottle = m_aircraft->fwEngineChannelBox->currentIndex();
@ -508,11 +503,11 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1; channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1;
if (channel > -1) { if (channel > -1) {
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); 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; channel = m_aircraft->fwAileron2ChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, -127); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, -127);
} }
// elevon // elevon
@ -528,8 +523,6 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
m_aircraft->fwStatusLabel->setText("Mixer generated"); m_aircraft->fwStatusLabel->setText("Mixer generated");
return true; 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. 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<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings"))); UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer); Q_ASSERT(mixer);
@ -563,13 +557,13 @@ bool ConfigFixedWingWidget::setupFixedWingElevonMixer(double mixerFactors[8][3])
QList<QComboBox *> mmList; QList<QComboBox *> mmList;
mmList << m_aircraft->fwEngineChannelBox << m_aircraft->fwAileron1ChannelBox mmList << m_aircraft->fwEngineChannelBox << m_aircraft->fwAileron1ChannelBox
<< m_aircraft->fwAileron2ChannelBox << m_aircraft->fwElevator1ChannelBox << m_aircraft->fwAileron2ChannelBox << m_aircraft->fwElevator1ChannelBox
<< m_aircraft->fwElevator2ChannelBox; << m_aircraft->fwElevator2ChannelBox;
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
if (mmList.at(i)->isEnabled()) { if (mmList.at(i)->isEnabled()) {
int channel = mmList.at(i)->currentIndex() - 1; int channel = mmList.at(i)->currentIndex() - 1;
if (channel > -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 m_aircraft->fwElevator2ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true; error = true;
} else { } 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) { if (error) {
@ -672,4 +666,3 @@ void ConfigFixedWingWidget::enableControls(bool enable)
setupEnabledControls(m_aircraft->fixedWingType->currentText()); setupEnabledControls(m_aircraft->fixedWingType->currentText());
} }
} }

View File

@ -54,8 +54,8 @@ public:
virtual QString updateConfigObjectsFromWidgets(); virtual QString updateConfigObjectsFromWidgets();
void resetChannelboxesAndSliders(); void resetChannelboxesAndSliders();
protected: protected:
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event);
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
void enableControls(bool enable); void enableControls(bool enable);

View File

@ -481,11 +481,11 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
// get motor 2 value for Yaw and Roll // get motor 2 value for Yaw and Roll
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; 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)); setYawMixLevel(qRound(value / 1.27));
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27)); m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27));
} }
} else if (frameType == "HexaCoax") { } else if (frameType == "HexaCoax") {

View File

@ -74,7 +74,7 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
channelDesc = ConfigFixedWingWidget::getChannelDescriptions(); channelDesc = ConfigFixedWingWidget::getChannelDescriptions();
break; break;
case SystemSettings::AIRFRAMETYPE_FIXEDWINGVTAIL: 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(); // channelDesc = ConfigFixedWingWidget::getChannelDescriptions();
break; break;
case SystemSettings::AIRFRAMETYPE_HELICP: case SystemSettings::AIRFRAMETYPE_HELICP:

View File

@ -52,7 +52,7 @@ void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValu
m_outputChannel = channel; m_outputChannel = channel;
m_safeValue = safeValue; 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); ActuatorCommand *actuatorCommand = ActuatorCommand::GetInstance(m_uavObjectManager);
Q_ASSERT(actuatorCommand); Q_ASSERT(actuatorCommand);
@ -74,17 +74,17 @@ void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValu
actuatorCommand->setMetadata(metaData); actuatorCommand->setMetadata(metaData);
actuatorCommand->updated(); actuatorCommand->updated();
qDebug() << "Output for channel " << m_outputChannel+1 << " started."; qDebug() << "Output for channel " << m_outputChannel + 1 << " started.";
} }
} }
void OutputCalibrationUtil::stopChannelOutput() void OutputCalibrationUtil::stopChannelOutput()
{ {
if (m_outputChannel >= 0) { if (m_outputChannel >= 0) {
qDebug() << "Stopping output for channel " << m_outputChannel+1 << "..."; qDebug() << "Stopping output for channel " << m_outputChannel + 1 << "...";
// Stop output... // Stop output...
setChannelOutputValue(m_safeValue); 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 // Restore metadata to what it was before
ActuatorCommand *actuatorCommand = ActuatorCommand::GetInstance(m_uavObjectManager); ActuatorCommand *actuatorCommand = ActuatorCommand::GetInstance(m_uavObjectManager);
@ -93,7 +93,7 @@ void OutputCalibrationUtil::stopChannelOutput()
actuatorCommand->setMetadata(m_savedActuatorCommandMetadata); actuatorCommand->setMetadata(m_savedActuatorCommandMetadata);
actuatorCommand->updated(); actuatorCommand->updated();
qDebug() << "Output for channel " << m_outputChannel+1 << " stopped."; qDebug() << "Output for channel " << m_outputChannel + 1 << " stopped.";
m_outputChannel = -1; m_outputChannel = -1;
} }

View File

@ -60,7 +60,7 @@ void AirSpeedPage::initializePage()
updateImageAndDescription(); updateImageAndDescription();
} }
//TODO // TODO
bool AirSpeedPage::validatePage() bool AirSpeedPage::validatePage()
{ {
SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt(); 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(); fitInView();
} }
//TODO // TODO
void AirSpeedPage::setupAirSpeedPageTypesCombo() void AirSpeedPage::setupAirSpeedPageTypesCombo()
{ {
ui->typeCombo->addItem(tr("Aileron Dual Servos"), SetupWizard::FIXED_WING_DUAL_AILERON); ui->typeCombo->addItem(tr("Aileron Dual Servos"), SetupWizard::FIXED_WING_DUAL_AILERON);
@ -103,10 +103,9 @@ void AirSpeedPage::setupAirSpeedPageTypesCombo()
} }
void AirSpeedPage::updateAvailableTypes() void AirSpeedPage::updateAvailableTypes()
{ {}
}
//TODO // TODO
void AirSpeedPage::updateImageAndDescription() void AirSpeedPage::updateImageAndDescription()
{ {
SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt(); 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->typeGraphicsView->fitInView(m_airspeedPic, Qt::KeepAspectRatio);
ui->typeDescription->setText(description); ui->typeDescription->setText(description);
} }

View File

@ -62,7 +62,6 @@ private:
private slots: private slots:
void updateImageAndDescription(); void updateImageAndDescription();
}; };
#endif // AIRSPEEDPAGE_H #endif // AIRSPEEDPAGE_H

View File

@ -101,8 +101,7 @@ void FixedWingPage::setupFixedWingTypesCombo()
} }
void FixedWingPage::updateAvailableTypes() void FixedWingPage::updateAvailableTypes()
{ {}
}
void FixedWingPage::updateImageAndDescription() void FixedWingPage::updateImageAndDescription()
{ {
@ -129,5 +128,4 @@ void FixedWingPage::updateImageAndDescription()
ui->typeGraphicsView->fitInView(m_fixedwingPic, Qt::KeepAspectRatio); ui->typeGraphicsView->fitInView(m_fixedwingPic, Qt::KeepAspectRatio);
ui->typeDescription->setText(description); ui->typeDescription->setText(description);
} }

View File

@ -62,7 +62,6 @@ private:
private slots: private slots:
void updateImageAndDescription(); void updateImageAndDescription();
}; };
#endif // FIXEDWINGPAGE_H #endif // FIXEDWINGPAGE_H

View File

@ -30,7 +30,7 @@
#include "systemalarms.h" #include "systemalarms.h"
#include "uavobjectmanager.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"); const QString OutputCalibrationPage::FIXEDWING_SVG_FILE = QString(":/setupwizard/resources/fixedwing-shapes-wizard.svg");
OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *parent) : OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *parent) :
@ -42,8 +42,8 @@ OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *paren
qDebug() << "calling output calibration page"; qDebug() << "calling output calibration page";
m_vehicleRenderer = new QSvgRenderer(); m_vehicleRenderer = new QSvgRenderer();
// move the code that was here to setupVehicle() so we can determine which image to use. // move the code that was here to setupVehicle() so we can determine which image to use.
m_vehicleScene = new QGraphicsScene(this); m_vehicleScene = new QGraphicsScene(this);
ui->vehicleView->setScene(m_vehicleScene); ui->vehicleView->setScene(m_vehicleScene);
} }
@ -283,7 +283,7 @@ void OutputCalibrationPage::setWizardPage()
ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral);
} else if (currentPageIndex == 2) { } else if (currentPageIndex == 2) {
if (m_actuatorSettings[currentChannel].channelMax < m_actuatorSettings[currentChannel].channelMin && if (m_actuatorSettings[currentChannel].channelMax < m_actuatorSettings[currentChannel].channelMin &&
!ui->reverseCheckbox->isChecked()) { !ui->reverseCheckbox->isChecked()) {
ui->reverseCheckbox->setChecked(true); ui->reverseCheckbox->setChecked(true);
} else { } else {
ui->reverseCheckbox->setChecked(false); ui->reverseCheckbox->setChecked(false);
@ -369,7 +369,7 @@ void OutputCalibrationPage::on_motorNeutralButton_toggled(bool checked)
{ {
ui->motorNeutralButton->setText(checked ? tr("Stop") : tr("Start")); ui->motorNeutralButton->setText(checked ? tr("Stop") : tr("Start"));
ui->motorNeutralSlider->setEnabled(checked); ui->motorNeutralSlider->setEnabled(checked);
quint16 channel = getCurrentChannel(); quint16 channel = getCurrentChannel();
quint16 safeValue = m_actuatorSettings[channel].channelNeutral; quint16 safeValue = m_actuatorSettings[channel].channelNeutral;
onStartButtonToggle(ui->motorNeutralButton, channel, m_actuatorSettings[channel].channelNeutral, safeValue, ui->motorNeutralSlider); 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")); ui->servoButton->setText(checked ? tr("Stop") : tr("Start"));
quint16 channel = getCurrentChannel(); quint16 channel = getCurrentChannel();
quint16 safeValue = m_actuatorSettings[channel].channelNeutral; quint16 safeValue = m_actuatorSettings[channel].channelNeutral;
onStartButtonToggle(ui->servoButton, channel, safeValue, safeValue, ui->servoCenterAngleSlider); onStartButtonToggle(ui->servoButton, channel, safeValue, safeValue, ui->servoCenterAngleSlider);
} }
@ -497,17 +497,17 @@ void OutputCalibrationPage::on_servoMinAngleSlider_valueChanged(int position)
// Adjust neutral and max // Adjust neutral and max
if (ui->reverseCheckbox->isChecked()) { if (ui->reverseCheckbox->isChecked()) {
if(value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) { if (value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) {
ui->servoCenterAngleSlider->setValue(value); ui->servoCenterAngleSlider->setValue(value);
} }
if(value <= m_actuatorSettings[getCurrentChannel()].channelMax) { if (value <= m_actuatorSettings[getCurrentChannel()].channelMax) {
ui->servoMaxAngleSlider->setValue(value); ui->servoMaxAngleSlider->setValue(value);
} }
} else { } else {
if(value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) { if (value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) {
ui->servoCenterAngleSlider->setValue(value); ui->servoCenterAngleSlider->setValue(value);
} }
if(value >= m_actuatorSettings[getCurrentChannel()].channelMax) { if (value >= m_actuatorSettings[getCurrentChannel()].channelMax) {
ui->servoMaxAngleSlider->setValue(value); ui->servoMaxAngleSlider->setValue(value);
} }
} }
@ -523,17 +523,17 @@ void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position)
// Adjust neutral and min // Adjust neutral and min
if (ui->reverseCheckbox->isChecked()) { if (ui->reverseCheckbox->isChecked()) {
if(value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) { if (value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) {
ui->servoCenterAngleSlider->setValue(value); ui->servoCenterAngleSlider->setValue(value);
} }
if(value >= m_actuatorSettings[getCurrentChannel()].channelMin) { if (value >= m_actuatorSettings[getCurrentChannel()].channelMin) {
ui->servoMinAngleSlider->setValue(value); ui->servoMinAngleSlider->setValue(value);
} }
} else { } else {
if(value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) { if (value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) {
ui->servoCenterAngleSlider->setValue(value); ui->servoCenterAngleSlider->setValue(value);
} }
if(value <= m_actuatorSettings[getCurrentChannel()].channelMin) { if (value <= m_actuatorSettings[getCurrentChannel()].channelMin) {
ui->servoMinAngleSlider->setValue(value); ui->servoMinAngleSlider->setValue(value);
} }
} }

View File

@ -59,6 +59,6 @@ bool VehiclePage::validatePage()
void VehiclePage::initializePage() void VehiclePage::initializePage()
{ {
//ui->fixedwingButton->setEnabled(getWizard()->getControllerType() == SetupWizard::CONTROLLER_REVO || // ui->fixedwingButton->setEnabled(getWizard()->getControllerType() == SetupWizard::CONTROLLER_REVO ||
// getWizard()->getControllerType() == SetupWizard::CONTROLLER_NANO); // getWizard()->getControllerType() == SetupWizard::CONTROLLER_NANO);
} }

View File

@ -148,7 +148,8 @@ int SetupWizard::nextId() const
switch (getVehicleType()) { switch (getVehicleType()) {
case VEHICLE_FIXEDWING: case VEHICLE_FIXEDWING:
return PAGE_AIRFRAMESTAB_FIXEDWING; return PAGE_AIRFRAMESTAB_FIXEDWING;
//TODO: Pages for Multi and heli
// TODO: Pages for Multi and heli
case VEHICLE_MULTI: case VEHICLE_MULTI:
case VEHICLE_HELI: case VEHICLE_HELI:
case VEHICLE_SURFACE: case VEHICLE_SURFACE:
@ -255,7 +256,7 @@ QString SetupWizard::getSummaryText()
break; break;
case VEHICLE_FIXEDWING: case VEHICLE_FIXEDWING:
summary.append(tr("Fixed wing")); summary.append(tr("Fixed wing"));
summary.append("<br>"); summary.append("<br>");
summary.append("<b>").append(tr("Vehicle sub type: ")).append("</b>"); summary.append("<b>").append(tr("Vehicle sub type: ")).append("</b>");
@ -272,7 +273,7 @@ QString SetupWizard::getSummaryText()
default: default:
summary.append(tr("Unknown")); summary.append(tr("Unknown"));
break; break;
} }
break; break;
case VEHICLE_HELI: case VEHICLE_HELI:

View File

@ -40,10 +40,10 @@
#include "revocalibration.h" #include "revocalibration.h"
#include "accelgyrosettings.h" #include "accelgyrosettings.h"
const qint16 VehicleConfigurationHelper::LEGACY_ESC_FREQUENCE = 50; const qint16 VehicleConfigurationHelper::LEGACY_ESC_FREQUENCE = 50;
const qint16 VehicleConfigurationHelper::RAPID_ESC_FREQUENCE = 400; const qint16 VehicleConfigurationHelper::RAPID_ESC_FREQUENCE = 400;
const qint16 VehicleConfigurationHelper::ANALOG_SERVO_FREQUENCE = 50; const qint16 VehicleConfigurationHelper::ANALOG_SERVO_FREQUENCE = 50;
const qint16 VehicleConfigurationHelper::DIGITAL_SERVO_FREQUENCE = 333; const qint16 VehicleConfigurationHelper::DIGITAL_SERVO_FREQUENCE = 333;
VehicleConfigurationHelper::VehicleConfigurationHelper(VehicleConfigurationSource *configSource) VehicleConfigurationHelper::VehicleConfigurationHelper(VehicleConfigurationSource *configSource)
: m_configSource(configSource), m_uavoManager(0), : m_configSource(configSource), m_uavoManager(0),
@ -254,6 +254,7 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
ActuatorSettings *actSettings = ActuatorSettings::GetInstance(m_uavoManager); ActuatorSettings *actSettings = ActuatorSettings::GetInstance(m_uavoManager);
qint16 escFrequence = LEGACY_ESC_FREQUENCE; qint16 escFrequence = LEGACY_ESC_FREQUENCE;
switch (m_configSource->getEscType()) { switch (m_configSource->getEscType()) {
case VehicleConfigurationSource::ESC_STANDARD: case VehicleConfigurationSource::ESC_STANDARD:
escFrequence = LEGACY_ESC_FREQUENCE; escFrequence = LEGACY_ESC_FREQUENCE;
@ -302,7 +303,7 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
// Servo always on channel 4 // Servo always on channel 4
data.ChannelUpdateFreq[0] = escFrequence; data.ChannelUpdateFreq[0] = escFrequence;
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC || if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC ||
m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC3D) { m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC3D) {
data.ChannelUpdateFreq[1] = servoFrequence; data.ChannelUpdateFreq[1] = servoFrequence;
} else if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) { } else if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) {
data.ChannelUpdateFreq[1] = escFrequence; data.ChannelUpdateFreq[1] = escFrequence;
@ -1549,7 +1550,6 @@ void VehicleConfigurationHelper::setupOctoCopter()
void VehicleConfigurationHelper::setupElevon() void VehicleConfigurationHelper::setupElevon()
{ {
mixerChannelSettings channels[10]; mixerChannelSettings channels[10];
GUIConfigDataUnion guiSettings = getGUIConfigData(); GUIConfigDataUnion guiSettings = getGUIConfigData();
@ -1559,7 +1559,7 @@ void VehicleConfigurationHelper::setupElevon()
channels[2].throttle2 = 0; channels[2].throttle2 = 0;
channels[2].roll = 0; channels[2].roll = 0;
channels[2].pitch = 0; channels[2].pitch = 0;
channels[2].yaw = 0; channels[2].yaw = 0;
// Elevon Servo 1 (Chan 1) // Elevon Servo 1 (Chan 1)
channels[0].type = MIXER_TYPE_SERVO; channels[0].type = MIXER_TYPE_SERVO;
@ -1567,7 +1567,7 @@ void VehicleConfigurationHelper::setupElevon()
channels[0].throttle2 = 0; channels[0].throttle2 = 0;
channels[0].roll = -100; channels[0].roll = -100;
channels[0].pitch = 100; channels[0].pitch = 100;
channels[0].yaw = 0; channels[0].yaw = 0;
// Elevon Servo 1 (Chan 2) // Elevon Servo 1 (Chan 2)
channels[1].type = MIXER_TYPE_SERVO; channels[1].type = MIXER_TYPE_SERVO;
@ -1575,11 +1575,11 @@ void VehicleConfigurationHelper::setupElevon()
channels[1].throttle2 = 0; channels[1].throttle2 = 0;
channels[1].roll = 100; channels[1].roll = 100;
channels[1].pitch = -100; channels[1].pitch = -100;
channels[1].yaw = 0; channels[1].yaw = 0;
guiSettings.fixedwing.FixedWingThrottle = 3; guiSettings.fixedwing.FixedWingThrottle = 3;
guiSettings.fixedwing.FixedWingPitch1 = 1; guiSettings.fixedwing.FixedWingPitch1 = 1;
guiSettings.fixedwing.FixedWingPitch2 = 2; guiSettings.fixedwing.FixedWingPitch2 = 2;
applyMixerConfiguration(channels); applyMixerConfiguration(channels);
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON, guiSettings); applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON, guiSettings);
@ -1601,7 +1601,7 @@ void VehicleConfigurationHelper::setupDualAileron()
channels[2].throttle2 = 0; channels[2].throttle2 = 0;
channels[2].roll = 0; channels[2].roll = 0;
channels[2].pitch = 0; channels[2].pitch = 0;
channels[2].yaw = 0; channels[2].yaw = 0;
// Aileron Servo 1 (Chan 1) // Aileron Servo 1 (Chan 1)
channels[0].type = MIXER_TYPE_SERVO; channels[0].type = MIXER_TYPE_SERVO;
@ -1609,7 +1609,7 @@ void VehicleConfigurationHelper::setupDualAileron()
channels[0].throttle2 = 0; channels[0].throttle2 = 0;
channels[0].roll = -100; channels[0].roll = -100;
channels[0].pitch = 0; channels[0].pitch = 0;
channels[0].yaw = 0; channels[0].yaw = 0;
// Aileron Servo 2 (Chan 6) // Aileron Servo 2 (Chan 6)
channels[5].type = MIXER_TYPE_SERVO; channels[5].type = MIXER_TYPE_SERVO;
@ -1617,7 +1617,7 @@ void VehicleConfigurationHelper::setupDualAileron()
channels[5].throttle2 = 0; channels[5].throttle2 = 0;
channels[5].roll = 100; channels[5].roll = 100;
channels[5].pitch = 0; channels[5].pitch = 0;
channels[5].yaw = 0; channels[5].yaw = 0;
// Elevator Servo (Chan 2) // Elevator Servo (Chan 2)
channels[1].type = MIXER_TYPE_SERVO; channels[1].type = MIXER_TYPE_SERVO;
@ -1625,7 +1625,7 @@ void VehicleConfigurationHelper::setupDualAileron()
channels[1].throttle2 = 0; channels[1].throttle2 = 0;
channels[1].roll = 0; channels[1].roll = 0;
channels[1].pitch = 100; channels[1].pitch = 100;
channels[1].yaw = 0; channels[1].yaw = 0;
// Rudder Servo (Chan 4) // Rudder Servo (Chan 4)
channels[3].type = MIXER_TYPE_SERVO; channels[3].type = MIXER_TYPE_SERVO;
@ -1633,13 +1633,13 @@ void VehicleConfigurationHelper::setupDualAileron()
channels[3].throttle2 = 0; channels[3].throttle2 = 0;
channels[3].roll = 0; channels[3].roll = 0;
channels[3].pitch = 0; channels[3].pitch = 0;
channels[3].yaw = 100; channels[3].yaw = 100;
guiSettings.fixedwing.FixedWingThrottle = 3; guiSettings.fixedwing.FixedWingThrottle = 3;
guiSettings.fixedwing.FixedWingRoll1 = 1; guiSettings.fixedwing.FixedWingRoll1 = 1;
guiSettings.fixedwing.FixedWingRoll2 = 6; guiSettings.fixedwing.FixedWingRoll2 = 6;
guiSettings.fixedwing.FixedWingPitch1 = 2; guiSettings.fixedwing.FixedWingPitch1 = 2;
guiSettings.fixedwing.FixedWingYaw1 = 4; guiSettings.fixedwing.FixedWingYaw1 = 4;
applyMixerConfiguration(channels); applyMixerConfiguration(channels);
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWING, guiSettings); applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWING, guiSettings);
@ -1661,7 +1661,7 @@ void VehicleConfigurationHelper::setupAileron()
channels[2].throttle2 = 0; channels[2].throttle2 = 0;
channels[2].roll = 0; channels[2].roll = 0;
channels[2].pitch = 0; channels[2].pitch = 0;
channels[2].yaw = 0; channels[2].yaw = 0;
// Aileron Servo (Chan 1) // Aileron Servo (Chan 1)
channels[0].type = MIXER_TYPE_SERVO; channels[0].type = MIXER_TYPE_SERVO;
@ -1669,7 +1669,7 @@ void VehicleConfigurationHelper::setupAileron()
channels[0].throttle2 = 0; channels[0].throttle2 = 0;
channels[0].roll = 100; channels[0].roll = 100;
channels[0].pitch = 0; channels[0].pitch = 0;
channels[0].yaw = 0; channels[0].yaw = 0;
// Elevator Servo (Chan 2) // Elevator Servo (Chan 2)
channels[1].type = MIXER_TYPE_SERVO; channels[1].type = MIXER_TYPE_SERVO;
@ -1677,7 +1677,7 @@ void VehicleConfigurationHelper::setupAileron()
channels[1].throttle2 = 0; channels[1].throttle2 = 0;
channels[1].roll = 0; channels[1].roll = 0;
channels[1].pitch = 100; channels[1].pitch = 100;
channels[1].yaw = 0; channels[1].yaw = 0;
// Rudder Servo (Chan 4) // Rudder Servo (Chan 4)
channels[3].type = MIXER_TYPE_SERVO; channels[3].type = MIXER_TYPE_SERVO;
@ -1685,12 +1685,12 @@ void VehicleConfigurationHelper::setupAileron()
channels[3].throttle2 = 0; channels[3].throttle2 = 0;
channels[3].roll = 0; channels[3].roll = 0;
channels[3].pitch = 0; channels[3].pitch = 0;
channels[3].yaw = 100; channels[3].yaw = 100;
guiSettings.fixedwing.FixedWingThrottle = 3; guiSettings.fixedwing.FixedWingThrottle = 3;
guiSettings.fixedwing.FixedWingRoll1 = 1; guiSettings.fixedwing.FixedWingRoll1 = 1;
guiSettings.fixedwing.FixedWingPitch1 = 2; guiSettings.fixedwing.FixedWingPitch1 = 2;
guiSettings.fixedwing.FixedWingYaw1 = 4; guiSettings.fixedwing.FixedWingYaw1 = 4;
applyMixerConfiguration(channels); applyMixerConfiguration(channels);
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWING, guiSettings); applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWING, guiSettings);

View File

@ -72,8 +72,8 @@ public:
virtual VehicleConfigurationSource::VEHICLE_TYPE getVehicleType() const = 0; virtual VehicleConfigurationSource::VEHICLE_TYPE getVehicleType() const = 0;
virtual VehicleConfigurationSource::VEHICLE_SUB_TYPE getVehicleSubType() const = 0; virtual VehicleConfigurationSource::VEHICLE_SUB_TYPE getVehicleSubType() const = 0;
virtual VehicleConfigurationSource::INPUT_TYPE getInputType() const = 0; virtual VehicleConfigurationSource::INPUT_TYPE getInputType() const = 0;
virtual VehicleConfigurationSource::ESC_TYPE getEscType() const = 0; virtual VehicleConfigurationSource::ESC_TYPE getEscType() const = 0;
virtual VehicleConfigurationSource::SERVO_TYPE getServoType() const = 0; virtual VehicleConfigurationSource::SERVO_TYPE getServoType() const = 0;
virtual VehicleConfigurationSource::GPS_SETTING getGPSSetting() const = 0; virtual VehicleConfigurationSource::GPS_SETTING getGPSSetting() const = 0;
virtual VehicleConfigurationSource::RADIO_SETTING getRadioSetting() const = 0; virtual VehicleConfigurationSource::RADIO_SETTING getRadioSetting() const = 0;