1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

LP-467 config vehicle: remove uneeded QString constructor calls

This commit is contained in:
Philippe Renon 2017-01-15 12:41:14 +01:00
parent 9b928c075d
commit ad59634b4f
5 changed files with 178 additions and 178 deletions

View File

@ -57,7 +57,7 @@ QStringList ConfigCcpmWidget::getChannelDescriptions()
QStringList channelDesc;
for (int i = 0; i < (int)ConfigCcpmWidget::CHANNEL_NUMELEM; i++) {
channelDesc.append(QString("-"));
channelDesc.append("-");
}
// get the gui config data
@ -65,64 +65,64 @@ QStringList ConfigCcpmWidget::getChannelDescriptions()
heliGUISettingsStruct heli = configData.heli;
if (heli.Throttle > 0) {
channelDesc[heli.Throttle - 1] = QString("Throttle");
channelDesc[heli.Throttle - 1] = "Throttle";
}
if (heli.Tail > 0) {
channelDesc[heli.Tail - 1] = QString("Tail");
channelDesc[heli.Tail - 1] = "Tail";
}
switch (heli.FirstServoIndex) {
case 0:
// front
if (heli.ServoIndexW > 0) {
channelDesc[heli.ServoIndexW - 1] = QString("Elevator");
channelDesc[heli.ServoIndexW - 1] = "Elevator";
}
if (heli.ServoIndexX > 0) {
channelDesc[heli.ServoIndexX - 1] = QString("Roll1");
channelDesc[heli.ServoIndexX - 1] = "Roll1";
}
if (heli.ServoIndexY > 0) {
channelDesc[heli.ServoIndexY - 1] = QString("Roll2");
channelDesc[heli.ServoIndexY - 1] = "Roll2";
}
break;
case 1:
// right
if (heli.ServoIndexW > 0) {
channelDesc[heli.ServoIndexW - 1] = QString("ServoW");
channelDesc[heli.ServoIndexW - 1] = "ServoW";
}
if (heli.ServoIndexX > 0) {
channelDesc[heli.ServoIndexX - 1] = QString("ServoX");
channelDesc[heli.ServoIndexX - 1] = "ServoX";
}
if (heli.ServoIndexY > 0) {
channelDesc[heli.ServoIndexY - 1] = QString("ServoY");
channelDesc[heli.ServoIndexY - 1] = "ServoY";
}
break;
case 2:
// rear
if (heli.ServoIndexW > 0) {
channelDesc[heli.ServoIndexW - 1] = QString("Elevator");
channelDesc[heli.ServoIndexW - 1] = "Elevator";
}
if (heli.ServoIndexX > 0) {
channelDesc[heli.ServoIndexX - 1] = QString("Roll1");
channelDesc[heli.ServoIndexX - 1] = "Roll1";
}
if (heli.ServoIndexY > 0) {
channelDesc[heli.ServoIndexY - 1] = QString("Roll2");
channelDesc[heli.ServoIndexY - 1] = "Roll2";
}
break;
case 3:
// left
if (heli.ServoIndexW > 0) {
channelDesc[heli.ServoIndexW - 1] = QString("ServoW");
channelDesc[heli.ServoIndexW - 1] = "ServoW";
}
if (heli.ServoIndexX > 0) {
channelDesc[heli.ServoIndexX - 1] = QString("ServoX");
channelDesc[heli.ServoIndexX - 1] = "ServoX";
}
if (heli.ServoIndexY > 0) {
channelDesc[heli.ServoIndexY - 1] = QString("ServoY");
channelDesc[heli.ServoIndexY - 1] = "ServoY";
}
break;
}
if (heli.ServoIndexZ > 0) {
channelDesc[heli.ServoIndexZ - 1] = QString("ServoZ");
channelDesc[heli.ServoIndexZ - 1] = "ServoZ";
}
return channelDesc;
}
@ -196,7 +196,7 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) :
ServosText[i] = new QGraphicsTextItem();
ServosText[i]->setDefaultTextColor(Qt::yellow);
ServosText[i]->setPlainText(QString("-"));
ServosText[i]->setPlainText("-");
ServosText[i]->setFont(serifFont);
ServosText[i]->setZValue(31);
@ -237,11 +237,11 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) :
m_aircraft->ccpmServoZChannel->setCurrentIndex(0);
QStringList Types;
Types << QString::fromUtf8("CCPM 2 Servo 90º") << QString::fromUtf8("CCPM 3 Servo 90º")
<< QString::fromUtf8("CCPM 4 Servo 90º") << QString::fromUtf8("CCPM 3 Servo 120º")
<< QString::fromUtf8("CCPM 3 Servo 140º") << QString::fromUtf8("FP 2 Servo 90º")
<< QString::fromUtf8("Coax 2 Servo 90º") << QString::fromUtf8("Custom - User Angles")
<< QString::fromUtf8("Custom - Advanced Settings");
Types << "CCPM 2 Servo 90º" << "CCPM 3 Servo 90º"
<< "CCPM 4 Servo 90º" << "CCPM 3 Servo 120º"
<< "CCPM 3 Servo 140º" << "FP 2 Servo 90º"
<< "Coax 2 Servo 90º" << "Custom - User Angles"
<< "Custom - Advanced Settings";
m_aircraft->ccpmType->addItems(Types);
m_aircraft->ccpmType->setCurrentIndex(m_aircraft->ccpmType->count() - 1);
@ -411,7 +411,7 @@ void ConfigCcpmWidget::UpdateType()
NumServosDefined = 4;
// set values for pre defined heli types
if (typeText.compare(QString::fromUtf8("CCPM 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
if (typeText.compare("CCPM 2 Servo 90º", Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 90, 360));
m_aircraft->ccpmAngleY->setValue(0);
@ -423,7 +423,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmServoYChannel->setEnabled(false);
m_aircraft->ccpmServoZChannel->setEnabled(false);
NumServosDefined = 2;
} else if (typeText.compare(QString::fromUtf8("CCPM 3 Servo 90º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare("CCPM 3 Servo 90º", Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 90, 360));
m_aircraft->ccpmAngleY->setValue(fmod(AdjustmentAngle + 180, 360));
@ -432,7 +432,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmServoZChannel->setCurrentIndex(0);
m_aircraft->ccpmServoZChannel->setEnabled(false);
NumServosDefined = 3;
} else if (typeText.compare(QString::fromUtf8("CCPM 4 Servo 90º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare("CCPM 4 Servo 90º", Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 90, 360));
m_aircraft->ccpmAngleY->setValue(fmod(AdjustmentAngle + 180, 360));
@ -440,7 +440,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmSingleServo->setEnabled(false);
m_aircraft->ccpmSingleServo->setCurrentIndex(0);
NumServosDefined = 4;
} else if (typeText.compare(QString::fromUtf8("CCPM 3 Servo 120º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare("CCPM 3 Servo 120º", Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 120, 360));
m_aircraft->ccpmAngleY->setValue(fmod(AdjustmentAngle + 240, 360));
@ -449,7 +449,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmServoZChannel->setCurrentIndex(0);
m_aircraft->ccpmServoZChannel->setEnabled(false);
NumServosDefined = 3;
} else if (typeText.compare(QString::fromUtf8("CCPM 3 Servo 140º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare("CCPM 3 Servo 140º", Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 140, 360));
m_aircraft->ccpmAngleY->setValue(fmod(AdjustmentAngle + 220, 360));
@ -458,7 +458,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmServoZChannel->setCurrentIndex(0);
m_aircraft->ccpmServoZChannel->setEnabled(false);
NumServosDefined = 3;
} else if (typeText.compare(QString::fromUtf8("FP 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare("FP 2 Servo 90º", Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 90, 360));
m_aircraft->ccpmAngleY->setValue(0);
@ -476,7 +476,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmCollectiveSlider->setValue(0);
m_aircraft->PitchCurve->setVisible(0);
NumServosDefined = 2;
} else if (typeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare("Coax 2 Servo 90º", Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 90, 360));
m_aircraft->ccpmAngleY->setValue(0);
@ -497,7 +497,7 @@ void ConfigCcpmWidget::UpdateType()
}
// Set the text of the motor boxes
if (typeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
if (typeText.compare("Coax 2 Servo 90º", Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmEngineLabel->setText("CW motor");
m_aircraft->ccpmTailLabel->setText("CCW motor");
} else {
@ -724,7 +724,7 @@ void ConfigCcpmWidget::UpdateMixer()
table->item(i, 3)->setText(QString("%1").arg(0)); // Roll
table->item(i, 4)->setText(QString("%1").arg(0)); // Pitch
if (typeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
if (typeText.compare("Coax 2 Servo 90º", Qt::CaseInsensitive) == 0) {
// Yaw
table->item(i, 5)->setText(QString("%1").arg(-127));
} else {
@ -734,7 +734,7 @@ void ConfigCcpmWidget::UpdateMixer()
}
if (i == 1) {
// tailrotor --or-- counter-clockwise motor
if (typeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
if (typeText.compare("Coax 2 Servo 90º", Qt::CaseInsensitive) == 0) {
// ThrottleCurve1
table->item(i, 1)->setText(QString("%1").arg(127));
// Yaw
@ -771,13 +771,13 @@ void ConfigCcpmWidget::UpdateMixer()
}
} else {
for (int j = 0; j < 6; j++) {
table->item(i, j)->setText(QString("-"));
table->item(i, j)->setText("-");
}
}
}
} else {
// advanced settings
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
// Populate custom mixer table from board values
@ -802,7 +802,7 @@ void ConfigCcpmWidget::UpdateMixer()
VehicleConfig::MIXERVECTOR_YAW)));
} else {
for (int j = 0; j < 6; j++) {
table->item(i, j)->setText(QString("-"));
table->item(i, j)->setText("-");
}
}
}
@ -937,7 +937,7 @@ void ConfigCcpmWidget::getMixer()
updatingFromHardware = true;
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
QList<double> curveValues;
@ -1023,7 +1023,7 @@ void ConfigCcpmWidget::setMixer()
for (i = 0; i < 6; i++) {
if ((MixerChannelData[i] > 0) && (MixerChannelData[i] < (int)ConfigCcpmWidget::CHANNEL_NUMELEM + 1)) {
// Set the mixer type. If Coax, then first two are motors. Otherwise, only first is motor
if (typeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
if (typeText.compare("Coax 2 Servo 90º", Qt::CaseInsensitive) == 0) {
*(mixerTypes[MixerChannelData[i] - 1]) = i > 1 ?
MixerSettings::MIXER1TYPE_SERVO :
MixerSettings::MIXER1TYPE_MOTOR;
@ -1139,12 +1139,12 @@ void ConfigCcpmWidget::SwashLvlStartButtonPressed()
// Get the channel assignements:
obj = dynamic_cast<UAVDataObject *>(objManager->getObject(QString("ActuatorSettings")));
obj = dynamic_cast<UAVDataObject *>(objManager->getObject("ActuatorSettings"));
Q_ASSERT(obj);
// obj->requestUpdate();
MinField = obj->getField(QString("ChannelMin"));
NeutralField = obj->getField(QString("ChannelNeutral"));
MaxField = obj->getField(QString("ChannelMax"));
MinField = obj->getField("ChannelMin");
NeutralField = obj->getField("ChannelNeutral");
MaxField = obj->getField("ChannelMax");
// channel assignments
oldSwashLvlConfiguration.ServoChannels[0] = m_aircraft->ccpmServoWChannel->currentIndex() - 1;
@ -1322,12 +1322,12 @@ void ConfigCcpmWidget::SwashLvlCancelButtonPressed()
// restore old Actuator Settings
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(objManager->getObject(QString("ActuatorSettings")));
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(objManager->getObject("ActuatorSettings"));
Q_ASSERT(obj);
// update settings to match our changes.
MinField = obj->getField(QString("ChannelMin"));
NeutralField = obj->getField(QString("ChannelNeutral"));
MaxField = obj->getField(QString("ChannelMax"));
MinField = obj->getField("ChannelMin");
NeutralField = obj->getField("ChannelNeutral");
MaxField = obj->getField("ChannelMax");
// min,neutral,max values for the servos
for (int i = 0; i < CCPM_MAX_SWASH_SERVOS; i++) {
@ -1363,13 +1363,13 @@ void ConfigCcpmWidget::SwashLvlFinishButtonPressed()
// save new Actuator Settings to memory and SD card
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(objManager->getObject(QString("ActuatorSettings")));
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(objManager->getObject("ActuatorSettings"));
Q_ASSERT(obj);
// update settings to match our changes.
MinField = obj->getField(QString("ChannelMin"));
NeutralField = obj->getField(QString("ChannelNeutral"));
MaxField = obj->getField(QString("ChannelMax"));
MinField = obj->getField("ChannelMin");
NeutralField = obj->getField("ChannelNeutral");
MaxField = obj->getField("ChannelMax");
// min,neutral,max values for the servos
for (int i = 0; i < CCPM_MAX_SWASH_SERVOS; i++) {
@ -1465,7 +1465,7 @@ void ConfigCcpmWidget::enableSwashplateLevellingControl(bool state)
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(objManager->getObject(QString("ActuatorCommand")));
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(objManager->getObject("ActuatorCommand"));
UAVObject::Metadata mdata = obj->getMetadata();
if (state) {

View File

@ -49,103 +49,103 @@ QStringList ConfigCustomWidget::getChannelDescriptions()
QStringList channelDesc;
for (int i = 0; i < (int)VehicleConfig::CHANNEL_NUMELEM; i++) {
channelDesc.append(QString("-"));
channelDesc.append("-");
}
// get the gui config data
GUIConfigDataUnion configData = getConfigData();
customGUISettingsStruct custom = configData.custom;
if (custom.Motor1 > 0 && custom.Motor1 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Motor1 - 1] = QString("Motor1");
channelDesc[custom.Motor1 - 1] = "Motor1";
}
if (custom.Motor2 > 0 && custom.Motor2 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Motor2 - 1] = QString("Motor2");
channelDesc[custom.Motor2 - 1] = "Motor2";
}
if (custom.Motor3 > 0 && custom.Motor3 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Motor3 - 1] = QString("Motor3");
channelDesc[custom.Motor3 - 1] = "Motor3";
}
if (custom.Motor4 > 0 && custom.Motor4 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Motor4 - 1] = QString("Motor4");
channelDesc[custom.Motor4 - 1] = "Motor4";
}
if (custom.Motor5 > 0 && custom.Motor5 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Motor5 - 1] = QString("Motor5");
channelDesc[custom.Motor5 - 1] = "Motor5";
}
if (custom.Motor6 > 0 && custom.Motor6 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Motor6 - 1] = QString("Motor6");
channelDesc[custom.Motor6 - 1] = "Motor6";
}
if (custom.Motor7 > 0 && custom.Motor7 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Motor7 - 1] = QString("Motor7");
channelDesc[custom.Motor7 - 1] = "Motor7";
}
if (custom.Motor8 > 0 && custom.Motor8 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Motor8 - 1] = QString("Motor8");
channelDesc[custom.Motor8 - 1] = "Motor8";
}
if (custom.RevMotor1 > 0 && custom.RevMotor1 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.RevMotor1 - 1] = QString("RevMotor1");
channelDesc[custom.RevMotor1 - 1] = "RevMotor1";
}
if (custom.RevMotor2 > 0 && custom.RevMotor2 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.RevMotor2 - 1] = QString("RevMotor2");
channelDesc[custom.RevMotor2 - 1] = "RevMotor2";
}
if (custom.RevMotor3 > 0 && custom.RevMotor3 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.RevMotor3 - 1] = QString("RevMotor3");
channelDesc[custom.RevMotor3 - 1] = "RevMotor3";
}
if (custom.RevMotor4 > 0 && custom.RevMotor4 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.RevMotor4 - 1] = QString("RevMotor4");
channelDesc[custom.RevMotor4 - 1] = "RevMotor4";
}
if (custom.RevMotor5 > 0 && custom.RevMotor5 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.RevMotor5 - 1] = QString("RevMotor5");
channelDesc[custom.RevMotor5 - 1] = "RevMotor5";
}
if (custom.RevMotor6 > 0 && custom.RevMotor6 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.RevMotor6 - 1] = QString("RevMotor6");
channelDesc[custom.RevMotor6 - 1] = "RevMotor6";
}
if (custom.RevMotor7 > 0 && custom.RevMotor7 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.RevMotor7 - 1] = QString("RevMotor7");
channelDesc[custom.RevMotor7 - 1] = "RevMotor7";
}
if (custom.RevMotor8 > 0 && custom.RevMotor8 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.RevMotor8 - 1] = QString("RevMotor8");
channelDesc[custom.RevMotor8 - 1] = "RevMotor8";
}
if (custom.Servo1 > 0 && custom.Servo1 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Servo1 - 1] = QString("Servo1");
channelDesc[custom.Servo1 - 1] = "Servo1";
}
if (custom.Servo2 > 0 && custom.Servo2 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Servo2 - 1] = QString("Servo2");
channelDesc[custom.Servo2 - 1] = "Servo2";
}
if (custom.Servo3 > 0 && custom.Servo3 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Servo3 - 1] = QString("Servo3");
channelDesc[custom.Servo3 - 1] = "Servo3";
}
if (custom.Servo4 > 0 && custom.Servo4 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Servo4 - 1] = QString("Servo4");
channelDesc[custom.Servo4 - 1] = "Servo4";
}
if (custom.Servo5 > 0 && custom.Servo5 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Servo5 - 1] = QString("Servo5");
channelDesc[custom.Servo5 - 1] = "Servo5";
}
if (custom.Servo6 > 0 && custom.Servo6 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Servo6 - 1] = QString("Servo6");
channelDesc[custom.Servo6 - 1] = "Servo6";
}
if (custom.Servo7 > 0 && custom.Servo7 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Servo7 - 1] = QString("Servo7");
channelDesc[custom.Servo7 - 1] = "Servo7";
}
if (custom.Servo8 > 0 && custom.Servo8 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Servo8 - 1] = QString("Servo8");
channelDesc[custom.Servo8 - 1] = "Servo8";
}
if (custom.Accessory0 > 0 && custom.Accessory0 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Accessory0 - 1] = QString("Accessory0");
channelDesc[custom.Accessory0 - 1] = "Accessory0";
}
if (custom.Accessory1 > 0 && custom.Accessory1 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Accessory1 - 1] = QString("Accessory1");
channelDesc[custom.Accessory1 - 1] = "Accessory1";
}
if (custom.Accessory2 > 0 && custom.Accessory2 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Accessory2 - 1] = QString("Accessory2");
channelDesc[custom.Accessory2 - 1] = "Accessory2";
}
if (custom.Accessory3 > 0 && custom.Accessory3 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Accessory3 - 1] = QString("Accessory3");
channelDesc[custom.Accessory3 - 1] = "Accessory3";
}
if (custom.Accessory4 > 0 && custom.Accessory4 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Accessory4 - 1] = QString("Accessory4");
channelDesc[custom.Accessory4 - 1] = "Accessory4";
}
if (custom.Accessory5 > 0 && custom.Accessory5 <= VehicleConfig::CHANNEL_NUMELEM) {
channelDesc[custom.Accessory5 - 1] = QString("Accessory5");
channelDesc[custom.Accessory5 - 1] = "Accessory5";
}
return channelDesc;
}
@ -159,10 +159,10 @@ ConfigCustomWidget::ConfigCustomWidget(QWidget *parent) :
m_aircraft->customMixerTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
// Put combo boxes in line one of the custom mixer table:
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
UAVObjectField *field = mixer->getField(QString("Mixer1Type"));
UAVObjectField *field = mixer->getField("Mixer1Type");
QStringList list = field->getOptions();
for (int i = 0; i < (int)VehicleConfig::CHANNEL_NUMELEM; i++) {
QComboBox *qb = new QComboBox(m_aircraft->customMixerTable);
@ -245,10 +245,10 @@ void ConfigCustomWidget::refreshWidgetsValuesImpl(UAVObject *obj)
{
Q_UNUSED(obj);
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("SystemSettings"));
Q_ASSERT(system);
QPointer<UAVObjectField> field = system->getField(QString("AirframeType"));
QPointer<UAVObjectField> field = system->getField("AirframeType");
// Do not allow table edit until AirframeType == Custom
// First save set AirframeType to 'Custom' and next modify.
@ -258,7 +258,7 @@ void ConfigCustomWidget::refreshWidgetsValuesImpl(UAVObject *obj)
m_aircraft->customMixerTable->setEditTriggers(QAbstractItemView::AllEditTriggers);
}
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
getChannelDescriptions();
@ -322,16 +322,16 @@ void ConfigCustomWidget::refreshWidgetsValuesImpl(UAVObject *obj)
void ConfigCustomWidget::updateObjectsFromWidgetsImpl()
{
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("SystemSettings"));
Q_ASSERT(system);
QPointer<UAVObjectField> field = system->getField(QString("AirframeType"));
QPointer<UAVObjectField> field = system->getField("AirframeType");
// Do not allow changes until AirframeType == Custom
// If user want to save custom mixer : first set AirframeType to 'Custom' without changes and next modify.
if (field->getValue().toString() == "Custom") {
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);

View File

@ -52,7 +52,7 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions()
QStringList channelDesc;
for (int i = 0; i < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; i++) {
channelDesc.append(QString("-"));
channelDesc.append("-");
}
// get the gui config data
@ -60,51 +60,51 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions()
fixedGUISettingsStruct fixedwing = configData.fixedwing;
if (configData.fixedwing.FixedWingPitch1 > 0) {
channelDesc[configData.fixedwing.FixedWingPitch1 - 1] = QString("FixedWingPitch1");
channelDesc[configData.fixedwing.FixedWingPitch1 - 1] = "FixedWingPitch1";
}
if (configData.fixedwing.FixedWingPitch2 > 0) {
channelDesc[configData.fixedwing.FixedWingPitch2 - 1] = QString("FixedWingPitch2");
channelDesc[configData.fixedwing.FixedWingPitch2 - 1] = "FixedWingPitch2";
}
if (configData.fixedwing.FixedWingRoll1 > 0) {
channelDesc[configData.fixedwing.FixedWingRoll1 - 1] = QString("FixedWingRoll1");
channelDesc[configData.fixedwing.FixedWingRoll1 - 1] = "FixedWingRoll1";
}
if (configData.fixedwing.FixedWingRoll2 > 0) {
channelDesc[configData.fixedwing.FixedWingRoll2 - 1] = QString("FixedWingRoll2");
channelDesc[configData.fixedwing.FixedWingRoll2 - 1] = "FixedWingRoll2";
}
if (configData.fixedwing.FixedWingYaw1 > 0) {
channelDesc[configData.fixedwing.FixedWingYaw1 - 1] = QString("FixedWingYaw1");
channelDesc[configData.fixedwing.FixedWingYaw1 - 1] = "FixedWingYaw1";
}
if (configData.fixedwing.FixedWingYaw2 > 0) {
channelDesc[configData.fixedwing.FixedWingYaw2 - 1] = QString("FixedWingYaw2");
channelDesc[configData.fixedwing.FixedWingYaw2 - 1] = "FixedWingYaw2";
}
if (configData.fixedwing.FixedWingThrottle > 0) {
channelDesc[configData.fixedwing.FixedWingThrottle - 1] = QString("FixedWingThrottle");
channelDesc[configData.fixedwing.FixedWingThrottle - 1] = "FixedWingThrottle";
}
if (fixedwing.Accessory0 > 0 && fixedwing.Accessory0 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory0 - 1] = QString("Accessory0-1");
channelDesc[fixedwing.Accessory0 - 1] = "Accessory0-1";
}
if (fixedwing.Accessory1 > 0 && fixedwing.Accessory1 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory1 - 1] = QString("Accessory1-1");
channelDesc[fixedwing.Accessory1 - 1] = "Accessory1-1";
}
if (fixedwing.Accessory2 > 0 && fixedwing.Accessory2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory2 - 1] = QString("Accessory2-1");
channelDesc[fixedwing.Accessory2 - 1] = "Accessory2-1";
}
if (fixedwing.Accessory3 > 0 && fixedwing.Accessory3 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory3 - 1] = QString("Accessory3-1");
channelDesc[fixedwing.Accessory3 - 1] = "Accessory3-1";
}
if (fixedwing.Accessory0_2 > 0 && fixedwing.Accessory0_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory0_2 - 1] = QString("Accessory0-2");
channelDesc[fixedwing.Accessory0_2 - 1] = "Accessory0-2";
}
if (fixedwing.Accessory1_2 > 0 && fixedwing.Accessory1_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory1_2 - 1] = QString("Accessory1-2");
channelDesc[fixedwing.Accessory1_2 - 1] = "Accessory1-2";
}
if (fixedwing.Accessory2_2 > 0 && fixedwing.Accessory2_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory2_2 - 1] = QString("Accessory2-2");
channelDesc[fixedwing.Accessory2_2 - 1] = "Accessory2-2";
}
if (fixedwing.Accessory3_2 > 0 && fixedwing.Accessory3_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory3_2 - 1] = QString("Accessory3-2");
channelDesc[fixedwing.Accessory3_2 - 1] = "Accessory3-2";
}
return channelDesc;
@ -169,11 +169,11 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
planeimg = new QGraphicsSvgItem();
planeimg->setSharedRenderer(renderer);
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("SystemSettings"));
Q_ASSERT(system);
QPointer<UAVObjectField> field = system->getField(QString("AirframeType"));
QPointer<UAVObjectField> field = system->getField("AirframeType");
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
if (frameType == "FixedWing" || frameType == "Aileron") {
@ -334,7 +334,7 @@ void ConfigFixedWingWidget::resetRcOutputs(GUIConfigDataUnion *configData)
void ConfigFixedWingWidget::updateRcCurvesUsed()
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
@ -364,7 +364,7 @@ void ConfigFixedWingWidget::refreshWidgetsValuesImpl(UAVObject *obj)
{
Q_UNUSED(obj);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
QList<double> curveValues;
@ -421,7 +421,7 @@ void ConfigFixedWingWidget::refreshWidgetsValuesImpl(UAVObject *obj)
void ConfigFixedWingWidget::updateObjectsFromWidgetsImpl()
{
// Save the curve (common to all Fixed wing frames)
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
@ -474,7 +474,7 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString frameType)
setConfigData(config);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);
@ -547,7 +547,7 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString frameType)
setConfigData(config);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);
@ -630,7 +630,7 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString frameType)
setConfigData(config);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);

View File

@ -53,23 +53,23 @@ QStringList ConfigGroundVehicleWidget::getChannelDescriptions()
QStringList channelDesc;
for (int i = 0; i < (int)ConfigGroundVehicleWidget::CHANNEL_NUMELEM; i++) {
channelDesc.append(QString("-"));
channelDesc.append("-");
}
// get the gui config data
GUIConfigDataUnion configData = getConfigData();
if (configData.ground.GroundVehicleSteering1 > 0) {
channelDesc[configData.ground.GroundVehicleSteering1 - 1] = QString("GroundSteering1");
channelDesc[configData.ground.GroundVehicleSteering1 - 1] = "GroundSteering1";
}
if (configData.ground.GroundVehicleSteering2 > 0) {
channelDesc[configData.ground.GroundVehicleSteering2 - 1] = QString("GroundSteering2");
channelDesc[configData.ground.GroundVehicleSteering2 - 1] = "GroundSteering2";
}
if (configData.ground.GroundVehicleThrottle1 > 0) {
channelDesc[configData.ground.GroundVehicleThrottle1 - 1] = QString("GroundMotor1");
channelDesc[configData.ground.GroundVehicleThrottle1 - 1] = "GroundMotor1";
}
if (configData.ground.GroundVehicleThrottle2 > 0) {
channelDesc[configData.ground.GroundVehicleThrottle2 - 1] = QString("GroundMotor2");
channelDesc[configData.ground.GroundVehicleThrottle2 - 1] = "GroundMotor2";
}
return channelDesc;
}
@ -134,9 +134,9 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
m_vehicleImg = new QGraphicsSvgItem();
m_vehicleImg->setSharedRenderer(renderer);
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("SystemSettings"));
Q_ASSERT(system);
QPointer<UAVObjectField> frameTypeSaved = system->getField(QString("AirframeType"));
QPointer<UAVObjectField> frameTypeSaved = system->getField("AirframeType");
m_aircraft->differentialSteeringSlider1->setEnabled(false);
m_aircraft->differentialSteeringSlider2->setEnabled(false);
@ -336,7 +336,7 @@ void ConfigGroundVehicleWidget::refreshWidgetsValuesImpl(UAVObject *obj)
initMixerCurves(frameType);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
GUIConfigDataUnion config = getConfigData();
@ -369,7 +369,7 @@ void ConfigGroundVehicleWidget::refreshWidgetsValuesImpl(UAVObject *obj)
*/
void ConfigGroundVehicleWidget::initMixerCurves(QString frameType)
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
@ -414,7 +414,7 @@ void ConfigGroundVehicleWidget::initMixerCurves(QString frameType)
void ConfigGroundVehicleWidget::updateObjectsFromWidgetsImpl()
{
// Save the curve (common to all ground vehicle frames)
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
// set the throttle curves
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->groundVehicleThrottle1->getCurve());
@ -457,7 +457,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleMotorcycle(QString frameType)
setConfigData(config);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);
@ -507,7 +507,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleDifferential(QString frameType
setConfigData(config);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);
@ -556,7 +556,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleTurnable(QString frameType)
setConfigData(config);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);
@ -657,7 +657,7 @@ bool ConfigGroundVehicleWidget::throwConfigError(QString frameType)
}
if (error) {
m_aircraft->gvStatusLabel->setText(QString("<font color='red'>ERROR: Assign all necessary channels</font>"));
m_aircraft->gvStatusLabel->setText("<font color='red'>ERROR: Assign all necessary channels</font>");
}
return error;
}

View File

@ -47,7 +47,7 @@
#include <math.h>
#include <QMessageBox>
const QString ConfigMultiRotorWidget::CHANNELBOXNAME = QString("multiMotorChannelBox");
const QString ConfigMultiRotorWidget::CHANNELBOXNAME = "multiMotorChannelBox";
QStringList ConfigMultiRotorWidget::getChannelDescriptions()
{
@ -55,7 +55,7 @@ QStringList ConfigMultiRotorWidget::getChannelDescriptions()
QStringList channelDesc;
for (int i = 0; i < (int)ConfigMultiRotorWidget::CHANNEL_NUMELEM; i++) {
channelDesc.append(QString("-"));
channelDesc.append("-");
}
// get the gui config data
@ -64,70 +64,70 @@ QStringList ConfigMultiRotorWidget::getChannelDescriptions()
// Octocopter X motor definition
if (multi.VTOLMotorNNE > 0 && multi.VTOLMotorNNE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorNNE - 1] = QString("VTOLMotorNNE");
channelDesc[multi.VTOLMotorNNE - 1] = "VTOLMotorNNE";
}
if (multi.VTOLMotorENE > 0 && multi.VTOLMotorENE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorENE - 1] = QString("VTOLMotorENE");
channelDesc[multi.VTOLMotorENE - 1] = "VTOLMotorENE";
}
if (multi.VTOLMotorESE > 0 && multi.VTOLMotorESE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorESE - 1] = QString("VTOLMotorESE");
channelDesc[multi.VTOLMotorESE - 1] = "VTOLMotorESE";
}
if (multi.VTOLMotorSSE > 0 && multi.VTOLMotorSSE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorSSE - 1] = QString("VTOLMotorSSE");
channelDesc[multi.VTOLMotorSSE - 1] = "VTOLMotorSSE";
}
if (multi.VTOLMotorSSW > 0 && multi.VTOLMotorSSW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorSSW - 1] = QString("VTOLMotorSSW");
channelDesc[multi.VTOLMotorSSW - 1] = "VTOLMotorSSW";
}
if (multi.VTOLMotorWSW > 0 && multi.VTOLMotorWSW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorWSW - 1] = QString("VTOLMotorWSW");
channelDesc[multi.VTOLMotorWSW - 1] = "VTOLMotorWSW";
}
if (multi.VTOLMotorWNW > 0 && multi.VTOLMotorWNW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorWNW - 1] = QString("VTOLMotorWNW");
channelDesc[multi.VTOLMotorWNW - 1] = "VTOLMotorWNW";
}
if (multi.VTOLMotorNNW > 0 && multi.VTOLMotorNNW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorNNW - 1] = QString("VTOLMotorNNW");
channelDesc[multi.VTOLMotorNNW - 1] = "VTOLMotorNNW";
}
// End OctocopterX
if (multi.VTOLMotorN > 0 && multi.VTOLMotorN <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorN - 1] = QString("VTOLMotorN");
channelDesc[multi.VTOLMotorN - 1] = "VTOLMotorN";
}
if (multi.VTOLMotorNE > 0 && multi.VTOLMotorNE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorNE - 1] = QString("VTOLMotorNE");
channelDesc[multi.VTOLMotorNE - 1] = "VTOLMotorNE";
}
if (multi.VTOLMotorNW > 0 && multi.VTOLMotorNW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorNW - 1] = QString("VTOLMotorNW");
channelDesc[multi.VTOLMotorNW - 1] = "VTOLMotorNW";
}
if (multi.VTOLMotorS > 0 && multi.VTOLMotorS <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorS - 1] = QString("VTOLMotorS");
channelDesc[multi.VTOLMotorS - 1] = "VTOLMotorS";
}
if (multi.VTOLMotorSE > 0 && multi.VTOLMotorSE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorSE - 1] = QString("VTOLMotorSE");
channelDesc[multi.VTOLMotorSE - 1] = "VTOLMotorSE";
}
if (multi.VTOLMotorSW > 0 && multi.VTOLMotorSW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorSW - 1] = QString("VTOLMotorSW");
channelDesc[multi.VTOLMotorSW - 1] = "VTOLMotorSW";
}
if (multi.VTOLMotorW > 0 && multi.VTOLMotorW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorW - 1] = QString("VTOLMotorW");
channelDesc[multi.VTOLMotorW - 1] = "VTOLMotorW";
}
if (multi.VTOLMotorE > 0 && multi.VTOLMotorE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.VTOLMotorE - 1] = QString("VTOLMotorE");
channelDesc[multi.VTOLMotorE - 1] = "VTOLMotorE";
}
if (multi.TRIYaw > 0 && multi.TRIYaw <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.TRIYaw - 1] = QString("Tri-Yaw");
channelDesc[multi.TRIYaw - 1] = "Tri-Yaw";
}
if (multi.Accessory0 > 0 && multi.Accessory0 <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.Accessory0 - 1] = QString("Accessory0");
channelDesc[multi.Accessory0 - 1] = "Accessory0";
}
if (multi.Accessory1 > 0 && multi.Accessory1 <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.Accessory1 - 1] = QString("Accessory1");
channelDesc[multi.Accessory1 - 1] = "Accessory1";
}
if (multi.Accessory2 > 0 && multi.Accessory2 <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.Accessory2 - 1] = QString("Accessory2");
channelDesc[multi.Accessory2 - 1] = "Accessory2";
}
if (multi.Accessory3 > 0 && multi.Accessory3 <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) {
channelDesc[multi.Accessory3 - 1] = QString("Accessory3");
channelDesc[multi.Accessory3 - 1] = "Accessory3";
}
return channelDesc;
@ -441,7 +441,7 @@ void ConfigMultiRotorWidget::resetRcOutputs(GUIConfigDataUnion *configData)
void ConfigMultiRotorWidget::updateRcCurvesUsed()
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
@ -471,7 +471,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValuesImpl(UAVObject *obj)
{
Q_UNUSED(obj);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
QList<double> curveValues;
@ -620,7 +620,7 @@ void ConfigMultiRotorWidget::updateMotorsPositionLabels(QStringList motorLabels)
*/
void ConfigMultiRotorWidget::updateObjectsFromWidgetsImpl()
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
@ -931,7 +931,7 @@ void ConfigMultiRotorWidget::updateAirframe(QString frameType)
*/
void ConfigMultiRotorWidget::setupQuadMotor(int channel, double pitch, double roll, double yaw)
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
@ -956,7 +956,7 @@ void ConfigMultiRotorWidget::setupRcOutputs(QList<QString> rcOutputList)
GUIConfigDataUnion configData = getConfigData();
resetRcOutputs(&configData);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
int curveAccessory0 = m_aircraft->rcOutputCurveBox1->currentIndex();
@ -967,7 +967,7 @@ void ConfigMultiRotorWidget::setupRcOutputs(QList<QString> rcOutputList)
foreach(QString rc_output, rcOutputList) {
int index = rcList.takeFirst()->currentIndex();
if (rc_output == QString("Accessory0")) {
if (rc_output == "Accessory0") {
configData.multi.Accessory0 = index;
if (index) {
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY0);
@ -977,7 +977,7 @@ void ConfigMultiRotorWidget::setupRcOutputs(QList<QString> rcOutputList)
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
} else if (rc_output == QString("Accessory1")) {
} else if (rc_output == "Accessory1") {
configData.multi.Accessory1 = index;
if (index) {
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY1);
@ -987,7 +987,7 @@ void ConfigMultiRotorWidget::setupRcOutputs(QList<QString> rcOutputList)
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
} else if (rc_output == QString("Accessory2")) {
} else if (rc_output == "Accessory2") {
configData.multi.Accessory2 = index;
if (index) {
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY2);
@ -997,7 +997,7 @@ void ConfigMultiRotorWidget::setupRcOutputs(QList<QString> rcOutputList)
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
} else if (rc_output == QString("Accessory3")) {
} else if (rc_output == "Accessory3") {
configData.multi.Accessory3 = index;
if (index) {
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY3);
@ -1029,38 +1029,38 @@ void ConfigMultiRotorWidget::setupMotors(QList<QString> motorList)
foreach(QString motor, motorList) {
int index = mmList.takeFirst()->currentIndex();
if (motor == QString("VTOLMotorN")) {
if (motor == "VTOLMotorN") {
configData.multi.VTOLMotorN = index;
} else if (motor == QString("VTOLMotorNE")) {
} else if (motor == "VTOLMotorNE") {
configData.multi.VTOLMotorNE = index;
} else if (motor == QString("VTOLMotorE")) {
} else if (motor == "VTOLMotorE") {
configData.multi.VTOLMotorE = index;
} else if (motor == QString("VTOLMotorSE")) {
} else if (motor == "VTOLMotorSE") {
configData.multi.VTOLMotorSE = index;
} else if (motor == QString("VTOLMotorS")) {
} else if (motor == "VTOLMotorS") {
configData.multi.VTOLMotorS = index;
} else if (motor == QString("VTOLMotorSW")) {
} else if (motor == "VTOLMotorSW") {
configData.multi.VTOLMotorSW = index;
} else if (motor == QString("VTOLMotorW")) {
} else if (motor == "VTOLMotorW") {
configData.multi.VTOLMotorW = index;
} else if (motor == QString("VTOLMotorNW")) {
} else if (motor == "VTOLMotorNW") {
configData.multi.VTOLMotorNW = index;
// OctoX
} else if (motor == QString("VTOLMotorNNE")) {
} else if (motor == "VTOLMotorNNE") {
configData.multi.VTOLMotorNNE = index;
} else if (motor == QString("VTOLMotorENE")) {
} else if (motor == "VTOLMotorENE") {
configData.multi.VTOLMotorENE = index;
} else if (motor == QString("VTOLMotorESE")) {
} else if (motor == "VTOLMotorESE") {
configData.multi.VTOLMotorESE = index;
} else if (motor == QString("VTOLMotorSSE")) {
} else if (motor == "VTOLMotorSSE") {
configData.multi.VTOLMotorSSE = index;
} else if (motor == QString("VTOLMotorSSW")) {
} else if (motor == "VTOLMotorSSW") {
configData.multi.VTOLMotorSSW = index;
} else if (motor == QString("VTOLMotorWSW")) {
} else if (motor == "VTOLMotorWSW") {
configData.multi.VTOLMotorWSW = index;
} else if (motor == QString("VTOLMotorWNW")) {
} else if (motor == "VTOLMotorWNW") {
configData.multi.VTOLMotorWNW = index;
} else if (motor == QString("VTOLMotorNNW")) {
} else if (motor == "VTOLMotorNNW") {
configData.multi.VTOLMotorNNW = index;
}
}
@ -1207,7 +1207,7 @@ bool ConfigMultiRotorWidget::setupHexa(bool pLayout)
*/
bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);
@ -1300,7 +1300,7 @@ bool ConfigMultiRotorWidget::throwConfigError(int numMotors)
if (error) {
m_aircraft->mrStatusLabel->setText(
QString(tr("<font color='red'>ERROR: Assign all %1 motor channels</font>")).arg(numMotors));
tr("<font color='red'>ERROR: Assign all %1 motor channels</font>").arg(numMotors));
}
return error;
}