diff --git a/ground/src/plugins/config/ccpm.ui b/ground/src/plugins/config/ccpm.ui
index 98dec8c51..ead385ee9 100644
--- a/ground/src/plugins/config/ccpm.ui
+++ b/ground/src/plugins/config/ccpm.ui
@@ -6,8 +6,8 @@
0
0
- 806
- 822
+ 821
+ 606
@@ -18,8 +18,8 @@
10
10
- 1096
- 541
+ 791
+ 551
@@ -46,11 +46,6 @@
Select aircraft type here
- -
-
- Custom - Advanced settings
-
-
@@ -65,7 +60,7 @@
Swashplate config:
-
+
11
@@ -283,7 +278,7 @@
-
-
+
0
@@ -458,7 +453,7 @@
-
-
+
true
@@ -482,6 +477,9 @@
-
+
+ true
+
CCPM Mixing
@@ -493,7 +491,7 @@
- false
+ true
Collective
@@ -504,7 +502,13 @@
- false
+ true
+
+
+
+ 0
+ 0
+
100
@@ -521,7 +525,7 @@
- false
+ true
Cyclic
@@ -532,6 +536,19 @@
+ -
+
+
+ 100
+
+
+ 5
+
+
+ 50
+
+
+
@@ -584,6 +601,9 @@
+ -
+
+
@@ -638,6 +658,30 @@
400
+
+ QFrame::NoFrame
+
+
+ QFrame::Plain
+
+
+ 0
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+
+
+ 220
+ 220
+ 220
+
+
+
Qt::AlignHCenter|Qt::AlignTop
@@ -657,101 +701,647 @@
Curve settings
-
+
- 20
- 190
- 261
- 141
+ 22
+ 11
+ 661
+ 501
-
-
- 8
-
+
+ -
+
+
-
+
+
+
+ 10
+
+
+
+ Select aircraft type here
+
+
-
+
+ Linear
+
+
+ -
+
+ Flat
+
+
+ -
+
+ Step
+
+
+ -
+
+ Custom
+
+
+
+
+ -
+
+
-
+
+
+ Number of points
+
+
+
+ -
+
+
+ 2
+
+
+ 10
+
+
+ 5
+
+
+
+
+
+ -
+
+
-
+
+
+ Min
+
+
+
+ -
+
+
+ Max
+
+
+
+ -
+
+
+ Step point
+
+
+
+ -
+
+
+ 1
+
+
+ 10.000000000000000
+
+
+
+ -
+
+
+ 1
+
+
+ 10.000000000000000
+
+
+ 1.000000000000000
+
+
+
+ -
+
+
+ 1
+
+
+ 100.000000000000000
+
+
+ 50.000000000000000
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 10
+
+
+
+ Select aircraft type here
+
+
-
+
+ Throttle
+
+
+ -
+
+ Pitch
+
+
+
+
+ -
+
+
+ Generate curves based on settings
+
+
+ <-- Generate Curve
+
+
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
-
+
+
+ Throttle Curve 2
+
+
+
+ -
+
+
+ Reset
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 150
+ 150
+
+
+
+
+ 200
+ 200
+
+
+
+
+ -
+
+
+ Val: 0.00
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ Throttle Curve 1
+
+
+
+ -
+
+
+ Reset
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 150
+ 150
+
+
+
+
+ 200
+ 200
+
+
+
+
+ -
+
+
+ Val: 0.00
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 8
+
+
+
+ Qt::ScrollBarAlwaysOn
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ false
+
+
+ true
+
+
+
+ 0%
+
+
+
+
+ 25%
+
+
+
+
+ 50%
+
+
+
+
+ 75%
+
+
+
+
+ 100%
+
+
+
+
+ none
+
+
+
+
+ none
+
+
+
+
+ none
+
+
+
+
+ none
+
+
+
+
+ none
+
+
+
+
+ Throttle Curve
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+
+
+ Blade Pitch Curve
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ 0
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ 0
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ .25
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ .25
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ .5
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ .5
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ .75
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ .75
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ 1
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ 1
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 10
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 10
+
+
+
+
+
+
+
+
+
+
+
+ Advanced settings
+
+
+
+
+ 15
+ 21
+ 661
+ 211
+
+
+
+
+ 0
+ 0
+
- Qt::ScrollBarAlwaysOn
+ Qt::ScrollBarAlwaysOff
Qt::ScrollBarAlwaysOff
-
- false
-
-
- true
-
- 0%
+ Engine
- 25%
+ Tail Rotor
- 50%
+ Servo W
- 75%
+ Servo X
- 100%
+ Servo Y
- none
-
-
-
-
- none
-
-
-
-
- none
-
-
-
-
- none
-
-
-
-
- none
+ Servo Z
- Throttle Curve
-
-
- AlignHCenter|AlignVCenter|AlignCenter
+ Channel
- Blade Pitch Curve
+ Curve 1
-
- AlignHCenter|AlignVCenter|AlignCenter
+
+
+
+ Curve 2
+
+
+
+
+ Roll
+
+
+
+
+ Pitch
+
+
+
+
+ Yaw
-
- 0
+ -
AlignHCenter|AlignVCenter|AlignCenter
@@ -759,7 +1349,39 @@
-
- 0
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
AlignHCenter|AlignVCenter|AlignCenter
@@ -767,7 +1389,7 @@
-
- .25
+ -
AlignHCenter|AlignVCenter|AlignCenter
@@ -775,7 +1397,39 @@
-
- .25
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
AlignHCenter|AlignVCenter|AlignCenter
@@ -783,7 +1437,7 @@
-
- .5
+ -
AlignHCenter|AlignVCenter|AlignCenter
@@ -791,7 +1445,39 @@
-
- .5
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
AlignHCenter|AlignVCenter|AlignCenter
@@ -799,7 +1485,7 @@
-
- .75
+ -
AlignHCenter|AlignVCenter|AlignCenter
@@ -807,7 +1493,39 @@
-
- .75
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
AlignHCenter|AlignVCenter|AlignCenter
@@ -815,7 +1533,7 @@
-
- 1
+ -
AlignHCenter|AlignVCenter|AlignCenter
@@ -823,7 +1541,39 @@
-
- 1
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
+
+
+ AlignHCenter|AlignVCenter|AlignCenter
+
+
+ -
+
+ -
AlignHCenter|AlignVCenter|AlignCenter
@@ -845,7 +1595,7 @@
AlignHCenter|AlignVCenter|AlignCenter
- -
+
-
-
@@ -853,7 +1603,7 @@
AlignHCenter|AlignVCenter|AlignCenter
- -
+
-
-
@@ -861,7 +1611,7 @@
AlignHCenter|AlignVCenter|AlignCenter
- -
+
-
-
@@ -869,7 +1619,7 @@
AlignHCenter|AlignVCenter|AlignCenter
- -
+
-
-
@@ -877,676 +1627,6 @@
AlignHCenter|AlignVCenter|AlignCenter
- -
-
- -
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
- -
-
- -
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
- -
-
- -
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
- -
-
- -
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
-
-
-
-
- 20
- 20
- 271
- 21
-
-
-
-
- 10
-
-
-
- Select aircraft type here
-
- -
-
- Linear
-
-
- -
-
- Flat
-
-
- -
-
- Step
-
-
- -
-
- Custom
-
-
-
-
-
-
- 180
- 50
- 51
- 22
-
-
-
- 2
-
-
- 10
-
-
- 5
-
-
-
-
-
- 80
- 50
- 91
- 16
-
-
-
- Number of points
-
-
-
-
-
- 150
- 140
- 121
- 27
-
-
-
- Generate curves based on settings
-
-
- <-- Generate Curve
-
-
-
-
-
- 40
- 100
- 62
- 22
-
-
-
- 1
-
-
- 10.000000000000000
-
-
-
-
-
- 130
- 100
- 62
- 22
-
-
-
- 1
-
-
- 10.000000000000000
-
-
- 1.000000000000000
-
-
-
-
-
- 220
- 100
- 62
- 22
-
-
-
- 1
-
-
- 100.000000000000000
-
-
- 50.000000000000000
-
-
-
-
-
- 40
- 80
- 61
- 16
-
-
-
- Min
-
-
-
-
-
- 130
- 80
- 61
- 16
-
-
-
- Max
-
-
-
-
-
- 220
- 80
- 61
- 16
-
-
-
- Step point
-
-
-
-
-
- 310
- 10
- 371
- 331
-
-
-
-
-
-
- 30
- 140
- 111
- 21
-
-
-
-
- 10
-
-
-
- Select aircraft type here
-
- -
-
- Throttle
-
-
- -
-
- Pitch
-
-
-
-
-
-
- Advanced settings
-
-
-
- true
-
-
-
- 10
- 20
- 251
- 141
-
-
-
-
- 0
- 0
-
-
-
- QFrame::StyledPanel
-
-
- QFrame::Plain
-
-
- 0
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAlwaysOff
-
-
- false
-
-
- false
-
-
- true
-
-
- QAbstractItemView::SingleSelection
-
-
-
- ServoW
-
-
-
-
- ServoX
-
-
-
-
- ServoY
-
-
-
-
- ServoZ
-
-
-
-
- Angle
-
-
-
-
- Output
-
-
- -
-
- 0
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
- -
-
- 8
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
- -
-
- 60
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
- -
-
- 5
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
- -
-
- 180
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
- -
-
- 1
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
- -
-
- 300
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
- -
-
- 0
-
-
- AlignHCenter|AlignVCenter|AlignCenter
-
-
-
-
-
-
- 10
- 180
- 101
- 30
-
-
-
- CollectiveConstant:
-
-
-
-
- true
-
-
-
- 10
- 260
- 91
- 16
-
-
-
- CorrectionAngle:
-
-
-
-
-
- 10
- 290
- 101
- 30
-
-
-
- Throttle Output
-
-
-
-
-
- 10
- 320
- 81
- 30
-
-
-
- Tail Rotor Servo
-
-
-
-
-
- 90
- 290
- 151
- 21
-
-
-
-
- 10
-
-
-
- Select aircraft type here
-
-
- 2
-
- -
-
- 0
-
-
- -
-
- 1
-
-
- -
-
- 2
-
-
- -
-
- 3
-
-
- -
-
- 4
-
-
- -
-
- 5
-
-
- -
-
- 6
-
-
- -
-
- 7
-
-
- -
-
- 8
-
-
-
-
-
-
- 90
- 320
- 151
- 21
-
-
-
-
- 10
-
-
-
- Select aircraft type here
-
-
- 3
-
- -
-
- 0
-
-
- -
-
- 1
-
-
- -
-
- 2
-
-
- -
-
- 3
-
-
- -
-
- 4
-
-
- -
-
- 5
-
-
- -
-
- 6
-
-
- -
-
- 7
-
-
- -
-
- 8
-
-
-
-
-
-
- 130
- 180
- 62
- 22
-
-
-
- 1.000000000000000
-
-
- 0.050000000000000
-
-
- 0.500000000000000
-
-
-
-
- true
-
-
-
- 130
- 260
- 62
- 22
-
-
-
- 0
-
-
- 360.000000000000000
-
-
- 15.000000000000000
-
-
-
-
-
- 300
- 10
- 371
- 331
-
-
-
-
-
- false
-
-
-
- 130
- 220
- 62
- 22
-
-
-
- 1.000000000000000
-
-
- 0.050000000000000
-
-
- 0.500000000000000
-
-
-
-
- false
-
-
-
- 10
- 210
- 101
- 40
-
-
-
- RevoConstant:
-
@@ -1599,6 +1679,114 @@
+
+
+ MixerCurveWidget
+ QWidget
+
+ 1
+
+
+
+ TabObject
+ ccpmType
+ ccpmEngineChannel
+ ccpmTailChannel
+ ccpmServoWChannel
+ ccpmServoXChannel
+ ccpmServoYChannel
+ ccpmServoZChannel
+ ccpmSingleServo
+ ccpmAngleW
+ ccpmAngleX
+ ccpmAngleY
+ ccpmAngleZ
+ ccpmCorrectionAngle
+ ccpmCollectiveSlider
+ ccpmCollectivespinBox
+ ccpmRevoSlider
+ ccpmREVOspinBox
+ SwashplateImage
+ getccpmCurrent
+ saveccpmToRAM
+ saveccpmToSD
+ CurveType
+ NumCurvePoints
+ CurveValue1
+ CurveValue2
+ CurveValue3
+ CurveToGenerate
+ ccpmGenerateCurve
+ pushButton_3
+ pushButton_2
+ CurveSettings
+ ccpmAdvancedSettingsTable
+
-
+
+
+ ccpmCollectiveSlider
+ sliderMoved(int)
+ ccpmCollectivespinBox
+ setValue(int)
+
+
+ 246
+ 309
+
+
+ 228
+ 501
+
+
+
+
+ ccpmCollectivespinBox
+ valueChanged(int)
+ ccpmCollectiveSlider
+ setValue(int)
+
+
+ 247
+ 496
+
+
+ 243
+ 391
+
+
+
+
+ ccpmREVOspinBox
+ valueChanged(int)
+ ccpmRevoSlider
+ setValue(int)
+
+
+ 320
+ 498
+
+
+ 326
+ 393
+
+
+
+
+ ccpmRevoSlider
+ sliderMoved(int)
+ ccpmREVOspinBox
+ setValue(int)
+
+
+ 303
+ 222
+
+
+ 308
+ 496
+
+
+
+
diff --git a/ground/src/plugins/config/configccpmwidget.cpp b/ground/src/plugins/config/configccpmwidget.cpp
index eac03495b..ef4de7f98 100644
--- a/ground/src/plugins/config/configccpmwidget.cpp
+++ b/ground/src/plugins/config/configccpmwidget.cpp
@@ -86,27 +86,48 @@ ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : ConfigTaskWidget(parent)
channels << "Channel0" << "Channel1" << "Channel2" <<
"Channel3" << "Channel4" << "Channel5" << "Channel6" << "Channel7" << "None" ;
m_ccpm->ccpmEngineChannel->addItems(channels);
+ m_ccpm->ccpmEngineChannel->setCurrentIndex(8);
m_ccpm->ccpmTailChannel->addItems(channels);
+ m_ccpm->ccpmTailChannel->setCurrentIndex(8);
m_ccpm->ccpmServoWChannel->addItems(channels);
+ m_ccpm->ccpmServoWChannel->setCurrentIndex(8);
m_ccpm->ccpmServoXChannel->addItems(channels);
+ m_ccpm->ccpmServoXChannel->setCurrentIndex(8);
m_ccpm->ccpmServoYChannel->addItems(channels);
+ m_ccpm->ccpmServoYChannel->setCurrentIndex(8);
m_ccpm->ccpmServoZChannel->addItems(channels);
+ m_ccpm->ccpmServoZChannel->setCurrentIndex(8);
QStringList Types;
- Types << "CCPM 90º" << "CCPM 120º" << "CCPM 140º" ;
+ Types << "Custom - Advanced Settings" << "Custom - User Angles" << "CCPM 2 Servo 90º" << "CCPM 3 Servo 120º" << "CCPM 3 Servo 140º" ;
m_ccpm->ccpmType->addItems(Types);
requestccpmUpdate();
UpdateCurveSettings();
- ccpmSwashplateUpdate();
+ UpdateType();
+
connect(m_ccpm->saveccpmToSD, SIGNAL(clicked()), this, SLOT(saveccpmUpdate()));
connect(m_ccpm->saveccpmToRAM, SIGNAL(clicked()), this, SLOT(sendccpmUpdate()));
connect(m_ccpm->getccpmCurrent, SIGNAL(clicked()), this, SLOT(requestccpmUpdate()));
connect(m_ccpm->ccpmGenerateCurve, SIGNAL(clicked()), this, SLOT(GenerateCurve()));
connect(m_ccpm->NumCurvePoints, SIGNAL(valueChanged(int)), this, SLOT(UpdateCurveSettings()));
connect(m_ccpm->CurveType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCurveSettings()));
- connect(m_ccpm->ServoSettings, SIGNAL(cellChanged(int,int)), this, SLOT(ccpmSwashplateUpdate()));
+ connect(m_ccpm->ccpmAngleW, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
+ connect(m_ccpm->ccpmAngleX, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
+ connect(m_ccpm->ccpmAngleY, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
+ connect(m_ccpm->ccpmAngleZ, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
+ connect(m_ccpm->ccpmServoWChannel, SIGNAL(currentIndexChanged(int)), this, SLOT(ccpmSwashplateUpdate()));
+ connect(m_ccpm->ccpmServoXChannel, SIGNAL(currentIndexChanged(int)), this, SLOT(ccpmSwashplateUpdate()));
+ connect(m_ccpm->ccpmServoYChannel, SIGNAL(currentIndexChanged(int)), this, SLOT(ccpmSwashplateUpdate()));
+ connect(m_ccpm->ccpmServoZChannel, SIGNAL(currentIndexChanged(int)), this, SLOT(ccpmSwashplateUpdate()));
+ connect(m_ccpm->ccpmEngineChannel, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMixer()));
+ connect(m_ccpm->ccpmTailChannel, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMixer()));
+ connect(m_ccpm->ccpmType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType()));
+
+
+
+
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestccpmUpdate()));
@@ -117,6 +138,59 @@ ConfigccpmWidget::~ConfigccpmWidget()
// Do nothing
}
+void ConfigccpmWidget::UpdateType()
+{
+ int TypeInt,angle,NumServo;
+ QString TypeText;
+
+
+ TypeInt = m_ccpm->ccpmType->currentIndex();
+ TypeText = m_ccpm->ccpmType->currentText();
+
+ //set visibility of user settings
+ m_ccpm->ccpmAngleW->setEnabled(TypeInt==1);
+ m_ccpm->ccpmAngleX->setEnabled(TypeInt==1);
+ m_ccpm->ccpmAngleY->setEnabled(TypeInt==1);
+ m_ccpm->ccpmAngleZ->setEnabled(TypeInt==1);
+
+ m_ccpm->ccpmServoWChannel->setEnabled(TypeInt>0);
+ m_ccpm->ccpmServoXChannel->setEnabled(TypeInt>0);
+ m_ccpm->ccpmServoYChannel->setEnabled(TypeInt>0);
+ m_ccpm->ccpmServoZChannel->setEnabled(TypeInt>0);
+ m_ccpm->ccpmEngineChannel->setEnabled(TypeInt>0);
+ m_ccpm->ccpmTailChannel->setEnabled(TypeInt>0);
+ m_ccpm->ccpmCollectiveSlider->setEnabled(TypeInt>0);
+ m_ccpm->ccpmCollectivespinBox->setEnabled(TypeInt>0);
+ m_ccpm->ccpmRevoSlider->setEnabled(TypeInt>0);
+ m_ccpm->ccpmREVOspinBox->setEnabled(TypeInt>0);
+
+
+ //set values for pre defined heli types
+ if (TypeInt>1)
+ {
+ //NumServo = TypeText.mid(TypeText.indexOf(QRegExp("[0-9]{1,1} Servo"))).toInt();
+ // angle = TypeText.mid(TypeText.indexOf(QRegExp("[0-9]{1,3}º"))).toInt();
+ if (TypeText.compare(QString("CCPM 2 SERVO 90º")))
+ {
+ m_ccpm->ccpmAngleW->setValue(60);
+ m_ccpm->ccpmAngleX->setValue(180);
+ m_ccpm->ccpmAngleY->setValue(300);
+ m_ccpm->ccpmAngleZ->setValue(0);
+ m_ccpm->ccpmAngleZ->setEnabled(0);
+ m_ccpm->ccpmServoZChannel->setEnabled(0);
+ }
+
+ }
+
+
+ //update UI
+ ccpmSwashplateUpdate();
+
+}
+
+
+
+
void ConfigccpmWidget::UpdateCurveSettings()
{
int NumCurvePoints,i;
@@ -242,40 +316,132 @@ void ConfigccpmWidget::GenerateCurve()
void ConfigccpmWidget::ccpmSwashplateUpdate()
{
- double angle,x,y;
+ double angle,correctionangle,x,y;
int used;
+ correctionangle=m_ccpm->ccpmCorrectionAngle->value();
- used=m_ccpm->ServoSettings->item(0,1)->text().compare("None");
+ used=m_ccpm->ccpmServoWChannel->currentIndex()<8;
ServoW->setVisible(used!=0);
- angle=(180+m_ccpm->ServoSettings->item(0,0)->text().toDouble())*Pi/180.00;
+ angle=(180+m_ccpm->ccpmAngleW->value())*Pi/180.00;
x=200.00-(200.00*sin(angle))-10.00;
y=200.00+(200.00*cos(angle))-10.00;
ServoW->setPos(x, y);
- used=m_ccpm->ServoSettings->item(1,1)->text().compare("None");
+ used=m_ccpm->ccpmServoXChannel->currentIndex()<8;
ServoX->setVisible(used!=0);
- angle=(180+m_ccpm->ServoSettings->item(1,0)->text().toDouble())*Pi/180.00;
+ angle=(180+m_ccpm->ccpmAngleX->value())*Pi/180.00;
x=200.00-(200.00*sin(angle))-10.00;
y=200.00+(200.00*cos(angle))-10.00;
ServoX->setPos(x, y);
- used=m_ccpm->ServoSettings->item(2,1)->text().compare("None");
+ used=m_ccpm->ccpmServoYChannel->currentIndex()<8;
ServoY->setVisible(used!=0);
- angle=(180+m_ccpm->ServoSettings->item(2,0)->text().toDouble())*Pi/180.00;
+ angle=(180+m_ccpm->ccpmAngleY->value())*Pi/180.00;
x=200.00-(200.00*sin(angle))-10.00;
y=200.00+(200.00*cos(angle))-10.00;
ServoY->setPos(x, y);
- used=m_ccpm->ServoSettings->item(3,1)->text().compare("None");
+ used=m_ccpm->ccpmServoZChannel->currentIndex()<8;
ServoZ->setVisible(used!=0);
- angle=(180+m_ccpm->ServoSettings->item(3,0)->text().toDouble())*Pi/180.00;
+ angle=(180+m_ccpm->ccpmAngleZ->value())*Pi/180.00;
x=200.00-(200.00*sin(angle))-10.00;
y=200.00+(200.00*cos(angle))-10.00;
ServoZ->setPos(x, y);
+ UpdateMixer();
+
}
+void ConfigccpmWidget::UpdateMixer()
+{
+ int i,j,Type;
+ float CollectiveConstant,ThisAngle[6];
+ QTableWidgetItem *newItem;// = new QTableWidgetItem();
+ QString Channel;
+
+ Type = m_ccpm->ccpmType->currentIndex();
+ CollectiveConstant=m_ccpm->ccpmCollectiveSlider->value()/100.0;
+
+
+ if (Type>0)
+ {//not advanced settings
+ //get the channel data from the ui
+ MixerChannelData[0] = m_ccpm->ccpmEngineChannel->currentIndex();
+ MixerChannelData[1] = m_ccpm->ccpmTailChannel->currentIndex();
+ MixerChannelData[2] = m_ccpm->ccpmServoWChannel->currentIndex();
+ MixerChannelData[3] = m_ccpm->ccpmServoXChannel->currentIndex();
+ MixerChannelData[4] = m_ccpm->ccpmServoYChannel->currentIndex();
+ MixerChannelData[5] = m_ccpm->ccpmServoZChannel->currentIndex();
+
+ //get the angle data from the ui
+ ThisAngle[2] = m_ccpm->ccpmAngleW->value();
+ ThisAngle[3] = m_ccpm->ccpmAngleX->value();
+ ThisAngle[4] = m_ccpm->ccpmAngleY->value();
+ ThisAngle[5] = m_ccpm->ccpmAngleZ->value();
+
+ //go through the user data and update the mixer matrix
+ for (i=0;i<6;i++)
+ {
+ /*
+ data.Mixer0Type = 0;//Disabled,Motor,Servo
+ data.Mixer0Vector[0] = 0;//ThrottleCurve1
+ data.Mixer0Vector[1] = 0;//ThrottleCurve2
+ data.Mixer0Vector[2] = 0;//Roll
+ data.Mixer0Vector[3] = 0;//Pitch
+ data.Mixer0Vector[4] = 0;//Yaw
+
+ */
+ if (MixerChannelData[i]<8)
+ {
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,0)->setText(QString("%1").arg( MixerChannelData[i] ));
+ //config the vector
+ if (i==0)
+ {//motor-engine
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,1)->setText(QString("%1").arg(127));//ThrottleCurve1
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,2)->setText(QString("%1").arg(0));//ThrottleCurve2
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,3)->setText(QString("%1").arg(0));//Roll
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,4)->setText(QString("%1").arg(0));//Pitch
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,5)->setText(QString("%1").arg(0));//Yaw
+ }
+ if (i==1)
+ {//tailrotor
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,1)->setText(QString("%1").arg(0));//ThrottleCurve1
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,2)->setText(QString("%1").arg(0));//ThrottleCurve2
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,3)->setText(QString("%1").arg(0));//Roll
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,4)->setText(QString("%1").arg(0));//Pitch
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,5)->setText(QString("%1").arg(127));//Yaw
+ }
+ if (i>1)
+ {//Swashplate
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,1)->setText(QString("%1").arg(0));//ThrottleCurve1
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,2)->setText(QString("%1").arg((int)(127.0*CollectiveConstant)));//ThrottleCurve2
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,3)->setText(QString("%1").arg((int)(127.0*(1-CollectiveConstant)*sin(ThisAngle[i]*Pi/180.00))));//Roll
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,4)->setText(QString("%1").arg((int)(127.0*(1-CollectiveConstant)*cos(ThisAngle[i]*Pi/180.00))));//Pitch
+ m_ccpm->ccpmAdvancedSettingsTable->item(i,5)->setText(QString("%1").arg(0));//Yaw
+
+ }
+ }
+ else
+ {
+ for (j=0;j<6;j++) m_ccpm->ccpmAdvancedSettingsTable->item(i,j)->setText(QString("-"));
+ }
+
+ }
+ }
+ else
+ {//advanced settings
+ for (i=0;i<6;i++)
+ {
+ Channel =m_ccpm->ccpmAdvancedSettingsTable->item(i,0)->text();
+ if (Channel == "-") Channel = QString("8");
+ MixerChannelData[i]= Channel.toInt();
+ }
+ }
+
+
+
+}
/**************************
* ccpm settings
@@ -307,10 +473,9 @@ void ConfigccpmWidget::requestccpmUpdate()
*/
void ConfigccpmWidget::sendccpmUpdate()
{
- int i,ThisChannel[6];
-float CollectiveConstant,ThisAngle[6];
+ int i,j;
+ float CollectiveConstant,ThisAngle[6];
UAVObjectField *field;
- QTableWidgetItem *newItem;// = new QTableWidgetItem();
UAVDataObject* obj;
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
@@ -319,31 +484,7 @@ float CollectiveConstant,ThisAngle[6];
obj = dynamic_cast(objManager->getObject(QString("MixerSettings")));
Q_ASSERT(obj);
- CollectiveConstant=m_ccpm->CollectiveConstant->value();
-
-
- //get the channel data from the ui
- ThisChannel[0] = m_ccpm->ccpmThrottle->currentText().toInt();
- ThisChannel[1] = m_ccpm->ccpmTailRotor->currentText().toInt();
- newItem =m_ccpm->ServoSettings->item(0, 1);
- ThisChannel[2] = newItem->text().toInt();
- newItem =m_ccpm->ServoSettings->item(1, 1);
- ThisChannel[3] = newItem->text().toInt();
- newItem =m_ccpm->ServoSettings->item(2, 1);
- ThisChannel[4] = newItem->text().toInt();
- newItem =m_ccpm->ServoSettings->item(3, 1);
- ThisChannel[5] = newItem->text().toInt();
-
-
- //get the angle data from the ui
- newItem =m_ccpm->ServoSettings->item(0, 0);
- ThisAngle[2] = newItem->text().toFloat();
- newItem =m_ccpm->ServoSettings->item(1, 0);
- ThisAngle[3] = newItem->text().toFloat();
- newItem =m_ccpm->ServoSettings->item(2, 0);
- ThisAngle[4] = newItem->text().toFloat();
- newItem =m_ccpm->ServoSettings->item(3, 0);
- ThisAngle[5] = newItem->text().toFloat();
+ UpdateMixer();
//go through the user data and update the mixer matrix
for (i=0;i<6;i++)
@@ -357,10 +498,10 @@ float CollectiveConstant,ThisAngle[6];
data.Mixer0Vector[4] = 0;//Yaw
*/
- if (ThisChannel[i]<8)
+ if (MixerChannelData[i]<8)
{
- //select the correct mixer for this config element
- field = obj->getField(tr( "Mixer%1Type" ).arg( ThisChannel[i] ));
+ //select the correct mixer for this config element
+ field = obj->getField(tr( "Mixer%1Type" ).arg( MixerChannelData[i] ));
//set the mixer type
if (i==0)
{
@@ -372,33 +513,13 @@ float CollectiveConstant,ThisAngle[6];
}
//select the correct mixer for this config element
- field = obj->getField(tr( "Mixer%1Vector" ).arg( ThisChannel[i] ));
- //config the vector
- if (i==0)
- {//motor
- field->setValue(127.0,0);//ThrottleCurve1
- field->setValue(0,1);//ThrottleCurve2
- field->setValue(0,2);//Roll
- field->setValue(0,3);//Pitch
- field->setValue(0,4);//Yaw
+ field = obj->getField(tr( "Mixer%1Vector" ).arg( MixerChannelData[i] ));
+ //config the vector
+ for (j=0;j<6;j++)
+ {
+ field->setValue(m_ccpm->ccpmAdvancedSettingsTable->item(i,1)->text().toInt());
}
- if (i==1)
- {//tailrotor
- field->setValue(0,0);//ThrottleCurve1
- field->setValue(0,1);//ThrottleCurve2
- field->setValue(0,2);//Roll
- field->setValue(0,3);//Pitch
- field->setValue(127.0,4);//Yaw
- }
- if (i>1)
- {//Swashplate
- field->setValue(0,0);//ThrottleCurve1
- field->setValue(127.0*CollectiveConstant,1);//ThrottleCurve2
- field->setValue(127.0*(1-CollectiveConstant)*sin(ThisAngle[i]*Pi/180.00),2);//Roll
- field->setValue(127.0*(1-CollectiveConstant)*cos(ThisAngle[i]*Pi/180.00),3);//Pitch
- field->setValue(0,4);//Yaw
- }
}
}
@@ -408,14 +529,12 @@ float CollectiveConstant,ThisAngle[6];
field = obj->getField(QString("ThrottleCurve1"));
for (i=0;i<5;i++)
{
- newItem =m_ccpm->CurveSettings->item(i, 0);
- field->setValue(newItem->text().toDouble(),i);
+ field->setValue(m_ccpm->CurveSettings->item(i, 0)->text().toDouble(),i);
}
field = obj->getField(QString("ThrottleCurve2"));
for (i=0;i<5;i++)
{
- newItem =m_ccpm->CurveSettings->item(i, 1);
- field->setValue(newItem->text().toDouble(),i);
+ field->setValue(m_ccpm->CurveSettings->item(i, 1)->text().toDouble(),i);
}
obj->updated();
diff --git a/ground/src/plugins/config/configccpmwidget.h b/ground/src/plugins/config/configccpmwidget.h
index 6b6d47f10..d9b5b6bdb 100644
--- a/ground/src/plugins/config/configccpmwidget.h
+++ b/ground/src/plugins/config/configccpmwidget.h
@@ -56,6 +56,8 @@ private:
QGraphicsSvgItem *ServoY;
QGraphicsSvgItem *ServoZ;
+ int MixerChannelData[6];
+
private slots:
void requestccpmUpdate();
void sendccpmUpdate();
@@ -63,6 +65,8 @@ private:
void ccpmSwashplateUpdate();
void UpdateCurveSettings();
void GenerateCurve();
+ void UpdateMixer();
+ void UpdateType();
};