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

continued modifying UI for ccpm mixing.

NONE of this has not been tested with hardware in it's current form.
Use at own risk! 


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1946 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
andrew 2010-10-12 05:12:56 +00:00 committed by andrew
parent 1824440c8e
commit 093e475dfc
3 changed files with 1132 additions and 821 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>806</width>
<height>822</height>
<width>821</width>
<height>606</height>
</rect>
</property>
<property name="windowTitle">
@ -18,8 +18,8 @@
<rect>
<x>10</x>
<y>10</y>
<width>1096</width>
<height>541</height>
<width>791</width>
<height>551</height>
</rect>
</property>
<property name="currentIndex">
@ -46,11 +46,6 @@
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
<item>
<property name="text">
<string>Custom - Advanced settings</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
@ -65,7 +60,7 @@
<string>Swashplate config:</string>
</property>
</widget>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>11</x>
@ -283,7 +278,7 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="ccpmServoZChannel_2">
<widget class="QComboBox" name="ccpmSingleServo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -458,7 +453,7 @@
</widget>
</item>
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="CorrectionAngle_2">
<widget class="QDoubleSpinBox" name="ccpmCorrectionAngle">
<property name="enabled">
<bool>true</bool>
</property>
@ -482,6 +477,9 @@
</item>
<item>
<widget class="QGroupBox" name="ccpmPitchMixingBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>CCPM Mixing</string>
</property>
@ -493,7 +491,7 @@
</property>
<widget class="QLabel" name="label_15">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Collective</string>
@ -504,7 +502,13 @@
</widget>
<widget class="QSlider" name="ccpmCollectiveSlider">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
@ -521,7 +525,7 @@
</widget>
<widget class="QLabel" name="label_16">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Cyclic</string>
@ -532,6 +536,19 @@
</widget>
</widget>
</item>
<item>
<widget class="QSpinBox" name="ccpmCollectivespinBox">
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -584,6 +601,9 @@
</widget>
</widget>
</item>
<item>
<widget class="QSpinBox" name="ccpmREVOspinBox"/>
</item>
</layout>
</widget>
</item>
@ -638,6 +658,30 @@
<height>400</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="backgroundBrush">
<brush brushstyle="SolidPattern">
<color alpha="25">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
@ -657,101 +701,647 @@
<attribute name="title">
<string>Curve settings</string>
</attribute>
<widget class="QTableWidget" name="CurveSettings">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>190</y>
<width>261</width>
<height>141</height>
<x>22</x>
<y>11</y>
<width>661</width>
<height>501</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QComboBox" name="CurveType">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Flat</string>
</property>
</item>
<item>
<property name="text">
<string>Step</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Number of points</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="NumCurvePoints">
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="CurveLabel1">
<property name="text">
<string>Min</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="CurveLabel2">
<property name="text">
<string>Max</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="CurveLabel3">
<property name="text">
<string>Step point</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDoubleSpinBox" name="CurveValue1">
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="CurveValue2">
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="CurveValue3">
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>50.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QComboBox" name="CurveToGenerate">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
<item>
<property name="text">
<string>Throttle</string>
</property>
</item>
<item>
<property name="text">
<string>Pitch</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="ccpmGenerateCurve">
<property name="toolTip">
<string>Generate curves based on settings</string>
</property>
<property name="text">
<string>&lt;-- Generate Curve</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="1" rowspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_21">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QLabel" name="label_41">
<property name="text">
<string>Throttle Curve 2</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="MixerCurveWidget" name="widget_2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>150</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="customThrottleCurve2Value">
<property name="text">
<string>Val: 0.00</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_20">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_39">
<property name="text">
<string>Throttle Curve 1</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="MixerCurveWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>150</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="customThrottleCurve1Value">
<property name="text">
<string>Val: 0.00</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QFormLayout" name="formLayout_5">
<item row="0" column="0">
<widget class="QTableWidget" name="CurveSettings">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<row>
<property name="text">
<string>0%</string>
</property>
</row>
<row>
<property name="text">
<string>25%</string>
</property>
</row>
<row>
<property name="text">
<string>50%</string>
</property>
</row>
<row>
<property name="text">
<string>75%</string>
</property>
</row>
<row>
<property name="text">
<string>100%</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<column>
<property name="text">
<string>Throttle Curve</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>Blade Pitch Curve</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>0</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="0" column="1">
<property name="text">
<string>0</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>.25</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="1">
<property name="text">
<string>.25</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>.5</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="1">
<property name="text">
<string>.5</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>.75</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="1">
<property name="text">
<string>.75</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="4" column="0">
<property name="text">
<string>1</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="4" column="1">
<property name="text">
<string>1</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="5" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="5" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="6" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="6" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="7" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="7" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="8" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="8" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="9" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="9" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Advanced settings</string>
</attribute>
<widget class="QTableWidget" name="ccpmAdvancedSettingsTable">
<property name="geometry">
<rect>
<x>15</x>
<y>21</y>
<width>661</width>
<height>211</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<row>
<property name="text">
<string>0%</string>
<string>Engine</string>
</property>
</row>
<row>
<property name="text">
<string>25%</string>
<string>Tail Rotor</string>
</property>
</row>
<row>
<property name="text">
<string>50%</string>
<string>Servo W</string>
</property>
</row>
<row>
<property name="text">
<string>75%</string>
<string>Servo X</string>
</property>
</row>
<row>
<property name="text">
<string>100%</string>
<string>Servo Y</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
<string>Servo Z</string>
</property>
</row>
<column>
<property name="text">
<string>Throttle Curve</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
<string>Channel</string>
</property>
</column>
<column>
<property name="text">
<string>Blade Pitch Curve</string>
<string>Curve 1</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</column>
<column>
<property name="text">
<string>Curve 2</string>
</property>
</column>
<column>
<property name="text">
<string>Roll</string>
</property>
</column>
<column>
<property name="text">
<string>Pitch</string>
</property>
</column>
<column>
<property name="text">
<string>Yaw</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>0</string>
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@ -759,7 +1349,39 @@
</item>
<item row="0" column="1">
<property name="text">
<string>0</string>
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="0" column="2">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="0" column="3">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="0" column="4">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="0" column="5">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@ -767,7 +1389,7 @@
</item>
<item row="1" column="0">
<property name="text">
<string>.25</string>
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@ -775,7 +1397,39 @@
</item>
<item row="1" column="1">
<property name="text">
<string>.25</string>
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="2">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="3">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="4">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="5">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@ -783,7 +1437,7 @@
</item>
<item row="2" column="0">
<property name="text">
<string>.5</string>
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@ -791,7 +1445,39 @@
</item>
<item row="2" column="1">
<property name="text">
<string>.5</string>
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="2">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="3">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="4">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="5">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@ -799,7 +1485,7 @@
</item>
<item row="3" column="0">
<property name="text">
<string>.75</string>
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@ -807,7 +1493,39 @@
</item>
<item row="3" column="1">
<property name="text">
<string>.75</string>
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="2">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="3">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="4">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="5">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@ -815,7 +1533,7 @@
</item>
<item row="4" column="0">
<property name="text">
<string>1</string>
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@ -823,7 +1541,39 @@
</item>
<item row="4" column="1">
<property name="text">
<string>1</string>
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="4" column="2">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="4" column="3">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="4" column="4">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="4" column="5">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@ -845,7 +1595,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="6" column="0">
<item row="5" column="2">
<property name="text">
<string>-</string>
</property>
@ -853,7 +1603,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="6" column="1">
<item row="5" column="3">
<property name="text">
<string>-</string>
</property>
@ -861,7 +1611,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="7" column="0">
<item row="5" column="4">
<property name="text">
<string>-</string>
</property>
@ -869,7 +1619,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="7" column="1">
<item row="5" column="5">
<property name="text">
<string>-</string>
</property>
@ -877,676 +1627,6 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="8" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="8" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="9" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="9" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
</widget>
<widget class="QComboBox" name="CurveType">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>271</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Flat</string>
</property>
</item>
<item>
<property name="text">
<string>Step</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
<widget class="QSpinBox" name="NumCurvePoints">
<property name="geometry">
<rect>
<x>180</x>
<y>50</y>
<width>51</width>
<height>22</height>
</rect>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>80</x>
<y>50</y>
<width>91</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Number of points</string>
</property>
</widget>
<widget class="QPushButton" name="ccpmGenerateCurve">
<property name="geometry">
<rect>
<x>150</x>
<y>140</y>
<width>121</width>
<height>27</height>
</rect>
</property>
<property name="toolTip">
<string>Generate curves based on settings</string>
</property>
<property name="text">
<string>&lt;-- Generate Curve</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="CurveValue1">
<property name="geometry">
<rect>
<x>40</x>
<y>100</y>
<width>62</width>
<height>22</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="CurveValue2">
<property name="geometry">
<rect>
<x>130</x>
<y>100</y>
<width>62</width>
<height>22</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="CurveValue3">
<property name="geometry">
<rect>
<x>220</x>
<y>100</y>
<width>62</width>
<height>22</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>50.000000000000000</double>
</property>
</widget>
<widget class="QLabel" name="CurveLabel1">
<property name="geometry">
<rect>
<x>40</x>
<y>80</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Min</string>
</property>
</widget>
<widget class="QLabel" name="CurveLabel2">
<property name="geometry">
<rect>
<x>130</x>
<y>80</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Max</string>
</property>
</widget>
<widget class="QLabel" name="CurveLabel3">
<property name="geometry">
<rect>
<x>220</x>
<y>80</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Step point</string>
</property>
</widget>
<widget class="QGraphicsView" name="CurveGraph">
<property name="geometry">
<rect>
<x>310</x>
<y>10</y>
<width>371</width>
<height>331</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="CurveToGenerate">
<property name="geometry">
<rect>
<x>30</x>
<y>140</y>
<width>111</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
<item>
<property name="text">
<string>Throttle</string>
</property>
</item>
<item>
<property name="text">
<string>Pitch</string>
</property>
</item>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Advanced settings</string>
</attribute>
<widget class="QTableWidget" name="ServoSettings">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>251</width>
<height>141</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<row>
<property name="text">
<string>ServoW</string>
</property>
</row>
<row>
<property name="text">
<string>ServoX</string>
</property>
</row>
<row>
<property name="text">
<string>ServoY</string>
</property>
</row>
<row>
<property name="text">
<string>ServoZ</string>
</property>
</row>
<column>
<property name="text">
<string>Angle</string>
</property>
</column>
<column>
<property name="text">
<string>Output</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>0</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="0" column="1">
<property name="text">
<string>8</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>60</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="1">
<property name="text">
<string>5</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>180</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="1">
<property name="text">
<string>1</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>300</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="1">
<property name="text">
<string>0</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>101</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>CollectiveConstant:</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>260</y>
<width>91</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>CorrectionAngle:</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>10</x>
<y>290</y>
<width>101</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Throttle Output</string>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>10</x>
<y>320</y>
<width>81</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Tail Rotor Servo</string>
</property>
</widget>
<widget class="QComboBox" name="ccpmThrottle">
<property name="geometry">
<rect>
<x>90</x>
<y>290</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
<item>
<property name="text">
<string>6</string>
</property>
</item>
<item>
<property name="text">
<string>7</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="ccpmTailRotor">
<property name="geometry">
<rect>
<x>90</x>
<y>320</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
<property name="currentIndex">
<number>3</number>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
<item>
<property name="text">
<string>6</string>
</property>
</item>
<item>
<property name="text">
<string>7</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
</widget>
<widget class="QDoubleSpinBox" name="CollectiveConstant">
<property name="geometry">
<rect>
<x>130</x>
<y>180</y>
<width>62</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
<property name="value">
<double>0.500000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="CorrectionAngle">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>130</x>
<y>260</y>
<width>62</width>
<height>22</height>
</rect>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
<property name="singleStep">
<double>15.000000000000000</double>
</property>
</widget>
<widget class="QGraphicsView" name="SwashplateImage_Adv">
<property name="geometry">
<rect>
<x>300</x>
<y>10</y>
<width>371</width>
<height>331</height>
</rect>
</property>
</widget>
<widget class="QDoubleSpinBox" name="RevoConstant">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>130</x>
<y>220</y>
<width>62</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
<property name="value">
<double>0.500000000000000</double>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<width>101</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>RevoConstant:</string>
</property>
</widget>
</widget>
</widget>
@ -1599,6 +1679,114 @@
</property>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>MixerCurveWidget</class>
<extends>QWidget</extends>
<header>mixercurvewidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>TabObject</tabstop>
<tabstop>ccpmType</tabstop>
<tabstop>ccpmEngineChannel</tabstop>
<tabstop>ccpmTailChannel</tabstop>
<tabstop>ccpmServoWChannel</tabstop>
<tabstop>ccpmServoXChannel</tabstop>
<tabstop>ccpmServoYChannel</tabstop>
<tabstop>ccpmServoZChannel</tabstop>
<tabstop>ccpmSingleServo</tabstop>
<tabstop>ccpmAngleW</tabstop>
<tabstop>ccpmAngleX</tabstop>
<tabstop>ccpmAngleY</tabstop>
<tabstop>ccpmAngleZ</tabstop>
<tabstop>ccpmCorrectionAngle</tabstop>
<tabstop>ccpmCollectiveSlider</tabstop>
<tabstop>ccpmCollectivespinBox</tabstop>
<tabstop>ccpmRevoSlider</tabstop>
<tabstop>ccpmREVOspinBox</tabstop>
<tabstop>SwashplateImage</tabstop>
<tabstop>getccpmCurrent</tabstop>
<tabstop>saveccpmToRAM</tabstop>
<tabstop>saveccpmToSD</tabstop>
<tabstop>CurveType</tabstop>
<tabstop>NumCurvePoints</tabstop>
<tabstop>CurveValue1</tabstop>
<tabstop>CurveValue2</tabstop>
<tabstop>CurveValue3</tabstop>
<tabstop>CurveToGenerate</tabstop>
<tabstop>ccpmGenerateCurve</tabstop>
<tabstop>pushButton_3</tabstop>
<tabstop>pushButton_2</tabstop>
<tabstop>CurveSettings</tabstop>
<tabstop>ccpmAdvancedSettingsTable</tabstop>
</tabstops>
<resources/>
<connections/>
<connections>
<connection>
<sender>ccpmCollectiveSlider</sender>
<signal>sliderMoved(int)</signal>
<receiver>ccpmCollectivespinBox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>246</x>
<y>309</y>
</hint>
<hint type="destinationlabel">
<x>228</x>
<y>501</y>
</hint>
</hints>
</connection>
<connection>
<sender>ccpmCollectivespinBox</sender>
<signal>valueChanged(int)</signal>
<receiver>ccpmCollectiveSlider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>247</x>
<y>496</y>
</hint>
<hint type="destinationlabel">
<x>243</x>
<y>391</y>
</hint>
</hints>
</connection>
<connection>
<sender>ccpmREVOspinBox</sender>
<signal>valueChanged(int)</signal>
<receiver>ccpmRevoSlider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>320</x>
<y>498</y>
</hint>
<hint type="destinationlabel">
<x>326</x>
<y>393</y>
</hint>
</hints>
</connection>
<connection>
<sender>ccpmRevoSlider</sender>
<signal>sliderMoved(int)</signal>
<receiver>ccpmREVOspinBox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>303</x>
<y>222</y>
</hint>
<hint type="destinationlabel">
<x>308</x>
<y>496</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -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<UAVDataObject*>(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();

View File

@ -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();
};