mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
LP-65 Heli tab : Custom values refreshed - Check unused/duplicate output channels
This commit is contained in:
parent
9a886d6d72
commit
538e0925a8
@ -1050,7 +1050,7 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>220</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1098,13 +1098,13 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>85</width>
|
<width>100</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>120</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1120,13 +1120,13 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>85</width>
|
<width>100</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>120</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1195,7 +1195,7 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>220</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1265,13 +1265,13 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>85</width>
|
<width>100</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>120</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1287,13 +1287,13 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>85</width>
|
<width>100</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>120</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1312,13 +1312,13 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>85</width>
|
<width>100</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>120</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1359,13 +1359,13 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>85</width>
|
<width>100</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>120</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1426,13 +1426,13 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>85</width>
|
<width>100</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>120</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1504,7 +1504,7 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>220</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1844,7 +1844,7 @@ margin:1px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>220</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -254,7 +254,7 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) :
|
|||||||
connect(m_aircraft->ccpmCollectivespinBox, SIGNAL(valueChanged(int)), this, SLOT(UpdateMixer()));
|
connect(m_aircraft->ccpmCollectivespinBox, SIGNAL(valueChanged(int)), this, SLOT(UpdateMixer()));
|
||||||
connect(m_aircraft->ccpmType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType()));
|
connect(m_aircraft->ccpmType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType()));
|
||||||
connect(m_aircraft->ccpmSingleServo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType()));
|
connect(m_aircraft->ccpmSingleServo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType()));
|
||||||
connect(m_aircraft->TabObject, SIGNAL(currentChanged(QWidget *)), this, SLOT(UpdateType()));
|
connect(m_aircraft->TabObject, SIGNAL(currentChanged(int)), this, SLOT(UpdateType()));
|
||||||
|
|
||||||
connect(m_aircraft->SwashLvlStartButton, SIGNAL(clicked()), this, SLOT(SwashLvlStartButtonPressed()));
|
connect(m_aircraft->SwashLvlStartButton, SIGNAL(clicked()), this, SLOT(SwashLvlStartButtonPressed()));
|
||||||
connect(m_aircraft->SwashLvlNextButton, SIGNAL(clicked()), this, SLOT(SwashLvlNextButtonPressed()));
|
connect(m_aircraft->SwashLvlNextButton, SIGNAL(clicked()), this, SLOT(SwashLvlNextButtonPressed()));
|
||||||
@ -384,43 +384,15 @@ QString ConfigCcpmWidget::updateConfigObjectsFromWidgets()
|
|||||||
|
|
||||||
void ConfigCcpmWidget::UpdateType()
|
void ConfigCcpmWidget::UpdateType()
|
||||||
{
|
{
|
||||||
int TypeInt, SingleServoIndex, NumServosDefined;
|
int SingleServoIndex, NumServosDefined;
|
||||||
double AdjustmentAngle = 0;
|
double AdjustmentAngle = 0;
|
||||||
|
|
||||||
SetUIComponentVisibilities();
|
SetUIComponentVisibilities();
|
||||||
|
|
||||||
TypeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
|
|
||||||
TypeText = m_aircraft->ccpmType->currentText();
|
TypeText = m_aircraft->ccpmType->currentText();
|
||||||
SingleServoIndex = m_aircraft->ccpmSingleServo->currentIndex();
|
SingleServoIndex = m_aircraft->ccpmSingleServo->currentIndex();
|
||||||
|
|
||||||
// set visibility of user settings (When Custom)
|
AdjustmentAngle = SingleServoIndex * 90;
|
||||||
m_aircraft->ccpmAdvancedSettingsTable->setEnabled(TypeInt == 0);
|
|
||||||
|
|
||||||
// Clear advanced settings table if not Custom selected (Keep previous settings)
|
|
||||||
if (TypeText.compare(QString::fromUtf8("Custom - Advanced Settings"), Qt::CaseInsensitive) != 0) {
|
|
||||||
m_aircraft->ccpmAdvancedSettingsTable->clearFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_aircraft->ccpmAngleW->setEnabled(TypeInt == 1);
|
|
||||||
m_aircraft->ccpmAngleX->setEnabled(TypeInt == 1);
|
|
||||||
m_aircraft->ccpmAngleY->setEnabled(TypeInt == 1);
|
|
||||||
m_aircraft->ccpmAngleZ->setEnabled(TypeInt == 1);
|
|
||||||
m_aircraft->ccpmCorrectionAngle->setEnabled(TypeInt != 0);
|
|
||||||
|
|
||||||
m_aircraft->ccpmServoWChannel->setEnabled(TypeInt > 0);
|
|
||||||
m_aircraft->ccpmServoXChannel->setEnabled(TypeInt > 0);
|
|
||||||
m_aircraft->ccpmServoYChannel->setEnabled(TypeInt > 0);
|
|
||||||
m_aircraft->ccpmServoZChannel->setEnabled(TypeInt > 0);
|
|
||||||
m_aircraft->ccpmSingleServo->setEnabled(TypeInt > 1);
|
|
||||||
|
|
||||||
m_aircraft->ccpmEngineChannel->setEnabled(TypeInt > 0);
|
|
||||||
m_aircraft->ccpmTailChannel->setEnabled(TypeInt > 0);
|
|
||||||
m_aircraft->ccpmCollectiveSlider->setEnabled(TypeInt > 0);
|
|
||||||
m_aircraft->ccpmCollectivespinBox->setEnabled(TypeInt > 0);
|
|
||||||
m_aircraft->ccpmRevoSlider->setEnabled(TypeInt > 0);
|
|
||||||
m_aircraft->ccpmREVOspinBox->setEnabled(TypeInt > 0);
|
|
||||||
|
|
||||||
AdjustmentAngle = SingleServoIndex * 90;
|
|
||||||
|
|
||||||
m_aircraft->PitchCurve->setVisible(1);
|
m_aircraft->PitchCurve->setVisible(1);
|
||||||
|
|
||||||
@ -671,7 +643,11 @@ void ConfigCcpmWidget::UpdateMixer()
|
|||||||
float ThisAngle[6];
|
float ThisAngle[6];
|
||||||
QString Channel;
|
QString Channel;
|
||||||
|
|
||||||
if (throwConfigError(QString("HeliCP"))) {
|
int TypeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
|
||||||
|
|
||||||
|
// Don't check config if Custom, exit if currently updatingToHardware
|
||||||
|
// Avoid updating custom table if saving data to board
|
||||||
|
if ((throwConfigError(TypeInt) && TypeInt != 0) || updatingToHardware) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GUIConfigDataUnion config = getConfigData();
|
GUIConfigDataUnion config = getConfigData();
|
||||||
@ -694,16 +670,18 @@ void ConfigCcpmWidget::UpdateMixer()
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int TypeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
|
|
||||||
if (TypeInt != 0) { // not advanced settings
|
|
||||||
// get the channel data from the ui
|
|
||||||
MixerChannelData[0] = m_aircraft->ccpmEngineChannel->currentIndex();
|
|
||||||
MixerChannelData[1] = m_aircraft->ccpmTailChannel->currentIndex();
|
|
||||||
MixerChannelData[2] = m_aircraft->ccpmServoWChannel->currentIndex();
|
|
||||||
MixerChannelData[3] = m_aircraft->ccpmServoXChannel->currentIndex();
|
|
||||||
MixerChannelData[4] = m_aircraft->ccpmServoYChannel->currentIndex();
|
|
||||||
MixerChannelData[5] = m_aircraft->ccpmServoZChannel->currentIndex();
|
|
||||||
|
|
||||||
|
// get the channel data from the ui
|
||||||
|
MixerChannelData[0] = m_aircraft->ccpmEngineChannel->currentIndex();
|
||||||
|
MixerChannelData[1] = m_aircraft->ccpmTailChannel->currentIndex();
|
||||||
|
MixerChannelData[2] = m_aircraft->ccpmServoWChannel->currentIndex();
|
||||||
|
MixerChannelData[3] = m_aircraft->ccpmServoXChannel->currentIndex();
|
||||||
|
MixerChannelData[4] = m_aircraft->ccpmServoYChannel->currentIndex();
|
||||||
|
MixerChannelData[5] = m_aircraft->ccpmServoZChannel->currentIndex();
|
||||||
|
|
||||||
|
QTableWidget *table = m_aircraft->ccpmAdvancedSettingsTable;
|
||||||
|
|
||||||
|
if (TypeInt != 0) { // not advanced settings
|
||||||
// get the angle data from the ui
|
// get the angle data from the ui
|
||||||
ThisAngle[2] = m_aircraft->ccpmAngleW->value();
|
ThisAngle[2] = m_aircraft->ccpmAngleW->value();
|
||||||
ThisAngle[3] = m_aircraft->ccpmAngleX->value();
|
ThisAngle[3] = m_aircraft->ccpmAngleX->value();
|
||||||
@ -722,11 +700,9 @@ void ConfigCcpmWidget::UpdateMixer()
|
|||||||
ServosText[3]->setPlainText(QString("%1").arg(MixerChannelData[5]));
|
ServosText[3]->setPlainText(QString("%1").arg(MixerChannelData[5]));
|
||||||
|
|
||||||
// go through the user data and update the mixer matrix
|
// go through the user data and update the mixer matrix
|
||||||
QTableWidget *table = m_aircraft->ccpmAdvancedSettingsTable;
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
if ((MixerChannelData[i] > 0) && ((ThisEnable[i]) || (i < 2))) {
|
if (((MixerChannelData[i] > 0) && ThisEnable[i]) || (i < 2)) {
|
||||||
table->item(i, 0)->setText(QString("%1").arg(MixerChannelData[i]));
|
table->item(i, 0)->setText(QString("%1").arg(MixerChannelData[i]));
|
||||||
|
|
||||||
// Generate the mixer vector
|
// Generate the mixer vector
|
||||||
if (i == 0) { // main motor-engine
|
if (i == 0) { // main motor-engine
|
||||||
table->item(i, 1)->setText(QString("%1").arg(127)); // ThrottleCurve1
|
table->item(i, 1)->setText(QString("%1").arg(127)); // ThrottleCurve1
|
||||||
@ -787,14 +763,34 @@ void ConfigCcpmWidget::UpdateMixer()
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// advanced settings
|
// advanced settings
|
||||||
QTableWidget *table = m_aircraft->ccpmAdvancedSettingsTable;
|
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||||
|
Q_ASSERT(mixer);
|
||||||
|
|
||||||
|
// Populate custom mixer table from board values
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
Channel = table->item(i, 0)->text();
|
if (MixerChannelData[i] > 0) {
|
||||||
if (Channel == "-") {
|
// Channel number
|
||||||
Channel = QString((int)ConfigCcpmWidget::CHANNEL_NUMELEM + 1);
|
table->item(i, 0)->setText(QString("%1").arg(MixerChannelData[i]));
|
||||||
|
// Throttle1
|
||||||
|
table->item(i, 1)->setText(QString("%1").arg(getMixerVectorValue(mixer, MixerChannelData[i] - 1,
|
||||||
|
VehicleConfig::MIXERVECTOR_THROTTLECURVE1)));
|
||||||
|
// Throttle2
|
||||||
|
table->item(i, 2)->setText(QString("%1").arg(getMixerVectorValue(mixer, MixerChannelData[i] - 1,
|
||||||
|
VehicleConfig::MIXERVECTOR_THROTTLECURVE2)));
|
||||||
|
// Roll
|
||||||
|
table->item(i, 3)->setText(QString("%1").arg(getMixerVectorValue(mixer, MixerChannelData[i] - 1,
|
||||||
|
VehicleConfig::MIXERVECTOR_ROLL)));
|
||||||
|
// Pitch
|
||||||
|
table->item(i, 4)->setText(QString("%1").arg(getMixerVectorValue(mixer, MixerChannelData[i] - 1,
|
||||||
|
VehicleConfig::MIXERVECTOR_PITCH)));
|
||||||
|
// Yaw
|
||||||
|
table->item(i, 5)->setText(QString("%1").arg(getMixerVectorValue(mixer, MixerChannelData[i] - 1,
|
||||||
|
VehicleConfig::MIXERVECTOR_YAW)));
|
||||||
|
} else {
|
||||||
|
for (int j = 0; j < 6; j++) {
|
||||||
|
table->item(i, j)->setText(QString("-"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MixerChannelData[i] = Channel.toInt();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -893,6 +889,31 @@ void ConfigCcpmWidget::SetUIComponentVisibilities()
|
|||||||
m_aircraft->SwashLvlStepList->item(1)->setBackground(Qt::transparent);
|
m_aircraft->SwashLvlStepList->item(1)->setBackground(Qt::transparent);
|
||||||
m_aircraft->SwashLvlStepList->item(2)->setBackground(Qt::transparent);
|
m_aircraft->SwashLvlStepList->item(2)->setBackground(Qt::transparent);
|
||||||
m_aircraft->SwashLvlStepList->item(3)->setBackground(Qt::transparent);
|
m_aircraft->SwashLvlStepList->item(3)->setBackground(Qt::transparent);
|
||||||
|
|
||||||
|
// Enable / disable by TypeInt : 0 is custom
|
||||||
|
int TypeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
|
||||||
|
|
||||||
|
// set visibility of user settings (When Custom)
|
||||||
|
m_aircraft->ccpmAdvancedSettingsTable->setEnabled(TypeInt == 0);
|
||||||
|
|
||||||
|
m_aircraft->ccpmAngleW->setEnabled(TypeInt == 1);
|
||||||
|
m_aircraft->ccpmAngleX->setEnabled(TypeInt == 1);
|
||||||
|
m_aircraft->ccpmAngleY->setEnabled(TypeInt == 1);
|
||||||
|
m_aircraft->ccpmAngleZ->setEnabled(TypeInt == 1);
|
||||||
|
m_aircraft->ccpmCorrectionAngle->setEnabled(TypeInt != 0);
|
||||||
|
|
||||||
|
m_aircraft->ccpmServoWChannel->setEnabled(TypeInt > 0);
|
||||||
|
m_aircraft->ccpmServoXChannel->setEnabled(TypeInt > 0);
|
||||||
|
m_aircraft->ccpmServoYChannel->setEnabled(TypeInt > 0);
|
||||||
|
m_aircraft->ccpmServoZChannel->setEnabled(TypeInt > 0);
|
||||||
|
m_aircraft->ccpmSingleServo->setEnabled(TypeInt > 1);
|
||||||
|
|
||||||
|
m_aircraft->ccpmEngineChannel->setEnabled(TypeInt > 0);
|
||||||
|
m_aircraft->ccpmTailChannel->setEnabled(TypeInt > 0);
|
||||||
|
m_aircraft->ccpmCollectiveSlider->setEnabled(TypeInt > 0);
|
||||||
|
m_aircraft->ccpmCollectivespinBox->setEnabled(TypeInt > 0);
|
||||||
|
m_aircraft->ccpmRevoSlider->setEnabled(TypeInt > 0);
|
||||||
|
m_aircraft->ccpmREVOspinBox->setEnabled(TypeInt > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -942,6 +963,14 @@ void ConfigCcpmWidget::setMixer()
|
|||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
int TypeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
|
||||||
|
|
||||||
|
// Don't check config if Custom, exit if currently updatingToHardware
|
||||||
|
// Avoid mixer changes if something wrong in config
|
||||||
|
if ((throwConfigError(TypeInt) && TypeInt != 0) || updatingToHardware) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (SwashLvlConfigurationInProgress) {
|
if (SwashLvlConfigurationInProgress) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -986,10 +1015,11 @@ void ConfigCcpmWidget::setMixer()
|
|||||||
&mixerSettingsData.Mixer12Type
|
&mixerSettingsData.Mixer12Type
|
||||||
};
|
};
|
||||||
|
|
||||||
// reset all to Disabled
|
// reset all outputs to Disabled
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < (int)ConfigCcpmWidget::CHANNEL_NUMELEM; i++) {
|
||||||
*mixerTypes[i] = 0;
|
*mixerTypes[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// go through the user data and update the mixer matrix
|
// go through the user data and update the mixer matrix
|
||||||
for (i = 0; i < 6; i++) {
|
for (i = 0; i < 6; i++) {
|
||||||
if ((MixerChannelData[i] > 0) && (MixerChannelData[i] < (int)ConfigCcpmWidget::CHANNEL_NUMELEM + 1)) {
|
if ((MixerChannelData[i] > 0) && (MixerChannelData[i] < (int)ConfigCcpmWidget::CHANNEL_NUMELEM + 1)) {
|
||||||
@ -1560,52 +1590,44 @@ void ConfigCcpmWidget::SwashLvlSpinBoxChanged(int value)
|
|||||||
/**
|
/**
|
||||||
This function displays text and color formatting in order to help the user understand what channels have not yet been configured.
|
This function displays text and color formatting in order to help the user understand what channels have not yet been configured.
|
||||||
*/
|
*/
|
||||||
bool ConfigCcpmWidget::throwConfigError(QString airframeType)
|
bool ConfigCcpmWidget::throwConfigError(int TypeInt)
|
||||||
{
|
{
|
||||||
Q_UNUSED(airframeType);
|
|
||||||
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
if ((m_aircraft->ccpmServoWChannel->currentIndex() == 0) && (m_aircraft->ccpmServoWChannel->isVisible())) {
|
// Custom no need check
|
||||||
m_aircraft->ccpmServoWLabel->setText("<font color=red>" + m_aircraft->ccpmServoWLabel->text() + "</font>");
|
if (TypeInt == 0) {
|
||||||
error = true;
|
return error;
|
||||||
} else {
|
|
||||||
m_aircraft->ccpmServoWLabel->setText(QTextEdit(m_aircraft->ccpmServoWLabel->text()).toPlainText());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_aircraft->ccpmServoXChannel->currentIndex() == 0) && (m_aircraft->ccpmServoXChannel->isVisible())) {
|
QList<QComboBox *> comboChannelsName;
|
||||||
m_aircraft->ccpmServoXLabel->setText("<font color=red>" + m_aircraft->ccpmServoXLabel->text() + "</font>");
|
comboChannelsName << m_aircraft->ccpmEngineChannel << m_aircraft->ccpmTailChannel << m_aircraft->ccpmServoWChannel
|
||||||
error = true;
|
<< m_aircraft->ccpmServoXChannel << m_aircraft->ccpmServoYChannel << m_aircraft->ccpmServoZChannel;
|
||||||
} else {
|
QString channelNames = "";
|
||||||
m_aircraft->ccpmServoXLabel->setText(QTextEdit(m_aircraft->ccpmServoXLabel->text()).toPlainText());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((m_aircraft->ccpmServoYChannel->currentIndex() == 0) && (m_aircraft->ccpmServoYChannel->isVisible())) {
|
for (int i = 0; i < 6; i++) {
|
||||||
m_aircraft->ccpmServoYLabel->setText("<font color=red>" + m_aircraft->ccpmServoYLabel->text() + "</font>");
|
QComboBox *combobox = comboChannelsName[i];
|
||||||
error = true;
|
if (combobox && (combobox->isVisible())) {
|
||||||
} else {
|
if (combobox->currentText() == "None") {
|
||||||
m_aircraft->ccpmServoYLabel->setText(QTextEdit(m_aircraft->ccpmServoYLabel->text()).toPlainText());
|
int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||||
|
QPixmap pixmap(size, size);
|
||||||
|
pixmap.fill(QColor("red"));
|
||||||
|
combobox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
|
||||||
|
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("Channel already used"));
|
||||||
|
error = true;
|
||||||
|
} else {
|
||||||
|
for (int index = 0; index < (int)ConfigCcpmWidget::CHANNEL_NUMELEM; index++) {
|
||||||
|
combobox->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes
|
||||||
|
combobox->setToolTip("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_aircraft->ccpmServoZChannel->currentIndex() == 0) && (m_aircraft->ccpmServoZChannel->isVisible())) {
|
|
||||||
m_aircraft->ccpmServoZLabel->setText("<font color=red>" + m_aircraft->ccpmServoZLabel->text() + "</font>");
|
|
||||||
error = true;
|
|
||||||
} else {
|
|
||||||
m_aircraft->ccpmServoZLabel->setText(QTextEdit(m_aircraft->ccpmServoZLabel->text()).toPlainText());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((m_aircraft->ccpmEngineChannel->currentIndex() == 0) && (m_aircraft->ccpmEngineChannel->isEnabled())) {
|
|
||||||
m_aircraft->ccpmEngineLabel->setText("<font color=red>" + m_aircraft->ccpmEngineLabel->text() + "</font>");
|
|
||||||
} else {
|
|
||||||
m_aircraft->ccpmEngineLabel->setText(QTextEdit(m_aircraft->ccpmEngineLabel->text()).toPlainText());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((m_aircraft->ccpmTailChannel->currentIndex() == 0) && (m_aircraft->ccpmTailChannel->isEnabled())) {
|
|
||||||
m_aircraft->ccpmTailLabel->setText("<font color=red>" + m_aircraft->ccpmTailLabel->text() + "</font>");
|
|
||||||
error = true;
|
|
||||||
} else {
|
|
||||||
m_aircraft->ccpmTailLabel->setText(QTextEdit(m_aircraft->ccpmTailLabel->text()).toPlainText());
|
|
||||||
}
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
virtual void setupUI(QString airframeType);
|
virtual void setupUI(QString airframeType);
|
||||||
virtual bool throwConfigError(QString airframeType);
|
virtual bool throwConfigError(int TypeInt);
|
||||||
|
|
||||||
void ccpmSwashplateUpdate();
|
void ccpmSwashplateUpdate();
|
||||||
void ccpmSwashplateRedraw();
|
void ccpmSwashplateRedraw();
|
||||||
|
@ -60,7 +60,7 @@ typedef struct {
|
|||||||
} __attribute__((packed)) multiGUISettingsStruct;
|
} __attribute__((packed)) multiGUISettingsStruct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint SwashplateType : 3;
|
uint SwashplateType : 4;
|
||||||
uint FirstServoIndex : 2;
|
uint FirstServoIndex : 2;
|
||||||
uint CorrectionAngle : 9;
|
uint CorrectionAngle : 9;
|
||||||
uint ccpmCollectivePassthroughState : 1;
|
uint ccpmCollectivePassthroughState : 1;
|
||||||
@ -75,7 +75,7 @@ typedef struct {
|
|||||||
uint ServoIndexZ : 4; // 57 bits
|
uint ServoIndexZ : 4; // 57 bits
|
||||||
uint Throttle : 4;
|
uint Throttle : 4;
|
||||||
uint Tail : 4; // 65bits
|
uint Tail : 4; // 65bits
|
||||||
quint32 padding : 31; // 96 bits
|
quint32 padding : 30; // 96 bits
|
||||||
quint32 padding1; // 128 bits
|
quint32 padding1; // 128 bits
|
||||||
} __attribute__((packed)) heliGUISettingsStruct;
|
} __attribute__((packed)) heliGUISettingsStruct;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user