mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
OP-1698 Added channel allocation checking - Little HexaH bug - Uncrustify
This commit is contained in:
parent
f18aa3d2cb
commit
4423fa9d0c
@ -542,7 +542,7 @@ Typical value is 50% for + or X configuration on quads.</string>
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -584,7 +584,7 @@ margin:1px;</string>
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>120</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -674,7 +674,7 @@ margin:1px;</string>
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -693,7 +693,7 @@ margin:1px;</string>
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -377,6 +377,7 @@ void ConfigMultiRotorWidget::resetRcOutputs(GUIConfigDataUnion *configData)
|
|||||||
void ConfigMultiRotorWidget::resetMixers()
|
void ConfigMultiRotorWidget::resetMixers()
|
||||||
{
|
{
|
||||||
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||||
|
|
||||||
Q_ASSERT(mixer);
|
Q_ASSERT(mixer);
|
||||||
|
|
||||||
for (int channel = 0; channel < (int)ConfigMultiRotorWidget::CHANNEL_NUMELEM; channel++) {
|
for (int channel = 0; channel < (int)ConfigMultiRotorWidget::CHANNEL_NUMELEM; channel++) {
|
||||||
@ -387,6 +388,7 @@ void ConfigMultiRotorWidget::resetMixers()
|
|||||||
void ConfigMultiRotorWidget::updateRcCurvesUsed()
|
void ConfigMultiRotorWidget::updateRcCurvesUsed()
|
||||||
{
|
{
|
||||||
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||||
|
|
||||||
Q_ASSERT(mixer);
|
Q_ASSERT(mixer);
|
||||||
|
|
||||||
setComboCurrentIndex(m_aircraft->rcOutputCurveBox1, VehicleConfig::MIXER_THROTTLECURVE1);
|
setComboCurrentIndex(m_aircraft->rcOutputCurveBox1, VehicleConfig::MIXER_THROTTLECURVE1);
|
||||||
@ -905,20 +907,21 @@ void ConfigMultiRotorWidget::setupRcOutputs(QList<QString> rcOutputList)
|
|||||||
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||||
Q_ASSERT(mixer);
|
Q_ASSERT(mixer);
|
||||||
|
|
||||||
int curveAccessory0 = m_aircraft->rcOutputCurveBox1->currentIndex();
|
int curveAccessory0 = m_aircraft->rcOutputCurveBox1->currentIndex();
|
||||||
int curveAccessory1 = m_aircraft->rcOutputCurveBox2->currentIndex();
|
int curveAccessory1 = m_aircraft->rcOutputCurveBox2->currentIndex();
|
||||||
int curveAccessory2 = m_aircraft->rcOutputCurveBox3->currentIndex();
|
int curveAccessory2 = m_aircraft->rcOutputCurveBox3->currentIndex();
|
||||||
|
|
||||||
foreach(QString rc_output, rcOutputList) {
|
foreach(QString rc_output, rcOutputList) {
|
||||||
int index = rcList.takeFirst()->currentIndex();
|
int index = rcList.takeFirst()->currentIndex();
|
||||||
|
|
||||||
if (rc_output == QString("Accessory0")) {
|
if (rc_output == QString("Accessory0")) {
|
||||||
configData.multi.Accessory0 = index;
|
configData.multi.Accessory0 = index;
|
||||||
if (index) {
|
if (index) {
|
||||||
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY0);
|
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY0);
|
||||||
if (curveAccessory0) {
|
if (curveAccessory0) {
|
||||||
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2 , 127);
|
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
|
||||||
} else {
|
} else {
|
||||||
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1 , 127);
|
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (rc_output == QString("Accessory1")) {
|
} else if (rc_output == QString("Accessory1")) {
|
||||||
@ -926,9 +929,9 @@ void ConfigMultiRotorWidget::setupRcOutputs(QList<QString> rcOutputList)
|
|||||||
if (index) {
|
if (index) {
|
||||||
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY1);
|
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY1);
|
||||||
if (curveAccessory1) {
|
if (curveAccessory1) {
|
||||||
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2 , 127);
|
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
|
||||||
} else {
|
} else {
|
||||||
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1 , 127);
|
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (rc_output == QString("Accessory2")) {
|
} else if (rc_output == QString("Accessory2")) {
|
||||||
@ -936,9 +939,9 @@ void ConfigMultiRotorWidget::setupRcOutputs(QList<QString> rcOutputList)
|
|||||||
if (index) {
|
if (index) {
|
||||||
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY2);
|
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY2);
|
||||||
if (curveAccessory2) {
|
if (curveAccessory2) {
|
||||||
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2 , 127);
|
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
|
||||||
} else {
|
} else {
|
||||||
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1 , 127);
|
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1183,6 +1186,7 @@ bool ConfigMultiRotorWidget::throwConfigError(int numMotors)
|
|||||||
{
|
{
|
||||||
// Initialize configuration error flag
|
// Initialize configuration error flag
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
QString channelNames = "";
|
||||||
|
|
||||||
// Iterate through all instances of multiMotorChannelBox
|
// Iterate through all instances of multiMotorChannelBox
|
||||||
for (int i = 0; i < numMotors; i++) {
|
for (int i = 0; i < numMotors; i++) {
|
||||||
@ -1195,9 +1199,40 @@ bool ConfigMultiRotorWidget::throwConfigError(int numMotors)
|
|||||||
pixmap.fill(QColor("red"));
|
pixmap.fill(QColor("red"));
|
||||||
combobox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
|
combobox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
|
||||||
error = true;
|
error = true;
|
||||||
|
} else if (channelNames.contains(combobox->currentText(), Qt::CaseInsensitive)) {
|
||||||
|
int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||||
|
QPixmap pixmap(size, size);
|
||||||
|
pixmap.fill(QColor("orange"));
|
||||||
|
combobox->setItemData(combobox->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes
|
||||||
|
combobox->setToolTip(tr("Duplicate channel in motor outputs"));
|
||||||
} else {
|
} else {
|
||||||
combobox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
|
for (int index = 0; index < (int)ConfigMultiRotorWidget::CHANNEL_NUMELEM; index++) {
|
||||||
|
combobox->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes
|
||||||
|
combobox->setToolTip("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
channelNames += combobox->currentText() == "None" ? "" : combobox->currentText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate through all instances of rcOutputChannelBox
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
// Fine widgets with text "rcOutputChannelBox.x", where x is an integer
|
||||||
|
QComboBox *combobox = this->findChild<QComboBox *>("rcOutputChannelBox" + QString::number(i + 1));
|
||||||
|
if (combobox) {
|
||||||
|
if (channelNames.contains(combobox->currentText(), Qt::CaseInsensitive)) {
|
||||||
|
int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||||
|
QPixmap pixmap(size, size);
|
||||||
|
pixmap.fill(QColor("orange"));
|
||||||
|
combobox->setItemData(combobox->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes
|
||||||
|
combobox->setToolTip(tr("Channel already used"));
|
||||||
|
} else {
|
||||||
|
for (int index = 0; index < (int)ConfigMultiRotorWidget::CHANNEL_NUMELEM; index++) {
|
||||||
|
combobox->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes
|
||||||
|
combobox->setToolTip(tr("Select output channel for Accessory%1 RcInput").arg(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
channelNames += combobox->currentText() == "None" ? "" : combobox->currentText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
|
|||||||
case SystemSettings::AIRFRAMETYPE_HEXAX:
|
case SystemSettings::AIRFRAMETYPE_HEXAX:
|
||||||
case SystemSettings::AIRFRAMETYPE_HEXACOAX:
|
case SystemSettings::AIRFRAMETYPE_HEXACOAX:
|
||||||
case SystemSettings::AIRFRAMETYPE_HEXA:
|
case SystemSettings::AIRFRAMETYPE_HEXA:
|
||||||
|
case SystemSettings::AIRFRAMETYPE_HEXAH:
|
||||||
// multirotor
|
// multirotor
|
||||||
channelDesc = ConfigMultiRotorWidget::getChannelDescriptions();
|
channelDesc = ConfigMultiRotorWidget::getChannelDescriptions();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user