diff --git a/ground/openpilotgcs/src/plugins/config/airframe.ui b/ground/openpilotgcs/src/plugins/config/airframe.ui index e3bb54aa9..1e2e15b03 100644 --- a/ground/openpilotgcs/src/plugins/config/airframe.ui +++ b/ground/openpilotgcs/src/plugins/config/airframe.ui @@ -6,17 +6,14 @@ <rect> <x>0</x> <y>0</y> - <width>839</width> - <height>1007</height> + <width>939</width> + <height>657</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_18"> - <property name="spacing"> - <number>12</number> - </property> + <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> @@ -26,161 +23,551 @@ <attribute name="title"> <string>Mixer Settings</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0"> + <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0"> <property name="margin"> - <number>0</number> + <number>5</number> </property> <item> - <widget class="QScrollArea" name="scrollArea"> - <property name="palette"> - <palette> - <active> - <colorrole role="Base"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Window"> - <brush brushstyle="SolidPattern"> - <color alpha="0"> - <red>232</red> - <green>232</green> - <blue>232</blue> - </color> - </brush> - </colorrole> - </active> - <inactive> - <colorrole role="Base"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Window"> - <brush brushstyle="SolidPattern"> - <color alpha="0"> - <red>232</red> - <green>232</green> - <blue>232</blue> - </color> - </brush> - </colorrole> - </inactive> - <disabled> - <colorrole role="Base"> - <brush brushstyle="SolidPattern"> - <color alpha="0"> - <red>232</red> - <green>232</green> - <blue>232</blue> - </color> - </brush> - </colorrole> - <colorrole role="Window"> - <brush brushstyle="SolidPattern"> - <color alpha="0"> - <red>232</red> - <green>232</green> - <blue>232</blue> - </color> - </brush> - </colorrole> - </disabled> - </palette> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Vehicle type:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="aircraftType"> + <property name="toolTip"> + <string>Select aircraft type here</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> + </widget> + </item> + <item> + <widget class="QStackedWidget" name="airframesWidget"> + <property name="currentIndex"> + <number>0</number> </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>809</width> - <height>874</height> - </rect> + <widget class="QWidget" name="fixedWing"> + <property name="enabled"> + <bool>true</bool> </property> - <layout class="QVBoxLayout" name="verticalLayout_12"> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3" stretch="0"> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QVBoxLayout" name="verticalLayout_6"> <item> - <widget class="QLabel" name="label"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Vehicle type:</string> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Airplane type:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="fixedWingType"/> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> </item> <item> - <widget class="QComboBox" name="aircraftType"> - <property name="toolTip"> - <string>Select aircraft type here</string> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout_23"/> </item> <item> - <spacer name="horizontalSpacer_2"> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>230</width> + <height>100</height> + </size> + </property> + <property name="title"> + <string>Output Channel Assignments</string> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <item row="1" column="0"> + <widget class="QLabel" name="fwEngineLabel"> + <property name="text"> + <string>Engine</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="fwEngineChannelBox"> + <property name="toolTip"> + <string>Select output channel for the engine</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="fwAileron1Label"> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Aileron 1</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="fwAileron1ChannelBox"> + <property name="toolTip"> + <string>Select output channel for the first aileron (or elevon)</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="fwAileron2Label"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Aileron 2</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="fwAileron2ChannelBox"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Select output channel for the second aileron (or elevon)</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="fwElevator1Label"> + <property name="minimumSize"> + <size> + <width>67</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Elevator 1</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="fwElevator1ChannelBox"> + <property name="toolTip"> + <string>Select output channel for the first elevator</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="fwElevator2Label"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>67</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Elevator 2</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QComboBox" name="fwElevator2ChannelBox"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Select output channel for a secondary elevator</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="fwRudder1Label"> + <property name="text"> + <string>Rudder 1</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QComboBox" name="fwRudder1ChannelBox"> + <property name="toolTip"> + <string>Select output channel for the first rudder</string> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="fwRudder2Label"> + <property name="text"> + <string>Rudder 2</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QComboBox" name="fwRudder2ChannelBox"> + <property name="toolTip"> + <string>Select output channel for a secondary rudder</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="elevonMixBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Elevon Mix</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_13"> + <item> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_14"> + <item> + <widget class="QLabel" name="elevonLabel1"> + <property name="minimumSize"> + <size> + <width>65</width> + <height>0</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>Rudder %</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="elevonSlider1"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="elevonSliderLabel1"> + <property name="text"> + <string>50</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_15"> + <item> + <widget class="QLabel" name="elevonLabel2"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>Pitch %</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="elevonSlider2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="elevonSliderLabel2"> + <property name="text"> + <string>50</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QGroupBox" name="groupBox_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>100</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Throttle Curve</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_16"> + <item> + <widget class="MixerCurve" name="fixedWingThrottle" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>500</width> + <height>500</height> + </size> + </property> + <property name="sizeIncrement"> + <size> + <width>10</width> + <height>10</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>300</width> + <height>350</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> <property name="orientation"> - <enum>Qt::Horizontal</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> - <height>20</height> + <height>40</height> </size> </property> </spacer> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_13"> + <item> + <spacer name="horizontalSpacer_11"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="fwStatusLabel"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Mixer OK</string> + </property> + </widget> + </item> + </layout> + </item> </layout> </item> + </layout> + </widget> + <widget class="QWidget" name="multiRotor"> + <layout class="QVBoxLayout" name="verticalLayout_4" stretch="1"> <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QStackedWidget" name="airframesWidget"> - <property name="currentIndex"> - <number>1</number> - </property> - <widget class="QWidget" name="fixedWing"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3" stretch="0"> + <layout class="QVBoxLayout" name="verticalLayout_8" stretch="0,0,0"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,0"> <item> - <layout class="QVBoxLayout" name="verticalLayout_6"> + <layout class="QVBoxLayout" name="verticalLayout_24"> <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> <item> - <widget class="QLabel" name="label_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <widget class="QLabel" name="label_15"> <property name="font"> <font> <weight>75</weight> @@ -188,459 +575,19 @@ </font> </property> <property name="text"> - <string>Airplane type:</string> + <string>Frame type:</string> </property> </widget> </item> <item> - <widget class="QComboBox" name="fixedWingType"/> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <widget class="QComboBox" name="multirotorFrameType"> + <property name="toolTip"> + <string>Select the Multirotor frame type here.</string> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_23"/> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>230</width> - <height>100</height> - </size> - </property> - <property name="title"> - <string>Output Channel Assignments</string> - </property> - <layout class="QFormLayout" name="formLayout_3"> - <item row="1" column="0"> - <widget class="QLabel" name="fwEngineLabel"> - <property name="text"> - <string>Engine</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="fwEngineChannelBox"> - <property name="toolTip"> - <string>Select output channel for the engine</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="fwAileron1Label"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Aileron 1</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="fwAileron1ChannelBox"> - <property name="toolTip"> - <string>Select output channel for the first aileron (or elevon)</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="fwAileron2Label"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Aileron 2</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QComboBox" name="fwAileron2ChannelBox"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Select output channel for the second aileron (or elevon)</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="fwElevator1Label"> - <property name="minimumSize"> - <size> - <width>67</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Elevator 1</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="fwElevator1ChannelBox"> - <property name="toolTip"> - <string>Select output channel for the first elevator</string> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="fwElevator2Label"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="minimumSize"> - <size> - <width>67</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Elevator 2</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QComboBox" name="fwElevator2ChannelBox"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Select output channel for a secondary elevator</string> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="fwRudder1Label"> - <property name="text"> - <string>Rudder 1</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QComboBox" name="fwRudder1ChannelBox"> - <property name="toolTip"> - <string>Select output channel for the first rudder</string> - </property> - </widget> - </item> - <item row="7" column="0"> - <widget class="QLabel" name="fwRudder2Label"> - <property name="text"> - <string>Rudder 2</string> - </property> - </widget> - </item> - <item row="7" column="1"> - <widget class="QComboBox" name="fwRudder2ChannelBox"> - <property name="toolTip"> - <string>Select output channel for a secondary rudder</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> </widget> </item> <item> - <widget class="QGroupBox" name="elevonMixBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Elevon Mix</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_13"> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_14"> - <item> - <widget class="QLabel" name="elevonLabel1"> - <property name="minimumSize"> - <size> - <width>65</width> - <height>0</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>Rudder %</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="elevonSlider1"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>50</number> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="elevonSliderLabel1"> - <property name="text"> - <string>50</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_15"> - <item> - <widget class="QLabel" name="elevonLabel2"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>Pitch %</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="elevonSlider2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>50</number> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="elevonSliderLabel2"> - <property name="text"> - <string>50</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>100</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Throttle Curve</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_16"> - <item> - <spacer name="verticalSpacer_6"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="MixerCurveWidget" name="fixedWingThrottle" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>100</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>200</width> - <height>200</height> - </size> - </property> - <property name="sizeIncrement"> - <size> - <width>10</width> - <height>10</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="fwThrottleReset"> - <property name="maximumSize"> - <size> - <width>200</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="fwThrottleCurveItemValue"> - <property name="text"> - <string>Val: 0.00</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_13"> - <item> - <spacer name="horizontalSpacer_11"> + <spacer name="horizontalSpacer_5"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> @@ -652,37 +599,16 @@ margin:1px;</string> </property> </spacer> </item> - <item> - <widget class="QLabel" name="fwStatusLabel"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Mixer OK</string> - </property> - </widget> - </item> </layout> </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="multiRotor"> - <layout class="QVBoxLayout" name="verticalLayout_4" stretch="1"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_8" stretch="0,0,0"> <item> - <layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,0,0"> + <layout class="QHBoxLayout" name="horizontalLayout_22"> <item> - <layout class="QVBoxLayout" name="verticalLayout_24"> + <layout class="QVBoxLayout" name="verticalLayout_20"> <item> - <layout class="QHBoxLayout" name="horizontalLayout_5"> + <layout class="QHBoxLayout" name="horizontalLayout_25"> <item> - <widget class="QLabel" name="label_15"> + <widget class="QLabel" name="label_4"> <property name="font"> <font> <weight>75</weight> @@ -690,408 +616,12 @@ margin:1px;</string> </font> </property> <property name="text"> - <string>Frame type:</string> + <string>Mix Level</string> </property> </widget> </item> <item> - <widget class="QComboBox" name="multirotorFrameType"> - <property name="toolTip"> - <string>Select the Multirotor frame type here.</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::MinimumExpanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_22"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_20"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_25"> - <item> - <widget class="QLabel" name="label_4"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Mix Level</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_17"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_19"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_22"> - <item> - <widget class="QLabel" name="mrRollMixValue"> - <property name="minimumSize"> - <size> - <width>30</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>100</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="mrRollMixLevel"> - <property name="minimumSize"> - <size> - <width>35</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Weight of Roll mixing in percent. -Typical values are 100% for + configuration and 50% for X configuration on quads.</string> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_42"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>R</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_23"> - <item> - <widget class="QLabel" name="mrPitchMixValue"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>100</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="mrPitchMixLevel"> - <property name="minimumSize"> - <size> - <width>35</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Weight of Pitch mixing in percent. -Typical values are 100% for + configuration and 50% for X configuration on quads.</string> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_40"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>P</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_21"> - <item> - <widget class="QLabel" name="mrYawMixValue"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>50</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="mrYawMixLevel"> - <property name="minimumSize"> - <size> - <width>40</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Weight of Yaw mixing in percent. -Typical value is 50% for + or X configuration on quads.</string> - </property> - <property name="minimum"> - <number>-100</number> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>50</number> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_6"> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>Y</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </item> - <item> - <widget class="QGraphicsView" name="quadShape"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>80</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">background:transparent</string> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_6"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::MinimumExpanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QGroupBox" name="groupBox_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Throtte Curve</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_9"> - <item> - <spacer name="verticalSpacer_7"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>10</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="MixerCurveWidget" name="multiThrottleCurve" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>80</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">background:transparent</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="mrThrottleCurveReset"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>200</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="mrThrottleCurveItemValue"> - <property name="text"> - <string>Val: 0.00</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,3"> - <property name="spacing"> - <number>10</number> - </property> - <item> - <layout class="QVBoxLayout" name="verticalLayout_10"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_26"> - <item> - <widget class="QLabel" name="label_23"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Tricopter Yaw</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_18"> + <spacer name="horizontalSpacer_17"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> @@ -1106,711 +636,292 @@ margin:1px;</string> </layout> </item> <item> - <widget class="QLabel" name="label_2"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); + <layout class="QHBoxLayout" name="horizontalLayout_19"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_22"> + <item> + <widget class="QLabel" name="mrRollMixValue"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>100</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="mrRollMixLevel"> + <property name="minimumSize"> + <size> + <width>35</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Weight of Roll mixing in percent. +Typical values are 100% for + configuration and 50% for X configuration on quads.</string> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_42"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); color: rgb(255, 255, 255); border-radius: 5; font: bold 12px; margin:1px;</string> - </property> - <property name="text"> - <string>channel:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="triYawChannelBox"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>40</width> - <height>0</height> - </size> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> + </property> + <property name="text"> + <string>R</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_23"> + <item> + <widget class="QLabel" name="mrPitchMixValue"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>100</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="mrPitchMixLevel"> + <property name="minimumSize"> + <size> + <width>35</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Weight of Pitch mixing in percent. +Typical values are 100% for + configuration and 50% for X configuration on quads.</string> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_40"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>P</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_21"> + <item> + <widget class="QLabel" name="mrYawMixValue"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>50</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="mrYawMixLevel"> + <property name="minimumSize"> + <size> + <width>40</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Weight of Yaw mixing in percent. +Typical value is 50% for + or X configuration on quads.</string> + </property> + <property name="minimum"> + <number>-100</number> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_6"> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>Y</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </item> + </layout> </item> </layout> </item> <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Motor output channels</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_10"> - <property name="spacing"> - <number>1</number> - </property> - <property name="margin"> - <number>1</number> - </property> - <item> - <layout class="QFormLayout" name="formLayout_2"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <item row="1" column="0"> - <widget class="QLabel" name="MotorOutputLabel1"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>1</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="multiMotorChannelBox1"> - <property name="toolTip"> - <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_8"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>2</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="multiMotorChannelBox2"> - <property name="toolTip"> - <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_9"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>3</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QComboBox" name="multiMotorChannelBox3"> - <property name="toolTip"> - <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_10"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>4</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="multiMotorChannelBox4"> - <property name="toolTip"> - <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <spacer name="verticalSpacer_8"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QFormLayout" name="formLayout_4"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <item row="1" column="0"> - <widget class="QLabel" name="label_11"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>5</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="multiMotorChannelBox5"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_12"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>6</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="multiMotorChannelBox6"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_16"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>7</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QComboBox" name="multiMotorChannelBox7"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_17"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>8</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="multiMotorChannelBox8"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <spacer name="verticalSpacer_9"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_20"> - <item> - <spacer name="horizontalSpacer_12"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::MinimumExpanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="mrStatusLabel"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Mixer OK</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="ccpmHeli"> - <layout class="QVBoxLayout" name="verticalLayout_5" stretch="1"> - <property name="spacing"> - <number>0</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <layout class="QVBoxLayout" name="verticalLayout_19"> - <property name="spacing"> - <number>0</number> - </property> - <item> - <widget class="ConfigCcpmWidget" name="widget_3" native="true"/> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="groundVehicle"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout_31" stretch="0"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_61"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_31"> - <item> - <widget class="QLabel" name="label_51"> + <widget class="QGraphicsView" name="quadShape"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Vehicle type:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="groundVehicleType"/> - </item> - <item> - <spacer name="horizontalSpacer_31"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_33"> - <item> - <widget class="QLabel" name="label_7"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Channel Assignment</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_15"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_41"> - <item> - <widget class="QGroupBox" name="groupBox_7"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>0</width> - <height>100</height> + <width>110</width> + <height>110</height> </size> </property> - <property name="title"> - <string>Output channel asignmets</string> + <property name="styleSheet"> + <string notr="true">background:transparent</string> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <widget class="QGroupBox" name="groupBox_6"> + <property name="title"> + <string>Throttle Curve</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <widget class="MixerCurve" name="multiThrottleCurve" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="sizeIncrement"> + <size> + <width>10</width> + <height>10</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>300</width> + <height>350</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background:transparent</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,3"> + <property name="spacing"> + <number>10</number> + </property> + <item> + <layout class="QVBoxLayout" name="verticalLayout_10"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_26"> + <item> + <widget class="QLabel" name="label_23"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Tricopter Yaw</string> </property> - <layout class="QFormLayout" name="formLayout_5"> - <item row="0" column="0"> - <widget class="QLabel" name="gvEngineLabel"> - <property name="minimumSize"> - <size> - <width>77</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Engine</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="gvEngineChannelBox"> - <property name="toolTip"> - <string>Select output channel for the engine</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="gvAileron1Label"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Aileron 1</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="gvAileron1ChannelBox"> - <property name="toolTip"> - <string>Select output channel for the first aileron (or elevon)</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="gvAileron2Label"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Aileron 2</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="gvAileron2ChannelBox"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Select output channel for the second aileron (or elevon)</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="gvMotor1Label"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Motor</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QComboBox" name="gvMotor1ChannelBox"> - <property name="toolTip"> - <string>Select output channel for the first motor</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="gvMotor2Label"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="minimumSize"> - <size> - <width>47</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Motor 2</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="gvMotor2ChannelBox"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Select output channel for a second motor</string> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="gvSteering1Label"> - <property name="text"> - <string>Front Steering</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QComboBox" name="gvSteering1ChannelBox"> - <property name="toolTip"> - <string>Select output channel for the first steering actuator</string> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="gvSteering2Label"> - <property name="text"> - <string>Rear Steering</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QComboBox" name="gvSteering2ChannelBox"> - <property name="toolTip"> - <string>Select output channel for a second steering actuator</string> - </property> - </widget> - </item> - </layout> </widget> </item> <item> - <widget class="QGroupBox" name="differentialSteeringMixBox"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Differential Steering Mix</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_33"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_30"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_34"> - <item> - <widget class="QLabel" name="differentialSteeringLabel1"> - <property name="minimumSize"> - <size> - <width>65</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Left %</string> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="differentialSteeringSlider1"> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>50</number> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="gvDiffSteering1Label"> - <property name="text"> - <string>50</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_35"> - <item> - <widget class="QLabel" name="differentialSteeringLabel2"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Right %</string> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="differentialSteeringSlider2"> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>50</number> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="gvDiffSteering2Label"> - <property name="text"> - <string>50</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_24"> + <spacer name="horizontalSpacer_18"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> @@ -1822,118 +933,43 @@ margin:1px;</string> </property> </spacer> </item> - <item> - <widget class="QGroupBox" name="gvThrottleCurve1GroupBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>100</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Front throttle curve</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_36"> - <item> - <widget class="MixerCurveWidget" name="groundVehicleThrottle1" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>100</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>200</width> - <height>200</height> - </size> - </property> - <property name="sizeIncrement"> - <size> - <width>10</width> - <height>10</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="gvThrottleCurve1Reset"> - <property name="maximumSize"> - <size> - <width>200</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="gvThrottleCurve1ItemValue"> - <property name="text"> - <string>Val: 0.00</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="gvThrottleCurve2GroupBox"> - <property name="title"> - <string>Rear throttle curve</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_37"> - <item> - <widget class="MixerCurveWidget" name="groundVehicleThrottle2" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>100</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>200</width> - <height>200</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="gvThrottleCurve2Reset"> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="gvThrottleCurve2ItemValue"> - <property name="text"> - <string>Val: 0.00</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> </layout> </item> <item> - <spacer name="verticalSpacer_1"> + <widget class="QLabel" name="label_2"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>channel:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="triYawChannelBox"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>40</width> + <height>0</height> + </size> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_4"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> @@ -1945,744 +981,280 @@ margin:1px;</string> </property> </spacer> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_28"> - <item> - <spacer name="horizontalSpacer_21"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="gvStatusLabel"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Mixer OK</string> - </property> - </widget> - </item> - </layout> - </item> </layout> </item> - </layout> - </widget> - <widget class="QWidget" name="custom"> - <layout class="QHBoxLayout" name="horizontalLayout_15"> <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout_14"> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>Curve 1</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <item> - <widget class="MixerCurveWidget" name="customThrottle1Curve" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>100</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>200</width> - <height>200</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="customReset1"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="customThrottleCurve1Value"> - <property name="text"> - <string>Val: 0.00</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_9"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>Curve 2</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_17"> - <item> - <widget class="MixerCurveWidget" name="customThrottle2Curve" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>100</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>200</width> - <height>200</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="customReset2"> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="customThrottleCurve2Value"> - <property name="text"> - <string>Val: 0.00</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - <item row="1" column="0"> - <widget class="QTableWidget" name="customMixerTable"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alternatingRowColors"> - <bool>true</bool> - </property> - <attribute name="horizontalHeaderDefaultSectionSize"> - <number>50</number> - </attribute> - <attribute name="horizontalHeaderStretchLastSection"> - <bool>false</bool> - </attribute> - <row> - <property name="text"> - <string>Type</string> - </property> - </row> - <row> - <property name="text"> - <string>Curve 1</string> - </property> - </row> - <row> - <property name="text"> - <string>Curve 2</string> - </property> - </row> - <row> - <property name="text"> - <string>Roll</string> - </property> - </row> - <row> - <property name="text"> - <string>Pitch</string> - </property> - </row> - <row> - <property name="text"> - <string>Yaw</string> - </property> - </row> - <column> - <property name="text"> - <string>Ch 1</string> - </property> - </column> - <column> - <property name="text"> - <string>Ch 2</string> - </property> - </column> - <column> - <property name="text"> - <string>Ch 3</string> - </property> - </column> - <column> - <property name="text"> - <string>Ch 4</string> - </property> - </column> - <column> - <property name="text"> - <string>Ch 5</string> - </property> - </column> - <column> - <property name="text"> - <string>Ch 6</string> - </property> - </column> - <column> - <property name="text"> - <string>Ch 7</string> - </property> - </column> - <column> - <property name="text"> - <string>Ch 8</string> - </property> - </column> - <item row="0" column="0"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="0" column="1"> - <property name="text"> - <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> - </property> - </item> - <item row="0" column="6"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="0" column="7"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="1" column="0"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="1" column="1"> - <property name="text"> - <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> - </property> - </item> - <item row="1" column="6"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="1" column="7"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="2" column="0"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="2" column="1"> - <property name="text"> - <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> - </property> - </item> - <item row="2" column="6"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="2" column="7"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="3" column="0"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="3" column="1"> - <property name="text"> - <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> - </property> - </item> - <item row="3" column="6"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="3" column="7"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="4" column="0"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="4" column="1"> - <property name="text"> - <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> - </property> - </item> - <item row="4" column="6"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="4" column="7"> - <property name="text"> - <string>-</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="5" column="2"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="5" column="3"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="5" column="4"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="5" column="5"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="5" column="6"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="5" column="7"> - <property name="text"> - <string>-</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - </widget> - </item> - </layout> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Motor output channels</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_10"> + <property name="spacing"> + <number>1</number> + </property> + <property name="margin"> + <number>1</number> + </property> + <item> + <layout class="QFormLayout" name="formLayout_2"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <property name="verticalSpacing"> + <number>3</number> + </property> + <item row="1" column="0"> + <widget class="QLabel" name="MotorOutputLabel1"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>1</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="multiMotorChannelBox1"> + <property name="toolTip"> + <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_8"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>2</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="multiMotorChannelBox2"> + <property name="toolTip"> + <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_9"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>3</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="multiMotorChannelBox3"> + <property name="toolTip"> + <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_10"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>4</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="multiMotorChannelBox4"> + <property name="toolTip"> + <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <spacer name="verticalSpacer_8"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QFormLayout" name="formLayout_4"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <property name="verticalSpacing"> + <number>3</number> + </property> + <item row="1" column="0"> + <widget class="QLabel" name="label_11"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>5</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="multiMotorChannelBox5"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_12"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>6</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="multiMotorChannelBox6"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_16"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>7</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="multiMotorChannelBox7"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_17"> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>8</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="multiMotorChannelBox8"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Assign your motor output channels using the drawing above as a reference. Respect propeller rotation.</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <spacer name="verticalSpacer_9"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> </item> </layout> - </widget> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string>Advanced Settings</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_26"> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QScrollArea" name="scrollArea_2"> - <property name="palette"> - <palette> - <active> - <colorrole role="Base"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Window"> - <brush brushstyle="SolidPattern"> - <color alpha="0"> - <red>232</red> - <green>232</green> - <blue>232</blue> - </color> - </brush> - </colorrole> - </active> - <inactive> - <colorrole role="Base"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Window"> - <brush brushstyle="SolidPattern"> - <color alpha="0"> - <red>232</red> - <green>232</green> - <blue>232</blue> - </color> - </brush> - </colorrole> - </inactive> - <disabled> - <colorrole role="Base"> - <brush brushstyle="SolidPattern"> - <color alpha="0"> - <red>232</red> - <green>232</green> - <blue>232</blue> - </color> - </brush> - </colorrole> - <colorrole role="Window"> - <brush brushstyle="SolidPattern"> - <color alpha="0"> - <red>232</red> - <green>232</green> - <blue>232</blue> - </color> - </brush> - </colorrole> - </disabled> - </palette> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_2"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>809</width> - <height>874</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout_25"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_11" stretch="0,1,0,0,0"> + </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_24"> + <layout class="QHBoxLayout" name="horizontalLayout_20"> <item> - <widget class="QLabel" name="label_19"> + <spacer name="horizontalSpacer_12"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="mrStatusLabel"> <property name="font"> <font> <weight>75</weight> @@ -2690,12 +1262,72 @@ margin:1px;</string> </font> </property> <property name="text"> - <string>Feed Forward</string> + <string>Mixer OK</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="ccpmHeli"> + <layout class="QVBoxLayout" name="verticalLayout_5" stretch="1"> + <property name="spacing"> + <number>0</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <layout class="QVBoxLayout" name="verticalLayout_19"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="ConfigCcpmWidget" name="widget_3" native="true"/> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="groundVehicle"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout_31" stretch="0"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_61"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_31"> + <item> + <widget class="QLabel" name="label_51"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Vehicle type:</string> </property> </widget> </item> <item> - <spacer name="horizontalSpacer_16"> + <widget class="QComboBox" name="groundVehicleType"/> + </item> + <item> + <spacer name="horizontalSpacer_31"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> @@ -2710,238 +1342,22 @@ margin:1px;</string> </layout> </item> <item> - <layout class="QFormLayout" name="formLayout_7"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="2" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout_12"> - <item> - <widget class="QLabel" name="label_20"> - <property name="text"> - <string>FeedForward </string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="feedForwardSliderValue"> - <property name="minimumSize"> - <size> - <width>30</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>000</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="1"> - <widget class="QSlider" name="feedForwardSlider"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string>Overall level of feed forward (in percentage).</string> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="singleStep"> - <number>1</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition"> - <enum>QSlider::NoTicks</enum> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_21"> - <property name="text"> - <string>Accel Time Constant</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="accelTime"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string>In miliseconds. -When tuning: Slowly raise accel time from zero to just -under the level where the motor starts to overshoot -its target speed.</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.010000000000000</double> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_22"> - <property name="text"> - <string>Decel Time Constant</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QDoubleSpinBox" name="decelTime"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string>When tuning: Slowly raise decel time from zero to just -under the level where the motor starts to undershoot -its target speed when decelerating. - -Do it after accel time is setup.</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.010000000000000</double> - </property> - </widget> - </item> - <item row="5" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout_16"> - <item> - <widget class="QLabel" name="label_37"> - <property name="text"> - <string>MaxAccel</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="maxAccelSliderValue"> - <property name="text"> - <string>1000</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="5" column="1"> - <widget class="QSlider" name="maxAccelSlider"> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string>Limits how much the engines can accelerate or decelerate. -In 'units per second', a sound default is 1000.</string> - </property> - <property name="minimum"> - <number>500</number> - </property> - <property name="maximum"> - <number>2000</number> - </property> - <property name="value"> - <number>1000</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_9"> + <layout class="QHBoxLayout" name="horizontalLayout_33"> <item> - <spacer name="horizontalSpacer_8"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QCheckBox" name="ffTestBox1"> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Beware! Check </span><span style=" font-family:'Sans'; font-size:10pt; font-weight:600;">all three</span><span style=" font-family:'Sans'; font-size:10pt;"> checkboxes to test Feed Forward.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">It will run only if your airframe armed.</span></p></body></html></string> + <widget class="QLabel" name="label_7"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> </property> <property name="text"> - <string/> + <string>Channel Assignment</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="ffTestBox2"> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Beware! Check </span><span style=" font-family:'Sans'; font-size:10pt; font-weight:600;">all three</span><span style=" font-family:'Sans'; font-size:10pt;"> checkboxes to test Feed Forward.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">It will run only if your airframe armed.</span></p></body></html></string> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="ffTestBox3"> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Beware! Check </span><span style=" font-family:'Sans'; font-size:10pt; font-weight:600;">all three</span><span style=" font-family:'Sans'; font-size:10pt;"> checkboxes to test Feed Forward.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">It will run only if your airframe armed.</span></p></body></html></string> - </property> - <property name="text"> - <string>Enable FF tuning</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_7"> + <spacer name="horizontalSpacer_15"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> @@ -2956,36 +1372,372 @@ p, li { white-space: pre-wrap; } </layout> </item> <item> - <widget class="QTextBrowser" name="textBrowser"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>40</height> - </size> - </property> - <property name="html"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;"> -<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:14pt; font-weight:600; color:#ff0000;">SETTING UP FEED FORWARD REQUIRES CAUTION</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Beware: Feed Forward Tuning will launch all engines around mid-throttle, you have been warned!</p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Remove your props initially, and for fine-tuning, make sure your airframe is safely held in place. Wear glasses and protect your face and body.</p></td></tr></table></body></html></string> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout_41"> + <item> + <widget class="QGroupBox" name="groupBox_7"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>100</height> + </size> + </property> + <property name="title"> + <string>Output channel asignmets</string> + </property> + <layout class="QFormLayout" name="formLayout_5"> + <item row="0" column="0"> + <widget class="QLabel" name="gvEngineLabel"> + <property name="minimumSize"> + <size> + <width>77</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Engine</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="gvEngineChannelBox"> + <property name="toolTip"> + <string>Select output channel for the engine</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="gvAileron1Label"> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Aileron 1</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="gvAileron1ChannelBox"> + <property name="toolTip"> + <string>Select output channel for the first aileron (or elevon)</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="gvAileron2Label"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Aileron 2</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="gvAileron2ChannelBox"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Select output channel for the second aileron (or elevon)</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="gvMotor1Label"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Motor</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="gvMotor1ChannelBox"> + <property name="toolTip"> + <string>Select output channel for the first motor</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="gvMotor2Label"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>47</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Motor 2</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="gvMotor2ChannelBox"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Select output channel for a second motor</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="gvSteering1Label"> + <property name="text"> + <string>Front Steering</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QComboBox" name="gvSteering1ChannelBox"> + <property name="toolTip"> + <string>Select output channel for the first steering actuator</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="gvSteering2Label"> + <property name="text"> + <string>Rear Steering</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QComboBox" name="gvSteering2ChannelBox"> + <property name="toolTip"> + <string>Select output channel for a second steering actuator</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="differentialSteeringMixBox"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Differential Steering Mix</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_33"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_30"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_34"> + <item> + <widget class="QLabel" name="differentialSteeringLabel1"> + <property name="minimumSize"> + <size> + <width>65</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Left %</string> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="differentialSteeringSlider1"> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="gvDiffSteering1Label"> + <property name="text"> + <string>50</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_35"> + <item> + <widget class="QLabel" name="differentialSteeringLabel2"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Right %</string> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="differentialSteeringSlider2"> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="gvDiffSteering2Label"> + <property name="text"> + <string>50</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gvThrottleCurve1GroupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>100</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Front throttle curve</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_36"> + <item> + <widget class="MixerCurve" name="groundVehicleThrottle1" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>500</width> + <height>500</height> + </size> + </property> + <property name="sizeIncrement"> + <size> + <width>10</width> + <height>10</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>300</width> + <height>350</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gvThrottleCurve2GroupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Rear throttle curve</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_37"> + <item> + <widget class="MixerCurve" name="groundVehicleThrottle2" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>500</width> + <height>500</height> + </size> + </property> + <property name="sizeIncrement"> + <size> + <width>10</width> + <height>10</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>300</width> + <height>350</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> </item> <item> - <spacer name="verticalSpacer_5"> + <spacer name="verticalSpacer_1"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> @@ -2997,6 +1749,719 @@ p, li { white-space: pre-wrap; } </property> </spacer> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_28"> + <item> + <spacer name="horizontalSpacer_21"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="gvStatusLabel"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Mixer OK</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="custom"> + <layout class="QHBoxLayout" name="horizontalLayout_15"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_14"> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Curve 1</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <widget class="MixerCurve" name="customThrottle1Curve" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>1000</width> + <height>1000</height> + </size> + </property> + <property name="sizeIncrement"> + <size> + <width>10</width> + <height>10</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>300</width> + <height>350</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Curve 2</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_17"> + <item> + <widget class="MixerCurve" name="customThrottle2Curve" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>1000</width> + <height>1000</height> + </size> + </property> + <property name="sizeIncrement"> + <size> + <width>10</width> + <height>10</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>300</width> + <height>350</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item row="1" column="0"> + <widget class="QTableWidget" name="customMixerTable"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="alternatingRowColors"> + <bool>true</bool> + </property> + <attribute name="horizontalHeaderDefaultSectionSize"> + <number>50</number> + </attribute> + <attribute name="horizontalHeaderStretchLastSection"> + <bool>false</bool> + </attribute> + <row> + <property name="text"> + <string>Type</string> + </property> + </row> + <row> + <property name="text"> + <string>Curve 1</string> + </property> + </row> + <row> + <property name="text"> + <string>Curve 2</string> + </property> + </row> + <row> + <property name="text"> + <string>Roll</string> + </property> + </row> + <row> + <property name="text"> + <string>Pitch</string> + </property> + </row> + <row> + <property name="text"> + <string>Yaw</string> + </property> + </row> + <column> + <property name="text"> + <string>Ch 1</string> + </property> + </column> + <column> + <property name="text"> + <string>Ch 2</string> + </property> + </column> + <column> + <property name="text"> + <string>Ch 3</string> + </property> + </column> + <column> + <property name="text"> + <string>Ch 4</string> + </property> + </column> + <column> + <property name="text"> + <string>Ch 5</string> + </property> + </column> + <column> + <property name="text"> + <string>Ch 6</string> + </property> + </column> + <column> + <property name="text"> + <string>Ch 7</string> + </property> + </column> + <column> + <property name="text"> + <string>Ch 8</string> + </property> + </column> + <column> + <property name="text"> + <string>Ch 9</string> + </property> + </column> + <column> + <property name="text"> + <string>Ch 10</string> + </property> + </column> + <item row="0" column="0"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="0" column="1"> + <property name="text"> + <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> + </property> + </item> + <item row="0" column="6"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="0" column="7"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="0" column="8"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="0" column="9"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="1" column="0"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="1" column="1"> + <property name="text"> + <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> + </property> + </item> + <item row="1" column="6"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="1" column="7"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="1" column="8"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="1" column="9"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="2" column="0"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="2" column="1"> + <property name="text"> + <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> + </property> + </item> + <item row="2" column="6"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="2" column="7"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="2" column="8"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="2" column="9"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="3" column="0"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="3" column="1"> + <property name="text"> + <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> + </property> + </item> + <item row="3" column="6"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="3" column="7"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="3" column="8"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="3" column="9"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="4" column="0"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="4" column="1"> + <property name="text"> + <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> + </property> + </item> + <item row="4" column="6"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="4" column="7"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="4" column="8"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="4" column="9"> + <property name="text"> + <string>-</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="5" column="2"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="5" column="3"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="5" column="4"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="5" column="5"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="5" column="6"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="5" column="7"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="5" column="8"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + <item row="5" column="9"> + <property name="text"> + <string>-</string> + </property> + <property name="textAlignment"> + <set>AlignHCenter|AlignVCenter|AlignCenter</set> + </property> + </item> + </widget> + </item> </layout> </item> </layout> @@ -3005,137 +2470,421 @@ p, li { white-space: pre-wrap; } </item> </layout> </widget> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Advanced Settings</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_25"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_11" stretch="0,1,0,0,0"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_24"> + <item> + <widget class="QLabel" name="label_19"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Feed Forward</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_16"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QFormLayout" name="formLayout_7"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="2" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_12"> + <item> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>FeedForward </string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="feedForwardSliderValue"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>000</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="1"> + <widget class="QSlider" name="feedForwardSlider"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Overall level of feed forward (in percentage).</string> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::NoTicks</enum> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_21"> + <property name="text"> + <string>Accel Time Constant</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="accelTime"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>In miliseconds. +When tuning: Slowly raise accel time from zero to just +under the level where the motor starts to overshoot +its target speed.</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_22"> + <property name="text"> + <string>Decel Time Constant</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QDoubleSpinBox" name="decelTime"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>When tuning: Slowly raise decel time from zero to just +under the level where the motor starts to undershoot +its target speed when decelerating. + +Do it after accel time is setup.</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + </widget> + </item> + <item row="5" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_16"> + <item> + <widget class="QLabel" name="label_37"> + <property name="text"> + <string>MaxAccel</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="maxAccelSliderValue"> + <property name="text"> + <string>1000</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="5" column="1"> + <widget class="QSlider" name="maxAccelSlider"> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Limits how much the engines can accelerate or decelerate. +In 'units per second', a sound default is 1000.</string> + </property> + <property name="minimum"> + <number>500</number> + </property> + <property name="maximum"> + <number>2000</number> + </property> + <property name="value"> + <number>1000</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_9"> + <item> + <spacer name="horizontalSpacer_8"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="ffTestBox1"> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Beware! Check </span><span style=" font-family:'Sans'; font-size:10pt; font-weight:600;">all three</span><span style=" font-family:'Sans'; font-size:10pt;"> checkboxes to test Feed Forward.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">It will run only if your airframe armed.</span></p></body></html></string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="ffTestBox2"> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Beware! Check </span><span style=" font-family:'Sans'; font-size:10pt; font-weight:600;">all three</span><span style=" font-family:'Sans'; font-size:10pt;"> checkboxes to test Feed Forward.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">It will run only if your airframe armed.</span></p></body></html></string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="ffTestBox3"> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Beware! Check </span><span style=" font-family:'Sans'; font-size:10pt; font-weight:600;">all three</span><span style=" font-family:'Sans'; font-size:10pt;"> checkboxes to test Feed Forward.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">It will run only if your airframe armed.</span></p></body></html></string> + </property> + <property name="text"> + <string>Enable FF tuning</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="QTextBrowser" name="textBrowser"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>40</height> + </size> + </property> + <property name="html"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:14pt; font-weight:600; color:#ff0000;">SETTING UP FEED FORWARD IS DANGEROUS</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:13pt;">Beware: Feed Forward Tuning will launch all engines around mid-throttle, you have been warned!</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:13pt;">Remove your props initially, and for fine-tuning, make sure your airframe is safely held in place. Wear glasses and protect your face and body.</span></p></td></tr></table></body></html></string> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_5"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_8"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>75</height> - </size> - </property> - <property name="title"> - <string/> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="spacing"> - <number>4</number> - </property> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::MinimumExpanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="airframeHelp"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../coreplugin/core.qrc"> - <normaloff>:/core/images/helpicon.svg</normaloff>:/core/images/helpicon.svg</iconset> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="flat"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="saveAircraftToRAM"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>28</height> - </size> - </property> - <property name="toolTip"> - <string>Send to board, but don't save permanently (flash or SD).</string> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Apply</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="saveAircraftToSD"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>28</height> - </size> - </property> - <property name="toolTip"> - <string>Applies and Saves all settings to flash or SD depending on board.</string> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="airframeHelp"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset resource="../coreplugin/core.qrc"> + <normaloff>:/core/images/helpicon.svg</normaloff>:/core/images/helpicon.svg</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="flat"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="saveAircraftToRAM"> + <property name="toolTip"> + <string>Send to board, but don't save permanently (flash or SD).</string> + </property> + <property name="text"> + <string>Apply</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="saveAircraftToSD"> + <property name="toolTip"> + <string>Applies and Saves all settings to flash or SD depending on board.</string> + </property> + <property name="text"> + <string>Save</string> + </property> + </widget> + </item> + </layout> </item> </layout> </widget> <customwidgets> - <customwidget> - <class>MixerCurveWidget</class> - <extends>QWidget</extends> - <header>mixercurvewidget.h</header> - <container>1</container> - </customwidget> <customwidget> <class>ConfigCcpmWidget</class> <extends>QWidget</extends> <header>cfg_vehicletypes/configccpmwidget.h</header> <container>1</container> </customwidget> + <customwidget> + <class>MixerCurve</class> + <extends>QWidget</extends> + <header location="global">mixercurve.h</header> + <container>1</container> + </customwidget> </customwidgets> <resources> <include location="../coreplugin/core.qrc"/> diff --git a/ground/openpilotgcs/src/plugins/config/ccpm.ui b/ground/openpilotgcs/src/plugins/config/ccpm.ui index c31e5fb97..ee28ad4f0 100644 --- a/ground/openpilotgcs/src/plugins/config/ccpm.ui +++ b/ground/openpilotgcs/src/plugins/config/ccpm.ui @@ -2770,537 +2770,13 @@ margin:1px;</string> <number>3</number> </property> <item row="0" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <widget class="QComboBox" name="CurveType"> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </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>Exp</string> - </property> - </item> - <item> - <property name="text"> - <string>Log</string> - </property> - </item> - <item> - <property name="text"> - <string>Custom</string> - </property> - </item> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="label_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Number of points</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="NumCurvePoints"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimum"> - <number>2</number> - </property> - <property name="maximum"> - <number>10</number> - </property> - <property name="value"> - <number>5</number> - </property> - </widget> - </item> - </layout> + <layout class="QHBoxLayout" name="horizontalLayout_6"/> </item> <item row="1" column="0"> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="CurveLabel1"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>Min</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="CurveLabel2"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="text"> - <string>Max</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="CurveLabel3"> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <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 row="2" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <widget class="QComboBox" name="CurveToGenerate"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </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> - </item> - <item> - <widget class="QPushButton" name="ccpmGenerateCurve"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Generate curves based on settings</string> - </property> - <property name="text"> - <string><-- Generate Curve</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_6"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="3" column="0"> <layout class="QHBoxLayout" name="horizontalLayout_3"> <property name="spacing"> <number>3</number> </property> - <item> - <widget class="QTableWidget" name="CurveSettings"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>250</width> - <height>200</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>250</width> - <height>273</height> - </size> - </property> - <property name="verticalScrollBarPolicy"> - <enum>Qt::ScrollBarAsNeeded</enum> - </property> - <property name="horizontalScrollBarPolicy"> - <enum>Qt::ScrollBarAsNeeded</enum> - </property> - <property name="autoScroll"> - <bool>true</bool> - </property> - <property name="alternatingRowColors"> - <bool>true</bool> - </property> - <property name="cornerButtonEnabled"> - <bool>true</bool> - </property> - <attribute name="horizontalHeaderCascadingSectionResizes"> - <bool>true</bool> - </attribute> - <attribute name="horizontalHeaderStretchLastSection"> - <bool>true</bool> - </attribute> - <attribute name="verticalHeaderDefaultSectionSize"> - <number>25</number> - </attribute> - <attribute name="verticalHeaderMinimumSectionSize"> - <number>25</number> - </attribute> - <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.000</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="0" column="1"> - <property name="text"> - <string>0.000</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="1" column="0"> - <property name="text"> - <string>0.250</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="1" column="1"> - <property name="text"> - <string>0.250</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="2" column="0"> - <property name="text"> - <string>0.500</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="2" column="1"> - <property name="text"> - <string>0.500</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="3" column="0"> - <property name="text"> - <string>0.750</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="3" column="1"> - <property name="text"> - <string>0.750</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="4" column="0"> - <property name="text"> - <string>1.000</string> - </property> - <property name="textAlignment"> - <set>AlignHCenter|AlignVCenter|AlignCenter</set> - </property> - </item> - <item row="4" column="1"> - <property name="text"> - <string>1.000</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> <widget class="QGroupBox" name="ThrottleCurveBox"> <property name="sizePolicy"> @@ -3331,7 +2807,7 @@ margin:1px;</string> <enum>Qt::LeftToRight</enum> </property> <property name="title"> - <string>Throttle Curve</string> + <string/> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> @@ -3347,7 +2823,7 @@ margin:1px;</string> <number>0</number> </property> <item row="0" column="0"> - <widget class="MixerCurveWidget" name="ThrottleCurve" native="true"> + <widget class="MixerCurve" name="ThrottleCurve" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <horstretch>1</horstretch> @@ -3410,7 +2886,7 @@ margin:1px;</string> </size> </property> <property name="title"> - <string>Pitch Curve</string> + <string/> </property> <layout class="QGridLayout" name="gridLayout_5"> <property name="margin"> @@ -3420,7 +2896,7 @@ margin:1px;</string> <number>0</number> </property> <item row="0" column="0"> - <widget class="MixerCurveWidget" name="PitchCurve" native="true"> + <widget class="MixerCurve" name="PitchCurve" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> <horstretch>1</horstretch> @@ -3458,7 +2934,7 @@ margin:1px;</string> </item> </layout> </item> - <item row="4" column="0"> + <item row="2" column="0"> <spacer name="verticalSpacer_2"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -3910,9 +3386,9 @@ margin:1px;</string> </widget> <customwidgets> <customwidget> - <class>MixerCurveWidget</class> + <class>MixerCurve</class> <extends>QWidget</extends> - <header>mixercurvewidget.h</header> + <header location="global">mixercurve.h</header> <container>1</container> </customwidget> </customwidgets> @@ -3945,14 +3421,6 @@ margin:1px;</string> <tabstop>SwashLvlPositionSlider</tabstop> <tabstop>SwashLvlPositionSpinBox</tabstop> <tabstop>SwashLvlSwashplateImage</tabstop> - <tabstop>CurveType</tabstop> - <tabstop>NumCurvePoints</tabstop> - <tabstop>CurveValue1</tabstop> - <tabstop>CurveValue2</tabstop> - <tabstop>CurveValue3</tabstop> - <tabstop>CurveToGenerate</tabstop> - <tabstop>ccpmGenerateCurve</tabstop> - <tabstop>CurveSettings</tabstop> <tabstop>ccpmAdvancedSettingsTable</tabstop> </tabstops> <resources/> diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp index e7ca51fd1..7234ffbf4 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp @@ -133,8 +133,12 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) : VehicleConfig(parent) } //initialize our two mixer curves + // mixercurve defaults to mixercurve_throttle + m_ccpm->ThrottleCurve->initLinearCurve(5, 1.0, 0.0); + + // tell mixercurve this is a pitch curve + m_ccpm->PitchCurve->setMixerType(MixerCurve::MIXERCURVE_PITCH); m_ccpm->PitchCurve->initLinearCurve(5, 1.0, -1.0); - m_ccpm->ThrottleCurve->initLinearCurve(5, 1.0); //initialize channel names m_ccpm->ccpmEngineChannel->addItems(channelNames); @@ -158,22 +162,10 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) : VehicleConfig(parent) m_ccpm->ccpmType->addItems(Types); m_ccpm->ccpmType->setCurrentIndex(m_ccpm->ccpmType->count() - 1); - UpdateCurveSettings(); - - //disable changing number of points in curves until UAVObjects have more than 5 - m_ccpm->NumCurvePoints->setEnabled(0); - refreshWidgetsValues(QString("HeliCP")); 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->CurveToGenerate, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCurveSettings())); - connect(m_ccpm->CurveType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCurveSettings())); 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())); @@ -191,12 +183,8 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) : VehicleConfig(parent) connect(m_ccpm->ccpmCollectivespinBox, SIGNAL(valueChanged(int)), this, SLOT(UpdateMixer())); connect(m_ccpm->ccpmType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType())); connect(m_ccpm->ccpmSingleServo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType())); - connect(m_ccpm->CurveSettings, SIGNAL(cellChanged (int, int)), this, SLOT(UpdateCurveWidgets())); connect(m_ccpm->TabObject, SIGNAL(currentChanged ( QWidget * )), this, SLOT(UpdateType())); - connect(m_ccpm->PitchCurve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updatePitchCurveValue(QList<double>,double))); - connect(m_ccpm->ThrottleCurve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateThrottleCurveValue(QList<double>,double))); - connect(m_ccpm->SwashLvlStartButton, SIGNAL(clicked()), this, SLOT(SwashLvlStartButtonPressed())); connect(m_ccpm->SwashLvlNextButton, SIGNAL(clicked()), this, SLOT(SwashLvlNextButtonPressed())); connect(m_ccpm->SwashLvlCancelButton, SIGNAL(clicked()), this, SLOT(SwashLvlCancelButtonPressed())); @@ -332,8 +320,6 @@ void ConfigCcpmWidget::UpdateType() AdjustmentAngle=SingleServoIndex*90; - m_ccpm->CurveToGenerate->setEnabled(1); - m_ccpm->CurveSettings->setColumnHidden(1,0); m_ccpm->PitchCurve->setVisible(1); //m_ccpm->customThrottleCurve2Value->setVisible(1); //m_ccpm->label_41->setVisible(1); @@ -425,9 +411,6 @@ void ConfigCcpmWidget::UpdateType() m_ccpm->ccpmCollectiveSlider->setEnabled(0); m_ccpm->ccpmCollectivespinBox->setValue(0); m_ccpm->ccpmCollectiveSlider->setValue(0); - m_ccpm->CurveToGenerate->setCurrentIndex(0); - m_ccpm->CurveToGenerate->setEnabled(0); - m_ccpm->CurveSettings->setColumnHidden(1,1); m_ccpm->PitchCurve->setVisible(0); //m_ccpm->customThrottleCurve2Value->setVisible(0); //m_ccpm->label_41->setVisible(0); @@ -469,271 +452,7 @@ void ConfigCcpmWidget::UpdateType() } -void ConfigCcpmWidget::UpdateCurveWidgets() -{ - int NumCurvePoints,i,Changed; - QList<double> curveValues; - QList<double> OldCurveValues; - double ThisValue; - //get the user settings - NumCurvePoints=m_ccpm->NumCurvePoints->value(); - curveValues.clear(); - Changed=0; - OldCurveValues=m_ccpm->ThrottleCurve->getCurve(); - for (i=0; i<NumCurvePoints; i++) - { - ThisValue=m_ccpm->CurveSettings->item(i, 0 )->text().toDouble(); - curveValues.append(ThisValue); - if (ThisValue!=OldCurveValues.at(i))Changed=1; - } - // Setup all Throttle1 curves for all types of airframes - if (Changed==1) - m_ccpm->ThrottleCurve->setCurve(&curveValues); - - curveValues.clear(); - Changed=0; - OldCurveValues=m_ccpm->PitchCurve->getCurve(); - for (i=0; i<NumCurvePoints; i++) - { - ThisValue=m_ccpm->CurveSettings->item(i, 1 )->text().toDouble(); - curveValues.append(ThisValue); - if (ThisValue!=OldCurveValues.at(i))Changed=1; - } - // Setup all Throttle1 curves for all types of airframes - if (Changed==1) - m_ccpm->PitchCurve->setCurve(&curveValues); -} - -void ConfigCcpmWidget::updatePitchCurveValue(QList<double> curveValues0,double Value0) -{ - Q_UNUSED(curveValues0); - Q_UNUSED(Value0); - - int NumCurvePoints,i; - double CurrentValue; - QList<double> internalCurveValues; - //get the user settings - NumCurvePoints=m_ccpm->NumCurvePoints->value(); - internalCurveValues=m_ccpm->PitchCurve->getCurve(); - - for (i=0; i<internalCurveValues.length(); i++) - { - CurrentValue=m_ccpm->CurveSettings->item(i, 1 )->text().toDouble(); - if (CurrentValue!=internalCurveValues[i]) - { - m_ccpm->CurveSettings->item(i, 1)->setText(QString().sprintf("%.3f",internalCurveValues.at(i))); - } - - } - -} - -void ConfigCcpmWidget::updateThrottleCurveValue(QList<double> curveValues0,double Value0) -{ - Q_UNUSED(curveValues0); - Q_UNUSED(Value0); - - int NumCurvePoints,i; - double CurrentValue; - QList<double> internalCurveValues; - //get the user settings - NumCurvePoints=m_ccpm->NumCurvePoints->value(); - internalCurveValues=m_ccpm->ThrottleCurve->getCurve(); - - for (i=0; i<internalCurveValues.length(); i++) - { - CurrentValue=m_ccpm->CurveSettings->item(i, 0 )->text().toDouble(); - if (CurrentValue!=internalCurveValues[i]) - { - m_ccpm->CurveSettings->item(i, 0)->setText(QString().sprintf("%.3f",internalCurveValues.at(i))); - } - - } - -} - - -void ConfigCcpmWidget::UpdateCurveSettings() -{ - int NumCurvePoints,i; - double scale; - QString CurveType; - QStringList vertHeaders; - - //get the user settings - NumCurvePoints=m_ccpm->NumCurvePoints->value(); - CurveType=m_ccpm->CurveType->currentText(); - - vertHeaders << "-" << "-" << "-" << "-" << "-" << "-" << "-" << "-" << "-" << "-" ; - for (i=0;i<NumCurvePoints;i++) - { - scale =((double)i/(double)(NumCurvePoints-1)); - vertHeaders[i] = tr( "%1%" ).arg(100.00*scale, 0, 'f', 1); - } - m_ccpm->CurveSettings->setVerticalHeaderLabels( vertHeaders ); - - if (m_ccpm->CurveToGenerate->currentIndex()==0) - { - m_ccpm->CurveValue1->setMinimum(0.0); - m_ccpm->CurveValue2->setMinimum(0.0); - m_ccpm->CurveValue3->setMinimum(0.0); - } - else - { - m_ccpm->CurveValue1->setMinimum(-1.0); - m_ccpm->CurveValue2->setMinimum(-1.0); - m_ccpm->CurveValue3->setMinimum(0.0); - } - m_ccpm->CurveValue1->setMaximum(1.0); - m_ccpm->CurveValue2->setMaximum(1.0); - m_ccpm->CurveValue3->setMaximum(100.0); - m_ccpm->CurveValue1->setSingleStep(0.1); - m_ccpm->CurveValue2->setSingleStep(0.1); - m_ccpm->CurveValue3->setSingleStep(1.0); - m_ccpm->CurveValue1->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue);; - m_ccpm->CurveValue2->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue); - m_ccpm->CurveValue3->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue); - - //set default visible - m_ccpm->CurveLabel1->setVisible(true); - m_ccpm->CurveValue1->setVisible(true); - m_ccpm->CurveLabel2->setVisible(false); - m_ccpm->CurveValue2->setVisible(false); - m_ccpm->CurveLabel3->setVisible(false); - m_ccpm->CurveValue3->setVisible(false); - m_ccpm->ccpmGenerateCurve->setVisible(true); - m_ccpm->CurveToGenerate->setVisible(true); - - if ( CurveType.compare("Flat")==0) - { - m_ccpm->CurveLabel1->setText("Value"); - } - if ( CurveType.compare("Linear")==0) - { - m_ccpm->CurveLabel1->setText("Min"); - m_ccpm->CurveLabel2->setText("Max"); - m_ccpm->CurveLabel2->setVisible(true); - m_ccpm->CurveValue2->setVisible(true); - } - if ( CurveType.compare("Step")==0) - { - m_ccpm->CurveLabel1->setText("Min"); - m_ccpm->CurveLabel2->setText("Max"); - m_ccpm->CurveLabel2->setVisible(true); - m_ccpm->CurveValue2->setVisible(true); - m_ccpm->CurveLabel3->setText("Step at"); - m_ccpm->CurveLabel3->setVisible(true); - m_ccpm->CurveValue3->setVisible(true); - } - if ( CurveType.compare("Exp")==0) - { - m_ccpm->CurveLabel1->setText("Min"); - m_ccpm->CurveLabel2->setText("Max"); - m_ccpm->CurveLabel2->setVisible(true); - m_ccpm->CurveValue2->setVisible(true); - m_ccpm->CurveLabel3->setText("Strength"); - m_ccpm->CurveLabel3->setVisible(true); - m_ccpm->CurveValue3->setVisible(true); - m_ccpm->CurveValue3->setMinimum(1.0); - m_ccpm->CurveValue3->setMaximum(100.0); - m_ccpm->CurveValue3->setSingleStep(1.0); - m_ccpm->CurveValue3->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue);; - } - if ( CurveType.compare("Log")==0) - { - m_ccpm->CurveLabel1->setText("Min"); - m_ccpm->CurveLabel2->setText("Max"); - m_ccpm->CurveLabel2->setVisible(true); - m_ccpm->CurveValue2->setVisible(true); - m_ccpm->CurveLabel3->setText("Strength"); - m_ccpm->CurveLabel3->setVisible(true); - m_ccpm->CurveValue3->setVisible(true); - m_ccpm->CurveValue3->setMinimum(1.0); - m_ccpm->CurveValue3->setMaximum(100.0); - m_ccpm->CurveValue3->setSingleStep(1.0); - m_ccpm->CurveValue3->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue); - } - if ( CurveType.compare("Custom")==0) - { - m_ccpm->CurveLabel1->setVisible(false); - m_ccpm->CurveValue1->setVisible(false); - m_ccpm->ccpmGenerateCurve->setVisible(false); - m_ccpm->CurveToGenerate->setVisible(false); - } - - UpdateCurveWidgets(); - -} -void ConfigCcpmWidget::GenerateCurve() -{ - int NumCurvePoints,CurveToGenerate,i; - double value1, value2, value3, scale; - QString CurveType; - QTableWidgetItem *item; - double newValue; - - - //get the user settings - NumCurvePoints=m_ccpm->NumCurvePoints->value(); - value1=m_ccpm->CurveValue1->value(); - value2=m_ccpm->CurveValue2->value(); - value3=m_ccpm->CurveValue3->value(); - CurveToGenerate=m_ccpm->CurveToGenerate->currentIndex(); - CurveType=m_ccpm->CurveType->currentText(); - - - - for (i=0;i<NumCurvePoints;i++) - { - scale =((double)i/(double)(NumCurvePoints-1)); - item =m_ccpm->CurveSettings->item(i, CurveToGenerate ); - - if ( CurveType.compare("Flat")==0) - { - //item->setText( tr( "%1" ).arg( value1 ) ); - item->setText(QString().sprintf("%.3f",value1)); - } - if ( CurveType.compare("Linear")==0) - { - newValue =value1 +(scale*(value2-value1)); - //item->setText( tr( "%1" ).arg(value1 +(scale*(value2-value1))) ); - item->setText(QString().sprintf("%.3f",newValue)); - } - if ( CurveType.compare("Step")==0) - { - if (scale*100<value3) - { - //item->setText( tr( "%1" ).arg(value1) ); - item->setText(QString().sprintf("%.3f",value1)); - } - else - { - //item->setText( tr( "%1" ).arg(value2) ); - item->setText(QString().sprintf("%.3f",value2)); - } - } - if ( CurveType.compare("Exp")==0) - { - newValue =value1 +(((exp(scale*(value3/10))-1))/(exp((value3/10))-1)*(value2-value1)); - //item->setText( tr( "%1" ).arg(value1 +(((exp(scale*(value3/10))-1))/(exp((value3/10))-1)*(value2-value1))) ); - item->setText(QString().sprintf("%.3f",newValue)); - } - if ( CurveType.compare("Log")==0) - { - newValue = value1 +(((log(scale*(value3*2)+1))/(log(1+(value3*2))))*(value2-value1)); - //item->setText( tr( "%1" ).arg(value1 +(((log(scale*(value3*2)+1))/(log(1+(value3*2))))*(value2-value1))) ); - item->setText(QString().sprintf("%.3f",newValue)); - } - } - for (i=NumCurvePoints;i<10;i++) - { - item =m_ccpm->CurveSettings->item(i, CurveToGenerate ); - item->setText( tr( "" ) ); - } - UpdateCurveWidgets(); - -} void ConfigCcpmWidget::ccpmSwashplateRedraw() { @@ -1111,21 +830,33 @@ void ConfigCcpmWidget::getMixer() { if (SwashLvlConfigurationInProgress)return; if (updatingToHardware)return; + updatingFromHardware=TRUE; - int i; + UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); + Q_ASSERT(mixer); - // Get existing mixer settings - MixerSettings * mixerSettings = MixerSettings::GetInstance(getObjectManager()); - MixerSettings::DataFields mixerSettingsData = mixerSettings->getData(); + QPointer<VehicleConfig> vconfig = new VehicleConfig(); - //get the settings for the curve from the mixer settings - for (i=0;i<5;i++) - { - m_ccpm->CurveSettings->item(i, 0)->setText(QString().sprintf("%.3f", - mixerSettingsData.ThrottleCurve1[i])); - m_ccpm->CurveSettings->item(i, 1)->setText(QString().sprintf("%.3f", - mixerSettingsData.ThrottleCurve2[i])); + QList<double> curveValues; + vconfig->getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, &curveValues); + + // is at least one of the curve values != 0? + if (vconfig->isValidThrottleCurve(&curveValues)) { + m_ccpm->ThrottleCurve->setCurve(&curveValues); + } + else { + m_ccpm->ThrottleCurve->ResetCurve(); + } + + + vconfig->getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, &curveValues); + // is at least one of the curve values != 0? + if (vconfig->isValidThrottleCurve(&curveValues)) { + m_ccpm->PitchCurve->setCurve(&curveValues); + } + else { + m_ccpm->PitchCurve->ResetCurve(); } updatingFromHardware=FALSE; @@ -1195,9 +926,11 @@ void ConfigCcpmWidget::setMixer() } //get the user data for the curve into the mixer settings + QList<double> curve1 = m_ccpm->ThrottleCurve->getCurve(); + QList<double> curve2 = m_ccpm->PitchCurve->getCurve(); for (i=0;i<5;i++) { - mixerSettingsData.ThrottleCurve1[i] = m_ccpm->CurveSettings->item(i, 0)->text().toDouble(); - mixerSettingsData.ThrottleCurve2[i] = m_ccpm->CurveSettings->item(i, 1)->text().toDouble(); + mixerSettingsData.ThrottleCurve1[i] = curve1.at(i); + mixerSettingsData.ThrottleCurve2[i] = curve2.at(i); } //mapping of collective input to curve 2... diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.h index 56161c36f..a903afa5b 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.h @@ -88,7 +88,7 @@ private: bool updatingToHardware; virtual void ResetActuators(GUIConfigDataUnion* configData); - virtual QStringList getChannelDescriptions(); + static QStringList getChannelDescriptions(); QString updateConfigObjects(); private slots: @@ -99,13 +99,8 @@ private: void ccpmSwashplateUpdate(); void ccpmSwashplateRedraw(); - void UpdateCurveSettings(); - void GenerateCurve(); void UpdateMixer(); void UpdateType(); - void UpdateCurveWidgets(); - void updatePitchCurveValue(QList<double>,double); - void updateThrottleCurveValue(QList<double>,double); void SwashLvlStartButtonPressed(); void SwashLvlNextButtonPressed(); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp index 7ed667828..ecc933eec 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp @@ -186,8 +186,7 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets() Q_ASSERT(mixer); // Remove Feed Forward, it is pointless on a plane: - UAVObjectField* field = mixer->getField(QString("FeedForward")); - field->setDouble(0); + setMixerValue(mixer, "FeedForward", 0.0); // Set the throttle curve setThrottleCurve(mixer,VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->fixedWingThrottle->getCurve()); @@ -291,7 +290,7 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType) int channel; //disable all - for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) + for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++) { setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); resetMixerVector(mixer, channel); @@ -371,7 +370,7 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType) int channel; double value; //disable all - for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) + for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++) { setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); resetMixerVector(mixer, channel); @@ -449,7 +448,7 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType) int channel; double value; //disable all - for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) + for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++) { setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); resetMixerVector(mixer, channel); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h index 99eab5c06..7897829b3 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h @@ -57,7 +57,7 @@ private: bool setupFrameVtail(QString airframeType); virtual void ResetActuators(GUIConfigDataUnion* configData); - virtual QStringList getChannelDescriptions(); + static QStringList getChannelDescriptions(); private slots: virtual void setupUI(QString airframeType); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp index 2309ed872..a5df943c8 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp @@ -198,24 +198,15 @@ QString ConfigGroundVehicleWidget::updateConfigObjectsFromWidgets() QString airframeType = "GroundVehicleCar"; // Save the curve (common to all ground vehicle frames) - UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); + UAVDataObject *mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); // Remove Feed Forward, it is pointless on a ground vehicle: - UAVObjectField* field = obj->getField(QString("FeedForward")); - field->setDouble(0); - - field = obj->getField("ThrottleCurve1"); - QList<double> curve = m_aircraft->groundVehicleThrottle1->getCurve(); - for (int i=0;i<curve.length();i++) { - field->setValue(curve.at(i),i); - } + setMixerValue(mixer, "FeedForward", 0.0); + + // set the throttle curves + setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->groundVehicleThrottle1->getCurve() ); + setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->groundVehicleThrottle2->getCurve() ); - field = obj->getField("ThrottleCurve2"); - curve = m_aircraft->groundVehicleThrottle2->getCurve(); - for (int i=0;i<curve.length();i++) { - field->setValue(curve.at(i),i); - } - //All airframe types must start with "GroundVehicle" if (m_aircraft->groundVehicleType->currentText() == "Turnable (car)" ) { airframeType = "GroundVehicleCar"; @@ -307,7 +298,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleMotorcycle(QString airframeTyp int channel; //disable all - for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) { + for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++) { setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); resetMixerVector(mixer, channel); } @@ -364,7 +355,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleDifferential(QString airframeT int channel; //disable all - for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) { + for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++) { setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); resetMixerVector(mixer, channel); } @@ -419,7 +410,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleCar(QString airframeType) int channel; //disable all - for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) { + for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++) { setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); resetMixerVector(mixer, channel); } diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h index b2b447e6e..fb6cc48b2 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h @@ -57,7 +57,7 @@ private: bool setupGroundVehicleMotorcycle(QString airframeType); virtual void ResetActuators(GUIConfigDataUnion* configData); - virtual QStringList getChannelDescriptions(); + static QStringList getChannelDescriptions(); private slots: virtual void setupUI(QString airframeType); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp index d27f4c530..59ff087ce 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp @@ -42,7 +42,8 @@ #include "actuatorsettings.h" #include "actuatorcommand.h" -//#define Pi 3.14159265358979323846 + +const QString ConfigMultiRotorWidget::CHANNELBOXNAME = QString("multiMotorChannelBox"); /** @@ -89,10 +90,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) quad->setElementId("tri"); //Enable all necessary motor channel boxes... - for (i=1; i <=3; i++) { - enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); - } - + enableComboBoxes(uiowner, CHANNELBOXNAME, 3, true); + m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100); m_aircraft->mrYawMixLevel->setValue(50); @@ -103,10 +102,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Quad X")); quad->setElementId("quad-x"); - //Enable all necessary motor channel boxes... - for (i=1; i <=4; i++) { - enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); - } + //Enable all necessary motor channel boxes... + enableComboBoxes(uiowner, CHANNELBOXNAME, 4, true); // init mixer levels m_aircraft->mrRollMixLevel->setValue(50); @@ -117,10 +114,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Quad +")); quad->setElementId("quad-plus"); - //Enable all necessary motor channel boxes... - for (i=1; i <=4; i++) { - enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); - } + //Enable all necessary motor channel boxes... + enableComboBoxes(uiowner, CHANNELBOXNAME, 4, true); m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100); @@ -131,10 +126,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter")); quad->setElementId("quad-hexa"); - //Enable all necessary motor channel boxes... - for (i=1; i <=6; i++) { - enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); - } + //Enable all necessary motor channel boxes... + enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true); m_aircraft->mrRollMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(33); @@ -144,10 +137,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter X")); quad->setElementId("quad-hexa-H"); - //Enable all necessary motor channel boxes... - for (i=1; i <=6; i++) { - enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); - } + //Enable all necessary motor channel boxes... + enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true); m_aircraft->mrRollMixLevel->setValue(33); m_aircraft->mrPitchMixLevel->setValue(50); @@ -159,10 +150,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter Y6")); quad->setElementId("hexa-coax"); - //Enable all necessary motor channel boxes... - for (i=1; i <=6; i++) { - enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); - } + //Enable all necessary motor channel boxes... + enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true); m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(50); @@ -174,10 +163,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter")); quad->setElementId("quad-octo"); - //Enable all necessary motor channel boxes - for (i=1; i <=8; i++) { - enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); - } + //Enable all necessary motor channel boxes + enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true); m_aircraft->mrRollMixLevel->setValue(33); m_aircraft->mrPitchMixLevel->setValue(33); @@ -188,10 +175,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter V")); quad->setElementId("quad-octo-v"); - //Enable all necessary motor channel boxes - for (i=1; i <=8; i++) { - enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); - } + //Enable all necessary motor channel boxes + enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true); m_aircraft->mrRollMixLevel->setValue(25); m_aircraft->mrPitchMixLevel->setValue(25); @@ -203,10 +188,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax +")); quad->setElementId("octo-coax-P"); - //Enable all necessary motor channel boxes - for (int i=1; i <=8; i++) { - enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); - } + //Enable all necessary motor channel boxes + enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true); m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100); @@ -218,10 +201,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax X")); quad->setElementId("octo-coax-X"); - //Enable all necessary motor channel boxes - for (int i=1; i <=8; i++) { - enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); - } + enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true); m_aircraft->mrRollMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(50); @@ -245,11 +225,10 @@ void ConfigMultiRotorWidget::ResetActuators(GUIConfigDataUnion* configData) QStringList ConfigMultiRotorWidget::getChannelDescriptions() { - int i; QStringList channelDesc; // init a channel_numelem list of channel desc defaults - for (i=0; i < (int)(ConfigMultiRotorWidget::CHANNEL_NUMELEM); i++) + for (int i=0; i < (int)(ConfigMultiRotorWidget::CHANNEL_NUMELEM); i++) { channelDesc.append(QString("-")); } @@ -258,22 +237,24 @@ QStringList ConfigMultiRotorWidget::getChannelDescriptions() GUIConfigDataUnion configData = GetConfigData(); multiGUISettingsStruct multi = configData.multi; - if (multi.VTOLMotorN > 0 && multi.VTOLMotorN < ConfigMultiRotorWidget::CHANNEL_NUMELEM) + if (multi.VTOLMotorN > 0 && multi.VTOLMotorN <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) channelDesc[multi.VTOLMotorN-1] = QString("VTOLMotorN"); - if (multi.VTOLMotorNE > 0 && multi.VTOLMotorNE < ConfigMultiRotorWidget::CHANNEL_NUMELEM) + if (multi.VTOLMotorNE > 0 && multi.VTOLMotorNE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) channelDesc[multi.VTOLMotorNE-1] = QString("VTOLMotorNE"); - if (multi.VTOLMotorNW > 0 && multi.VTOLMotorNW < ConfigMultiRotorWidget::CHANNEL_NUMELEM) + if (multi.VTOLMotorNW > 0 && multi.VTOLMotorNW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) channelDesc[multi.VTOLMotorNW-1] = QString("VTOLMotorNW"); - if (multi.VTOLMotorS > 0 && multi.VTOLMotorS < ConfigMultiRotorWidget::CHANNEL_NUMELEM) + if (multi.VTOLMotorS > 0 && multi.VTOLMotorS <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) channelDesc[multi.VTOLMotorS-1] = QString("VTOLMotorS"); - if (multi.VTOLMotorSE > 0 && multi.VTOLMotorSE < ConfigMultiRotorWidget::CHANNEL_NUMELEM) + if (multi.VTOLMotorSE > 0 && multi.VTOLMotorSE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) channelDesc[multi.VTOLMotorSE-1] = QString("VTOLMotorSE"); - if (multi.VTOLMotorSW > 0 && multi.VTOLMotorSW < ConfigMultiRotorWidget::CHANNEL_NUMELEM) + if (multi.VTOLMotorSW > 0 && multi.VTOLMotorSW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) channelDesc[multi.VTOLMotorSW-1] = QString("VTOLMotorSW"); - if (multi.VTOLMotorW > 0 && multi.VTOLMotorW < ConfigMultiRotorWidget::CHANNEL_NUMELEM) + if (multi.VTOLMotorW > 0 && multi.VTOLMotorW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) channelDesc[multi.VTOLMotorW-1] = QString("VTOLMotorW"); - if (multi.VTOLMotorE > 0 && multi.VTOLMotorE < ConfigMultiRotorWidget::CHANNEL_NUMELEM) + if (multi.VTOLMotorE > 0 && multi.VTOLMotorE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) channelDesc[multi.VTOLMotorE-1] = QString("VTOLMotorE"); + if (multi.TRIYaw > 0 && multi.TRIYaw <= ConfigMultiRotorWidget::CHANNEL_NUMELEM) + channelDesc[multi.TRIYaw-1] = QString("Tri-Yaw"); return channelDesc; } @@ -500,7 +481,8 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); Q_ASSERT(mixer); - if (frameType == "QuadP") { + if (frameType == "QuadP") + { // Motors 1/2/3/4 are: N / E / S / W setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorE); @@ -525,7 +507,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) m_aircraft->mrRollMixLevel->setValue( -value/1.27); } - } else if (frameType == "QuadX") { + } + else if (frameType == "QuadX") + { // Motors 1/2/3/4 are: NW / NE / SE / SW setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE); @@ -549,7 +533,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) } - } else if (frameType == "Hexa") { + } + else if (frameType == "Hexa") + { // Motors 1/2/3 4/5/6 are: N / NE / SE / S / SW / NW setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN); @@ -580,7 +566,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) } - } else if (frameType == "HexaX") { + } + else if (frameType == "HexaX") + { // Motors 1/2/3 4/5/6 are: NE / E / SE / SW / W / NW setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNE); @@ -607,7 +595,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); m_aircraft->mrRollMixLevel->setValue( floor(1-value/1.27) ); } - } else if (frameType == "HexaCoax") { + } + else if (frameType == "HexaCoax") + { // Motors 1/2/3 4/5/6 are: NW/W NE/E S/SE setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); @@ -633,8 +623,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); m_aircraft->mrRollMixLevel->setValue( value/1.27); } - } else if (frameType == "Octo" || frameType == "OctoV" || - frameType == "OctoCoaxP") { + } + else if (frameType == "Octo" || frameType == "OctoV" || frameType == "OctoCoaxP") + { // Motors 1 to 8 are N / NE / E / etc setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN); @@ -690,7 +681,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) } } - } else if (frameType == "OctoCoaxX") { + } + else if (frameType == "OctoCoaxX") + { // Motors 1 to 8 are N / NE / E / etc setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); @@ -717,7 +710,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) ); } - } else if (frameType == "Tri") { + } + else if (frameType == "Tri") + { // Motors 1 to 8 are N / NE / E / etc setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); @@ -969,7 +964,7 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3]) Q_ASSERT(mixer); //disable all - for (int channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) + for (int channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++) { setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); resetMixerVector(mixer, channel); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h index 69b1e1712..085aab106 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h @@ -65,7 +65,8 @@ private: void setupQuadMotor(int channel, double roll, double pitch, double yaw); virtual void ResetActuators(GUIConfigDataUnion* configData); - virtual QStringList getChannelDescriptions(); + static QStringList getChannelDescriptions(); + static const QString CHANNELBOXNAME; private slots: virtual void setupUI(QString airframeType); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp index 94c3111b3..1a00946ee 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp @@ -113,17 +113,6 @@ void VehicleConfig::SetConfigData(GUIConfigDataUnion configData) { void VehicleConfig::ResetActuators(GUIConfigDataUnion* configData) { } -QStringList VehicleConfig::getChannelDescriptions() -{ - QStringList channelDesc; - - // init a channel_numelem list of channel desc defaults - for (int i=0; i < (int)(VehicleConfig::CHANNEL_NUMELEM); i++) - { - channelDesc.append(QString("-")); - } - return channelDesc; -} /** Helper function: @@ -140,15 +129,16 @@ void VehicleConfig::setComboCurrentIndex(QComboBox* box, int index) /** Helper function: - enables/disables the named combobox within supplied uiowner + enables/disables the named comboboxes within supplied uiowner */ -void VehicleConfig::enableComboBox(QWidget* owner, QString boxName, bool enable) +void VehicleConfig::enableComboBoxes(QWidget* owner, QString boxName, int boxCount, bool enable) { - QComboBox* box = qFindChild<QComboBox*>(owner, boxName); - if (box) - box->setEnabled(enable); + for (int i = 1; i <= boxCount; i++) { + QComboBox* box = qFindChild<QComboBox*>(owner, QString("%0%1").arg(boxName).arg(i)); + if (box) + box->setEnabled(enable); + } } - QString VehicleConfig::getMixerType(UAVDataObject* mixer, int channel) { Q_ASSERT(mixer); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h index 31447f3f8..2c94a045e 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h @@ -123,8 +123,7 @@ class VehicleConfig: public ConfigTaskWidget static void SetConfigData(GUIConfigDataUnion configData); static void resetField(UAVObjectField * field); static void setComboCurrentIndex(QComboBox* box, int index); - static void enableComboBox(QWidget* owner, QString boxName, bool enable); - + static void enableComboBoxes(QWidget* owner, QString boxName, int boxCount, bool enable); double getMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName); void setMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName, double value); void resetMixerVector(UAVDataObject* mixer, int channel); @@ -138,7 +137,6 @@ class VehicleConfig: public ConfigTaskWidget double getCurveMin(QList<double>* curve); double getCurveMax(QList<double>* curve); virtual void ResetActuators(GUIConfigDataUnion* configData); - virtual QStringList getChannelDescriptions(); QStringList channelNames; QStringList mixerTypes; diff --git a/ground/openpilotgcs/src/plugins/config/config.pro b/ground/openpilotgcs/src/plugins/config/config.pro index 8e49cb54d..af6f3e1ed 100644 --- a/ground/openpilotgcs/src/plugins/config/config.pro +++ b/ground/openpilotgcs/src/plugins/config/config.pro @@ -36,7 +36,9 @@ HEADERS += configplugin.h \ cfg_vehicletypes/configfixedwingwidget.h \ cfg_vehicletypes/vehicleconfig.h \ configrevowidget.h \ - config_global.h + config_global.h \ + mixercurve.h \ + dblspindelegate.h SOURCES += configplugin.cpp \ configgadgetconfiguration.cpp \ configgadgetwidget.cpp \ @@ -67,7 +69,9 @@ SOURCES += configplugin.cpp \ cfg_vehicletypes/configfixedwingwidget.cpp \ cfg_vehicletypes/configccpmwidget.cpp \ outputchannelform.cpp \ - cfg_vehicletypes/vehicleconfig.cpp + cfg_vehicletypes/vehicleconfig.cpp \ + mixercurve.cpp \ + dblspindelegate.cpp FORMS += airframe.ui \ cc_hw_settings.ui \ pro_hw_settings.ui \ @@ -83,5 +87,6 @@ FORMS += airframe.ui \ outputchannelform.ui \ revosensors.ui \ txpid.ui \ - pipxtreme.ui + pipxtreme.ui \ + mixercurve.ui RESOURCES += configgadget.qrc diff --git a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp index f9dc84350..89b752996 100644 --- a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp +++ b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp @@ -44,15 +44,35 @@ ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent) m_telemetry = new Ui_CC_HW_Widget(); m_telemetry->setupUi(this); - m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg")); - - ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>(); if(!settings->useExpertMode()) m_telemetry->saveTelemetryToRAM->setVisible(false); + UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>(); + int id = utilMngr->getBoardModel(); + + switch (id) { + case 0x0101: + m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0101.svg")); + break; + case 0x0301: + m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0301.svg")); + break; + case 0x0401: + m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0401.svg")); + break; + case 0x0402: + m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0402.svg")); + break; + case 0x0201: + m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0201.svg")); + break; + default: + m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg")); + break; + } addApplySaveButtons(m_telemetry->saveTelemetryToRAM,m_telemetry->saveTelemetryToSD); addUAVObjectToWidgetRelation("HwSettings","CC_FlexiPort",m_telemetry->cbFlexi); addUAVObjectToWidgetRelation("HwSettings","CC_MainPort",m_telemetry->cbTele); diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp index 00104100d..f9c9e0a40 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp @@ -93,12 +93,12 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent) connect(m_config->wzBack,SIGNAL(clicked()),this,SLOT(wzBack())); m_config->stackedWidget->setCurrentIndex(0); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos1,0); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos2,1); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos3,2); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos4,3); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos5,4); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos6,5); + addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos1,1); + addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos2,2); + addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos3,3); + addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos4,1); + addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos5,2); + addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos6,3); addUAVObjectToWidgetRelation("ManualControlSettings","FlightModeNumber",m_config->fmsPosNum); addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Roll,"Roll"); diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp index cb1918888..2f77d58c1 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp @@ -239,8 +239,6 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject * obj) { Q_UNUSED(obj); - bool dirty=isDirty(); - // Get Actuator Settings ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager()); Q_ASSERT(actuatorSettings); diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp index 5c91204b4..e91d08574 100644 --- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp @@ -117,7 +117,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi //Generate lists of mixerTypeNames, mixerVectorNames, channelNames channelNames << "None"; - for (int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) { + for (int i = 0; i < (int)ActuatorSettings::CHANNELADDR_NUMELEM; i++) { mixerTypes << QString("Mixer%1Type").arg(i+1); mixerVectors << QString("Mixer%1Vector").arg(i+1); @@ -172,14 +172,14 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); UAVObjectField* field = obj->getField(QString("Mixer1Type")); QStringList list = field->getOptions(); - for (int i=0;i<8;i++) { + for (int i=0; i<(int)(VehicleConfig::CHANNEL_NUMELEM); i++) { QComboBox* qb = new QComboBox(m_aircraft->customMixerTable); qb->addItems(list); m_aircraft->customMixerTable->setCellWidget(0,i,qb); } SpinBoxDelegate *sbd = new SpinBoxDelegate(); - for (int i=1;i<8; i++) { + for (int i=1; i<(int)(VehicleConfig::CHANNEL_NUMELEM); i++) { m_aircraft->customMixerTable->setItemDelegateForRow(i, sbd); } @@ -201,9 +201,6 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi m_heli = m_aircraft->widget_3; m_heli->setupUI(QString("HeliCP")); - // initialize the ui to show the mixersettings tab - //mdl m_aircraft->tabWidget->setCurrentIndex(0); - //Connect aircraft type selection dropbox to callback function connect(m_aircraft->aircraftType, SIGNAL(currentIndexChanged(int)), this, SLOT(switchAirframeType(int))); @@ -213,25 +210,6 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi connect(m_aircraft->groundVehicleType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); //mdl connect(m_heli->m_ccpm->ccpmType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); - //Connect throttle curve reset pushbuttons to reset functions - connect(m_aircraft->fwThrottleReset, SIGNAL(clicked()), this, SLOT(resetFwMixer())); - connect(m_aircraft->mrThrottleCurveReset, SIGNAL(clicked()), this, SLOT(resetMrMixer())); - connect(m_aircraft->gvThrottleCurve1Reset, SIGNAL(clicked()), this, SLOT(resetGvFrontMixer())); - connect(m_aircraft->gvThrottleCurve2Reset, SIGNAL(clicked()), this, SLOT(resetGvRearMixer())); - connect(m_aircraft->customReset1, SIGNAL(clicked()), this, SLOT(resetCt1Mixer())); - connect(m_aircraft->customReset2, SIGNAL(clicked()), this, SLOT(resetCt2Mixer())); - - //Connect throttle curve manipulation points to output text - connect(m_aircraft->fixedWingThrottle, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateFwThrottleCurveValue(QList<double>,double))); - connect(m_aircraft->multiThrottleCurve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateMrThrottleCurveValue(QList<double>,double))); - connect(m_aircraft->groundVehicleThrottle1, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateGvThrottle1CurveValue(QList<double>,double))); - connect(m_aircraft->groundVehicleThrottle2, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateGvThrottle2CurveValue(QList<double>,double))); - connect(m_aircraft->customThrottle1Curve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateCustomThrottle1CurveValue(QList<double>,double))); - connect(m_aircraft->customThrottle2Curve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateCustomThrottle2CurveValue(QList<double>,double))); - -// connect(m_aircraft->fwAileron1Channel, SIGNAL(currentIndexChanged(int)), this, SLOT(toggleAileron2(int))); -// connect(m_aircraft->fwElevator1Channel, SIGNAL(currentIndexChanged(int)), this, SLOT(toggleElevator2(int))); - //Connect the three feed forward test checkboxes connect(m_aircraft->ffTestBox1, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); @@ -281,16 +259,14 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions() case SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON: case SystemSettings::AIRFRAMETYPE_FIXEDWINGVTAIL: { - QPointer<ConfigFixedWingWidget> fixedwing = new ConfigFixedWingWidget(); - channelDesc = fixedwing->getChannelDescriptions(); + channelDesc = ConfigFixedWingWidget::getChannelDescriptions(); } break; // helicp case SystemSettings::AIRFRAMETYPE_HELICP: { - QPointer<ConfigCcpmWidget> heli = new ConfigCcpmWidget(); - channelDesc = heli->getChannelDescriptions(); + channelDesc = ConfigCcpmWidget::getChannelDescriptions(); } break; @@ -307,8 +283,7 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions() case SystemSettings::AIRFRAMETYPE_HEXACOAX: case SystemSettings::AIRFRAMETYPE_HEXA: { - QPointer<ConfigMultiRotorWidget> multi = new ConfigMultiRotorWidget(); - channelDesc = multi->getChannelDescriptions(); + channelDesc = ConfigMultiRotorWidget::getChannelDescriptions(); } break; @@ -317,8 +292,7 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions() case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIAL: case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE: { - QPointer<ConfigGroundVehicleWidget> ground = new ConfigGroundVehicleWidget(); - channelDesc = ground->getChannelDescriptions(); + channelDesc = ConfigGroundVehicleWidget::getChannelDescriptions(); } break; @@ -349,9 +323,9 @@ void ConfigVehicleTypeWidget::switchAirframeType(int index) m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); if (m_aircraft->aircraftType->findText("Custom")) { m_aircraft->customMixerTable->resizeColumnsToContents(); - for (int i=0;i<8;i++) { + for (int i=0;i<(int)(VehicleConfig::CHANNEL_NUMELEM);i++) { m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()- - m_aircraft->customMixerTable->verticalHeader()->width())/8); + m_aircraft->customMixerTable->verticalHeader()->width())/10); } } } @@ -368,9 +342,9 @@ void ConfigVehicleTypeWidget::showEvent(QShowEvent *event) // the result is usually a ahrsbargraph that is way too small. m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); m_aircraft->customMixerTable->resizeColumnsToContents(); - for (int i=0;i<8;i++) { + for (int i=0;i<(int)(VehicleConfig::CHANNEL_NUMELEM);i++) { m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()- - m_aircraft->customMixerTable->verticalHeader()->width())/8); + m_aircraft->customMixerTable->verticalHeader()->width())/ 10); } } @@ -383,9 +357,9 @@ void ConfigVehicleTypeWidget::resizeEvent(QResizeEvent* event) m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); // Make the custom table columns autostretch: m_aircraft->customMixerTable->resizeColumnsToContents(); - for (int i=0;i<8;i++) { + for (int i=0;i<(int)(VehicleConfig::CHANNEL_NUMELEM);i++) { m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()- - m_aircraft->customMixerTable->verticalHeader()->width())/8); + m_aircraft->customMixerTable->verticalHeader()->width())/ 10); } } @@ -486,132 +460,6 @@ void ConfigVehicleTypeWidget::enableFFTest() } } - -/** - Resets Fixed wing throttle mixer - */ -void ConfigVehicleTypeWidget::resetFwMixer() -{ - UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); - UAVObjectField* field = obj->getField(QString("ThrottleCurve1")); - resetMixer(m_aircraft->fixedWingThrottle, field->getNumElements(),1); -} - -/** - Resets Multirotor throttle mixer - */ -void ConfigVehicleTypeWidget::resetMrMixer() -{ - UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); - UAVObjectField* field = obj->getField(QString("ThrottleCurve1")); - resetMixer(m_aircraft->multiThrottleCurve, field->getNumElements(),0.9); -} - -/** - Resets Ground vehicle front throttle mixer - */ -void ConfigVehicleTypeWidget::resetGvFrontMixer() -{ - UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); - UAVObjectField* field = obj->getField(QString("ThrottleCurve1")); - resetMixer(m_aircraft->groundVehicleThrottle1, field->getNumElements(),1); -} - -/** - Resets Ground vehicle rear throttle mixer - */ -void ConfigVehicleTypeWidget::resetGvRearMixer() -{ - UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); - UAVObjectField* field = obj->getField(QString("ThrottleCurve2")); - resetMixer(m_aircraft->groundVehicleThrottle2, field->getNumElements(),1); -} - -/** - Resets Custom throttle 1 mixer - */ -void ConfigVehicleTypeWidget::resetCt1Mixer() -{ - UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); - UAVObjectField* field = obj->getField(QString("ThrottleCurve1")); - resetMixer(m_aircraft->customThrottle1Curve, field->getNumElements(),1); -} - -/** - Resets Custom throttle 2 mixer - */ -void ConfigVehicleTypeWidget::resetCt2Mixer() -{ - UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); - UAVObjectField* field = obj->getField(QString("ThrottleCurve2")); - resetMixer(m_aircraft->customThrottle2Curve, field->getNumElements(),1); -} - - -/** - Resets a mixer curve - */ -void ConfigVehicleTypeWidget::resetMixer(MixerCurveWidget *mixer, int numElements, double maxvalue) -{ - // Setup all Throttle1 curves for all types of airframes - mixer->initLinearCurve((quint32)numElements,maxvalue); -} - -/** - Updates the currently moved fixed wing throttle curve item value - */ -void ConfigVehicleTypeWidget::updateFwThrottleCurveValue(QList<double> list, double value) -{ - Q_UNUSED(list); - m_aircraft->fwThrottleCurveItemValue->setText(QString().sprintf("Val: %.2f",value)); -} - -/** - Updates the currently moved multi-rotor throttle curve item value - */ -void ConfigVehicleTypeWidget::updateMrThrottleCurveValue(QList<double> list, double value) -{ - Q_UNUSED(list); - m_aircraft->mrThrottleCurveItemValue->setText(QString().sprintf("Val: %.2f",value)); -} - -/** - Updates the moved ground vehicle front throttle curve item value - */ -void ConfigVehicleTypeWidget::updateGvThrottle1CurveValue(QList<double> list, double value) -{ - Q_UNUSED(list); - m_aircraft->gvThrottleCurve1ItemValue->setText(QString().sprintf("Val: %.2f",value)); -} - -/** - Updates the moved ground vehicle rear throttle curve item value - */ -void ConfigVehicleTypeWidget::updateGvThrottle2CurveValue(QList<double> list, double value) -{ - Q_UNUSED(list); - m_aircraft->gvThrottleCurve2ItemValue->setText(QString().sprintf("Val: %.2f",value)); -} - -/** - Updates the currently moved custom throttle curve item value (Custom throttle 1) - */ -void ConfigVehicleTypeWidget::updateCustomThrottle1CurveValue(QList<double> list, double value) -{ - Q_UNUSED(list); - m_aircraft->customThrottleCurve1Value->setText(QString().sprintf("Val: %.2f",value)); -} - -/** - Updates the currently moved custom throttle curve item value (Custom throttle 2) - */ -void ConfigVehicleTypeWidget::updateCustomThrottle2CurveValue(QList<double> list, double value) -{ - Q_UNUSED(list); - m_aircraft->customThrottleCurve2Value->setText(QString().sprintf("Val: %.2f",value)); -} - - /************************** * Aircraft settings **************************/ @@ -771,30 +619,34 @@ void ConfigVehicleTypeWidget::updateCustomAirframeUI() // is at least one of the curve values != 0? if (vconfig->isValidThrottleCurve(&curveValues)) { - // yes, use the curve we just read from mixersettings - m_aircraft->customThrottle1Curve->setMin(vconfig->getCurveMin(&curveValues)); - m_aircraft->customThrottle1Curve->setMax(vconfig->getCurveMax(&curveValues)); m_aircraft->customThrottle1Curve->initCurve(&curveValues); } else { // no, init a straight curve - m_aircraft->customThrottle1Curve->initLinearCurve(curveValues.count(),(double)1); + m_aircraft->customThrottle1Curve->initLinearCurve(curveValues.count(), 1.0); } - // Setup all Throttle2 curves for all types of airframes //AT THIS MOMENT, THAT MEANS ONLY GROUND VEHICLES + if (MixerSettings* mxr = qobject_cast<MixerSettings *>(mixer)) { + MixerSettings::DataFields mixerSettingsData = mxr->getData(); + if (mixerSettingsData.Curve2Source == MixerSettings::CURVE2SOURCE_THROTTLE) + m_aircraft->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); + else { + m_aircraft->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_PITCH); + } + } + + // Setup all Throttle2 curves for all types of airframes vconfig->getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, &curveValues); if (vconfig->isValidThrottleCurve(&curveValues)) { - m_aircraft->customThrottle2Curve->setMin(vconfig->getCurveMin(&curveValues)); - m_aircraft->customThrottle2Curve->setMax(vconfig->getCurveMax(&curveValues)); m_aircraft->customThrottle2Curve->initCurve(&curveValues); } else { - m_aircraft->customThrottle2Curve->initLinearCurve(curveValues.count(),(double)1); + m_aircraft->customThrottle2Curve->initLinearCurve(curveValues.count(), 1.0, m_aircraft->customThrottle2Curve->getMin()); } // Update the mixer table: - for (int channel=0; channel<8; channel++) { + for (int channel=0; channel<(int)(VehicleConfig::CHANNEL_NUMELEM); channel++) { UAVObjectField* field = mixer->getField(mixerTypes.at(channel)); if (field) { @@ -864,7 +716,7 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets() vconfig->setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->customThrottle2Curve->getCurve()); // Update the table: - for (int channel=0; channel<8; channel++) { + for (int channel=0; channel<(int)(VehicleConfig::CHANNEL_NUMELEM); channel++) { QComboBox* q = (QComboBox*)m_aircraft->customMixerTable->cellWidget(0,channel); vconfig->setMixerType(mixer,channel, @@ -920,13 +772,13 @@ void ConfigVehicleTypeWidget::setComboCurrentIndex(QComboBox* box, int index) void ConfigVehicleTypeWidget::addToDirtyMonitor() { addWidget(m_aircraft->customMixerTable); - addWidget(m_aircraft->customThrottle1Curve); - addWidget(m_aircraft->customThrottle2Curve); - addWidget(m_aircraft->multiThrottleCurve); - addWidget(m_aircraft->fixedWingThrottle); + addWidget(m_aircraft->customThrottle1Curve->getCurveWidget()); + addWidget(m_aircraft->customThrottle2Curve->getCurveWidget()); + addWidget(m_aircraft->multiThrottleCurve->getCurveWidget()); + addWidget(m_aircraft->fixedWingThrottle->getCurveWidget()); addWidget(m_aircraft->fixedWingType); - addWidget(m_aircraft->groundVehicleThrottle1); - addWidget(m_aircraft->groundVehicleThrottle2); + addWidget(m_aircraft->groundVehicleThrottle1->getCurveWidget()); + addWidget(m_aircraft->groundVehicleThrottle2->getCurveWidget()); addWidget(m_aircraft->groundVehicleType); addWidget(m_aircraft->feedForwardSlider); addWidget(m_aircraft->accelTime); @@ -984,15 +836,8 @@ void ConfigVehicleTypeWidget::addToDirtyMonitor() addWidget(m_heli->m_ccpm->ccpmRollScaleBox); addWidget(m_heli->m_ccpm->SwashLvlPositionSlider); addWidget(m_heli->m_ccpm->SwashLvlPositionSpinBox); - addWidget(m_heli->m_ccpm->CurveType); - addWidget(m_heli->m_ccpm->NumCurvePoints); - addWidget(m_heli->m_ccpm->CurveValue1); - addWidget(m_heli->m_ccpm->CurveValue2); - addWidget(m_heli->m_ccpm->CurveValue3); - addWidget(m_heli->m_ccpm->CurveToGenerate); - addWidget(m_heli->m_ccpm->CurveSettings); - addWidget(m_heli->m_ccpm->ThrottleCurve); - addWidget(m_heli->m_ccpm->PitchCurve); + addWidget(m_heli->m_ccpm->ThrottleCurve->getCurveWidget()); + addWidget(m_heli->m_ccpm->PitchCurve->getCurveWidget()); addWidget(m_heli->m_ccpm->ccpmAdvancedSettingsTable); } diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h index 3cca72ba1..60ef74fbe 100644 --- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h +++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h @@ -67,7 +67,6 @@ private: void updateCustomAirframeUI(); void addToDirtyMonitor(); void resetField(UAVObjectField * field); - void resetMixer (MixerCurveWidget *mixer, int numElements, double maxvalue); //void setMixerChannel(int channelNumber, bool channelIsMotor, QList<double> vector); @@ -93,18 +92,7 @@ private slots: void toggleElevator2(int index); void toggleRudder2(int index); void switchAirframeType(int index); - void resetFwMixer(); - void resetMrMixer(); - void resetGvFrontMixer(); - void resetGvRearMixer(); - void resetCt1Mixer(); - void resetCt2Mixer(); - void updateFwThrottleCurveValue(QList<double> list, double value); - void updateMrThrottleCurveValue(QList<double> list, double value); - void updateGvThrottle1CurveValue(QList<double> list, double value); - void updateGvThrottle2CurveValue(QList<double> list, double value); - void updateCustomThrottle1CurveValue(QList<double> list, double value); - void updateCustomThrottle2CurveValue(QList<double> list, double value); + void enableFFTest(); void openHelp(); diff --git a/ground/openpilotgcs/src/plugins/config/dblspindelegate.cpp b/ground/openpilotgcs/src/plugins/config/dblspindelegate.cpp new file mode 100644 index 000000000..21af3f1d2 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/dblspindelegate.cpp @@ -0,0 +1,86 @@ +/** + ****************************************************************************** + * + * @file doublespindelegate.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup ConfigPlugin Config Plugin + * @{ + * @brief A double spinbox delegate + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "dblspindelegate.h" + +/** + Helper delegate for the custom mixer editor table. + */ +DoubleSpinDelegate::DoubleSpinDelegate(QObject *parent) + : QItemDelegate(parent) + { + m_min = 0.0; + m_max = 1.0; + m_decimals = 2; + m_step = 0.01; + } + +QWidget *DoubleSpinDelegate::createEditor(QWidget *parent, + const QStyleOptionViewItem &/* option */, + const QModelIndex &/* index */) const +{ + QDoubleSpinBox *editor = new QDoubleSpinBox(parent); + editor->setMinimum(m_min); + editor->setMaximum(m_max); + editor->setDecimals(m_decimals); + editor->setSingleStep(m_step); + + connect(editor,SIGNAL(valueChanged(double)), this, SLOT(valueChanged())); + + return editor; +} + +void DoubleSpinDelegate::setEditorData(QWidget *editor, + const QModelIndex &index) const +{ + double value = index.model()->data(index, Qt::EditRole).toDouble(); + + QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor); + spinBox->setValue(value); +} + +void DoubleSpinDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, + const QModelIndex &index) const +{ + QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor); + spinBox->interpretText(); + double value = spinBox->value(); + + model->setData(index, value, Qt::EditRole); +} + +void DoubleSpinDelegate::updateEditorGeometry(QWidget *editor, + const QStyleOptionViewItem &option, const QModelIndex &/* index */) const +{ + editor->setGeometry(option.rect); +} + +void DoubleSpinDelegate::valueChanged() +{ + emit ValueChanged(); +} + diff --git a/ground/openpilotgcs/src/plugins/config/dblspindelegate.h b/ground/openpilotgcs/src/plugins/config/dblspindelegate.h new file mode 100644 index 000000000..482a07649 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/dblspindelegate.h @@ -0,0 +1,73 @@ +/** + ****************************************************************************** + * + * @file doublespindelegate.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup ConfigPlugin Config Plugin + * @{ + * @brief A double spinbox delegate + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef DOUBLESPINDELEGATE_H +#define DOUBLESPINDELEGATE_H + +#include <QDoubleSpinBox> +#include <QItemDelegate> + +namespace Ui { +class DoubleSpinDelegate; +} + +class DoubleSpinDelegate : public QItemDelegate +{ + Q_OBJECT + +public: + DoubleSpinDelegate(QObject *parent = 0); + + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + void setEditorData(QWidget *editor, const QModelIndex &index) const; + void setModelData(QWidget *editor, QAbstractItemModel *model, + const QModelIndex &index) const; + + void updateEditorGeometry(QWidget *editor, + const QStyleOptionViewItem &option, const QModelIndex &index) const; + + void setMin(double min) { m_min = min; } + void setMax(double max) { m_max = max; } + void setRange(double min, double max) { m_min = min; m_max = max; } + void setStep(double step) { m_step = step; } + void setDecimals(int decimals) { m_decimals = decimals; } + +private: + double m_min; + double m_max; + double m_step; + int m_decimals; + +signals: + void ValueChanged(); + +private slots: + void valueChanged(); +}; + +#endif // DOUBLESPINDELEGATE_H diff --git a/ground/openpilotgcs/src/plugins/config/mixercurve.cpp b/ground/openpilotgcs/src/plugins/config/mixercurve.cpp new file mode 100644 index 000000000..4ad2e3afe --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/mixercurve.cpp @@ -0,0 +1,474 @@ +/** + ****************************************************************************** + * + * @file mixercurve.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup ConfigPlugin Config Plugin + * @{ + * @brief A MixerCurve Gadget used to update settings in the firmware + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <QtGui/QWidget> +#include <QResizeEvent> +#include <math.h> +#include "mixercurve.h" +#include "dblspindelegate.h" + +MixerCurve::MixerCurve(QWidget *parent) : + QFrame(parent), + m_mixerUI(new Ui::MixerCurve) +{ + m_mixerUI->setupUi(this); + + // setup some convienence pointers + m_curve = m_mixerUI->CurveWidget; + m_settings = m_mixerUI->CurveSettings; + + + m_mixerUI->SettingsGroup->hide(); + m_curve->showCommands(false); + m_curve->showCommand("Reset", false); + m_curve->showCommand("Popup", false); + m_curve->showCommand("Commands", false); + + // create our spin delegate + m_spinDelegate = new DoubleSpinDelegate(); + + // set the default mixer type + setMixerType(MixerCurve::MIXERCURVE_THROTTLE); + + // setup and turn off advanced mode + CommandActivated(); + + // paint the ui + UpdateCurveUI(); + + // wire up our signals + + connect(m_mixerUI->CurveType, SIGNAL(currentIndexChanged(int)), this, SLOT(CurveTypeChanged())); + connect(m_mixerUI->ResetCurve, SIGNAL(clicked()), this, SLOT(ResetCurve())); + connect(m_mixerUI->PopupCurve, SIGNAL(clicked()),this,SLOT(PopupCurve())); + connect(m_mixerUI->GenerateCurve, SIGNAL(clicked()), this, SLOT(GenerateCurve())); + connect(m_curve, SIGNAL(curveUpdated()), this, SLOT(UpdateSettingsTable())); + connect(m_curve, SIGNAL(commandActivated(Node*)),this, SLOT(CommandActivated(Node*))); + connect(m_settings, SIGNAL(cellChanged(int,int)), this, SLOT(SettingsTableChanged())); + connect(m_mixerUI->CurveMin, SIGNAL(valueChanged(double)), this, SLOT(CurveMinChanged(double))); + connect(m_mixerUI->CurveMax, SIGNAL(valueChanged(double)), this, SLOT(CurveMaxChanged(double))); + connect(m_mixerUI->CurveStep, SIGNAL(valueChanged(double)), this, SLOT(GenerateCurve())); + + + +} + +MixerCurve::~MixerCurve() +{ + delete m_mixerUI; + delete m_spinDelegate; +} + +void MixerCurve::setMixerType(MixerCurveType curveType) +{ + m_curveType = curveType; + + m_mixerUI->CurveMin->setMaximum(1.0); + m_mixerUI->CurveMax->setMaximum(1.0); + + switch (m_curveType) { + case MixerCurve::MIXERCURVE_THROTTLE: + { + m_mixerUI->SettingsGroup->setTitle("Throttle Curve"); + m_curve->setRange(0.0, 1.0); + m_mixerUI->CurveMin->setMinimum(0.0); + m_mixerUI->CurveMax->setMinimum(0.0); + break; + } + case MixerCurve::MIXERCURVE_PITCH: + { + m_mixerUI->SettingsGroup->setTitle("Pitch Curve"); + m_curve->setRange(-1.0, 1.0); + m_curve->setPositiveColor("#0000aa", "#0000aa"); + m_mixerUI->CurveMin->setMinimum(-1.0); + m_mixerUI->CurveMax->setMinimum(-1.0); + break; + } + } + + m_spinDelegate->setRange(m_mixerUI->CurveMin->minimum(), m_mixerUI->CurveMax->maximum()); + for (int i=0; i<MixerCurveWidget::NODE_NUMELEM; i++) { + m_settings->setItemDelegateForRow(i, m_spinDelegate); + } + + ResetCurve(); +} + +void MixerCurve::ResetCurve() +{ + m_mixerUI->CurveMin->setValue(m_mixerUI->CurveMin->minimum()); + m_mixerUI->CurveMax->setValue(m_mixerUI->CurveMax->maximum()); + m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Linear")); + + initLinearCurve(MixerCurveWidget::NODE_NUMELEM, getCurveMax(), getCurveMin()); + + m_curve->activateCommand("Linear"); + + UpdateSettingsTable(); +} + +void MixerCurve::PopupCurve() +{ + if (!m_curve->isCommandActive("Popup")) { + + m_mixerUI->SettingsGroup->show(); + m_mixerUI->PopupCurve->hide(); + + PopupWidget* popup = new PopupWidget(); + popup->popUp(this); + + m_mixerUI->SettingsGroup->hide(); + m_mixerUI->PopupCurve->show(); + m_curve->showCommands(false); + } +} +void MixerCurve::UpdateCurveUI() +{ + //get the user settings + QString curveType = m_mixerUI->CurveType->currentText(); + + m_curve->activateCommand(curveType); + bool cmdsActive = m_curve->isCommandActive("Commands"); + + m_curve->showCommand("StepPlus", cmdsActive && curveType != "Linear"); + m_curve->showCommand("StepMinus", cmdsActive && curveType != "Linear"); + m_curve->showCommand("StepValue", cmdsActive && curveType != "Linear"); + + m_mixerUI->CurveStep->setMinimum(0.0); + m_mixerUI->CurveStep->setMaximum(100.0); + m_mixerUI->CurveStep->setSingleStep(1.00); + + //set default visible + m_mixerUI->minLabel->setVisible(true); + m_mixerUI->CurveMin->setVisible(true); + m_mixerUI->maxLabel->setVisible(false); + m_mixerUI->CurveMax->setVisible(false); + m_mixerUI->stepLabel->setVisible(false); + m_mixerUI->CurveStep->setVisible(false); + + if ( curveType.compare("Flat")==0) + { + m_mixerUI->minLabel->setVisible(false); + m_mixerUI->CurveMin->setVisible(false); + m_mixerUI->stepLabel->setVisible(true); + m_mixerUI->CurveStep->setVisible(true); + m_mixerUI->CurveStep->setMinimum(m_mixerUI->CurveMin->minimum()); + m_mixerUI->CurveStep->setMaximum(m_mixerUI->CurveMax->maximum()); + m_mixerUI->CurveStep->setSingleStep(0.01); + m_mixerUI->CurveStep->setValue(m_mixerUI->CurveMax->value() / 2); + } + if ( curveType.compare("Linear")==0) + { + m_mixerUI->maxLabel->setVisible(true); + m_mixerUI->CurveMax->setVisible(true); + } + if ( curveType.compare("Step")==0) + { + m_mixerUI->maxLabel->setVisible(true); + m_mixerUI->CurveMax->setVisible(true); + m_mixerUI->stepLabel->setText("Step at"); + m_mixerUI->stepLabel->setVisible(true); + m_mixerUI->CurveStep->setVisible(true); + + m_mixerUI->CurveStep->setMinimum(1.0); + } + if ( curveType.compare("Exp")==0) + { + m_mixerUI->maxLabel->setVisible(true); + m_mixerUI->CurveMax->setVisible(true); + m_mixerUI->stepLabel->setText("Power"); + m_mixerUI->stepLabel->setVisible(true); + m_mixerUI->CurveStep->setVisible(true); + + m_mixerUI->CurveStep->setMinimum(1.0); + } + if ( curveType.compare("Log")==0) + { + m_mixerUI->maxLabel->setVisible(true); + m_mixerUI->CurveMax->setVisible(true); + m_mixerUI->stepLabel->setText("Power"); + m_mixerUI->stepLabel->setVisible(true); + m_mixerUI->CurveStep->setVisible(true); + m_mixerUI->CurveStep->setMinimum(1.0); + } + + GenerateCurve(); +} + +void MixerCurve::GenerateCurve() +{ + double scale; + double newValue; + + //get the user settings + double value1 = getCurveMin(); + double value2 = getCurveMax(); + double value3 = getCurveStep(); + + m_curve->setCommandText("StepValue", QString("%0").arg(value3)); + + QString CurveType = m_mixerUI->CurveType->currentText(); + + QList<double> points; + + for (int i=0; i<MixerCurveWidget::NODE_NUMELEM; i++) + { + scale =((double)i/(double)(MixerCurveWidget::NODE_NUMELEM - 1)); + + if ( CurveType.compare("Flat")==0) + { + points.append(value3); + } + if ( CurveType.compare("Linear")==0) + { + newValue =value1 +(scale*(value2-value1)); + points.append(newValue); + } + if ( CurveType.compare("Step")==0) + { + if (scale*100<value3) + { + points.append(value1); + } + else + { + points.append(value2); + } + } + if ( CurveType.compare("Exp")==0) + { + newValue =value1 +(((exp(scale*(value3/10))-1))/(exp((value3/10))-1)*(value2-value1)); + points.append(newValue); + } + if ( CurveType.compare("Log")==0) + { + newValue = value1 +(((log(scale*(value3*2)+1))/(log(1+(value3*2))))*(value2-value1)); + points.append(newValue); + } + } + + setCurve(&points); +} + +/** + Wrappers for mixercurvewidget. + */ +void MixerCurve::initCurve (const QList<double>* points) +{ + m_curve->setCurve(points); + UpdateSettingsTable(); +} +QList<double> MixerCurve::getCurve() +{ + return m_curve->getCurve(); +} +void MixerCurve::initLinearCurve(int numPoints, double maxValue, double minValue) +{ + setMin(minValue); + setMax(maxValue); + + m_curve->initLinearCurve(numPoints, maxValue, minValue); + + if (m_spinDelegate) + m_spinDelegate->setRange(minValue, maxValue); +} +void MixerCurve::setCurve(const QList<double>* points) +{ + m_curve->setCurve(points); + UpdateSettingsTable(); +} +void MixerCurve::setMin(double value) +{ + //m_curve->setMin(value); + m_mixerUI->CurveMin->setMinimum(value); +} +double MixerCurve::getMin() +{ + return m_curve->getMin(); +} +void MixerCurve::setMax(double value) +{ + //m_curve->setMax(value); + m_mixerUI->CurveMax->setMaximum(value); +} +double MixerCurve::getMax() +{ + return m_curve->getMax(); +} +double MixerCurve::setRange(double min, double max) +{ + return m_curve->setRange(min, max); +} + + +double MixerCurve::getCurveMin() +{ + return m_mixerUI->CurveMin->value(); +} +double MixerCurve::getCurveMax() +{ + return m_mixerUI->CurveMax->value(); +} + +double MixerCurve::getCurveStep() +{ + return m_mixerUI->CurveStep->value(); +} + +void MixerCurve::UpdateSettingsTable() +{ + QList<double> points = m_curve->getCurve(); + int ptCnt = points.count(); + + for (int i=0; i<ptCnt; i++) + { + QTableWidgetItem* item = m_settings->item(i, 0); + if (item) + item->setText(QString().sprintf("%.2f",points.at( (ptCnt - 1) - i ))); + } +} + +void MixerCurve::SettingsTableChanged() +{ + QList<double> points; + + for (int i=0; i < m_settings->rowCount(); i++) + { + QTableWidgetItem* item = m_settings->item(i, 0); + + if (item) + points.push_front(item->text().toDouble()); + } + + m_mixerUI->CurveMin->setValue(points.first()); + m_mixerUI->CurveMax->setValue(points.last()); + + m_curve->setCurve(&points); +} + +void MixerCurve::CommandActivated(Node* node) +{ + QString name = (node) ? node->getName() : "Reset"; + + if (name == "Reset") { + ResetCurve(); + m_curve->showCommands(false); + } + else if (name == "Commands") { + + } + else if (name == "Popup" ) { + PopupCurve(); + } + else if (name == "Linear") { + m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Linear")); + } + else if (name == "Log") { + m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Log")); + } + else if (name == "Exp") { + m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Exp")); + } + else if (name == "Flat") { + m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Flat")); + } + else if (name == "Step") { + m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Step")); + } + else if (name == "MinPlus") { + m_mixerUI->CurveMin->stepUp(); + } + else if (name == "MinMinus") { + m_mixerUI->CurveMin->stepDown(); + } + else if (name == "MaxPlus") { + m_mixerUI->CurveMax->stepUp(); + } + else if (name == "MaxMinus"){ + m_mixerUI->CurveMax->stepDown(); + } + else if (name == "StepPlus") { + m_mixerUI->CurveStep->stepUp(); + m_curve->setCommandText("StepValue", QString("%0").arg(getCurveStep())); + } + else if (name == "StepMinus") { + m_mixerUI->CurveStep->stepDown(); + m_curve->setCommandText("StepValue", QString("%0").arg(getCurveStep())); + } + + GenerateCurve(); +} + +void MixerCurve::CurveTypeChanged() +{ + // setup the ui for this curvetype + UpdateCurveUI(); +} + +void MixerCurve::CurveMinChanged(double value) +{ + QList<double> points = m_curve->getCurve(); + points.removeFirst(); + points.push_front(value); + setCurve(&points); +} + +void MixerCurve::CurveMaxChanged(double value) +{ + // the max changed so redraw the curve + // mixercurvewidget::setCurve will trim any points above max + QList<double> points = m_curve->getCurve(); + points.removeLast(); + points.append(value); + setCurve(&points); +} + +void MixerCurve::showEvent(QShowEvent *event) +{ + Q_UNUSED(event); + + m_settings->resizeColumnsToContents(); + m_settings->setColumnWidth(0,(m_settings->width()- m_settings->verticalHeader()->width())); + + int h = (m_settings->height() - m_settings->horizontalHeader()->height()) / m_settings->rowCount(); + for (int i=0; i<m_settings->rowCount(); i++) + m_settings->setRowHeight(i, h); + + m_curve->showEvent(event); +} + +void MixerCurve::resizeEvent(QResizeEvent* event) +{ + m_settings->resizeColumnsToContents(); + m_settings->setColumnWidth(0,(m_settings->width() - m_settings->verticalHeader()->width())); + + int h = (m_settings->height() - m_settings->horizontalHeader()->height()) / m_settings->rowCount(); + for (int i=0; i<m_settings->rowCount(); i++) + m_settings->setRowHeight(i, h); + + m_curve->resizeEvent(event); +} diff --git a/ground/openpilotgcs/src/plugins/config/mixercurve.h b/ground/openpilotgcs/src/plugins/config/mixercurve.h new file mode 100644 index 000000000..1e60534f6 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/mixercurve.h @@ -0,0 +1,103 @@ +/** + ****************************************************************************** + * + * @file mixercurve.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup ConfigPlugin Config Plugin + * @{ + * @brief A MixerCurve Gadget used to update settings in the firmware + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef MIXERCURVE_H +#define MIXERCURVE_H + +#include <QFrame> +#include <QtGui/QWidget> +#include <QList> +#include <QTableWidget> + +#include "ui_mixercurve.h" +#include "mixercurvewidget.h" +#include "dblspindelegate.h" +#include "uavobjectwidgetutils_global.h" +#include "uavobjectwidgetutils/popupwidget.h" + + +namespace Ui { +class MixerCurve; +} + +class MixerCurve : public QFrame +{ + Q_OBJECT + +public: + explicit MixerCurve(QWidget *parent = 0); + ~MixerCurve(); + + + /* Enumeration options for ThrottleCurves */ + typedef enum { MIXERCURVE_THROTTLE=0, MIXERCURVE_PITCH=1 } MixerCurveType; + + void setMixerType(MixerCurveType curveType); + void initCurve (const QList<double>* points); + QList<double> getCurve(); + void initLinearCurve(int numPoints, double maxValue = 1, double minValue = 0); + void setCurve(const QList<double>* points); + void setMin(double value); + double getMin(); + void setMax(double value); + double getMax(); + double getCurveMin(); + double getCurveMax(); + double getCurveStep(); + double setRange(double min, double max); + + MixerCurveWidget* getCurveWidget() { return m_curve; } + +signals: + +protected: + void showEvent(QShowEvent *event); + void resizeEvent(QResizeEvent *event); + +public slots: + void ResetCurve(); + void PopupCurve(); + void GenerateCurve(); + void UpdateSettingsTable(); + +private slots: + void CommandActivated(Node* node = 0); + void SettingsTableChanged(); + void CurveTypeChanged(); + void CurveMinChanged(double value); + void CurveMaxChanged(double value); + void UpdateCurveUI(); + +private: + Ui::MixerCurve* m_mixerUI; + MixerCurveWidget* m_curve; + QTableWidget* m_settings; + MixerCurveType m_curveType; + DoubleSpinDelegate* m_spinDelegate; + +}; + +#endif // MIXERCURVE_H diff --git a/ground/openpilotgcs/src/plugins/config/mixercurve.ui b/ground/openpilotgcs/src/plugins/config/mixercurve.ui new file mode 100644 index 000000000..e59882d89 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/mixercurve.ui @@ -0,0 +1,369 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MixerCurve</class> + <widget class="QFrame" name="MixerCurve"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>543</width> + <height>467</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>441</width> + <height>321</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>1000</width> + <height>1000</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>300</width> + <height>300</height> + </size> + </property> + <property name="windowTitle"> + <string>MixerCurve</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" rowspan="2"> + <widget class="QGroupBox" name="SettingsGroup"> + <property name="maximumSize"> + <size> + <width>150</width> + <height>16777215</height> + </size> + </property> + <property name="title"> + <string>Throttle Curve</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTableWidget" name="CurveSettings"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>200</height> + </size> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </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="alternatingRowColors"> + <bool>true</bool> + </property> + <property name="rowCount"> + <number>5</number> + </property> + <property name="columnCount"> + <number>1</number> + </property> + <row> + <property name="text"> + <string>Max</string> + </property> + </row> + <row> + <property name="text"> + <string>4</string> + </property> + </row> + <row> + <property name="text"> + <string>3</string> + </property> + </row> + <row> + <property name="text"> + <string>2</string> + </property> + </row> + <row> + <property name="text"> + <string>Min</string> + </property> + </row> + <column> + <property name="text"> + <string>Value</string> + </property> + <property name="textAlignment"> + <set>AlignJustify|AlignVCenter</set> + </property> + </column> + <item row="0" column="0"> + <property name="text"> + <string>1.0</string> + </property> + </item> + <item row="1" column="0"> + <property name="text"> + <string>.75</string> + </property> + </item> + <item row="2" column="0"> + <property name="text"> + <string>.50</string> + </property> + </item> + <item row="3" column="0"> + <property name="text"> + <string>.25</string> + </property> + </item> + <item row="4" column="0"> + <property name="text"> + <string>.00</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QComboBox" name="CurveType"> + <item> + <property name="text"> + <string>Linear</string> + </property> + </item> + <item> + <property name="text"> + <string>Log</string> + </property> + </item> + <item> + <property name="text"> + <string>Exp</string> + </property> + </item> + <item> + <property name="text"> + <string>Flat</string> + </property> + </item> + <item> + <property name="text"> + <string>Step</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QPushButton" name="GenerateCurve"> + <property name="text"> + <string>Generate</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="minLabel"> + <property name="text"> + <string>Min</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QDoubleSpinBox" name="CurveMin"> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="correctionMode"> + <enum>QAbstractSpinBox::CorrectToNearestValue</enum> + </property> + <property name="minimum"> + <double>-1.000000000000000</double> + </property> + <property name="maximum"> + <double>1.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + <property name="value"> + <double>0.000000000000000</double> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="maxLabel"> + <property name="text"> + <string>Max</string> + </property> + </widget> + </item> + <item> + <widget class="QDoubleSpinBox" name="CurveMax"> + <property name="correctionMode"> + <enum>QAbstractSpinBox::CorrectToNearestValue</enum> + </property> + <property name="minimum"> + <double>0.000000000000000</double> + </property> + <property name="maximum"> + <double>1.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + <property name="value"> + <double>1.000000000000000</double> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="stepLabel"> + <property name="text"> + <string>Step</string> + </property> + </widget> + </item> + <item> + <widget class="QDoubleSpinBox" name="CurveStep"> + <property name="correctionMode"> + <enum>QAbstractSpinBox::CorrectToNearestValue</enum> + </property> + <property name="value"> + <double>50.000000000000000</double> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + <zorder>GenerateCurve</zorder> + <zorder>CurveSettings</zorder> + <zorder>CurveType</zorder> + <zorder>CurveMin</zorder> + <zorder>minLabel</zorder> + <zorder>CurveMax</zorder> + <zorder>maxLabel</zorder> + <zorder>CurveStep</zorder> + <zorder>stepLabel</zorder> + <zorder>verticalSpacer</zorder> + </widget> + </item> + <item row="0" column="1"> + <widget class="MixerCurveWidget" name="CurveWidget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>5</horstretch> + <verstretch>5</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>1000</width> + <height>1000</height> + </size> + </property> + <property name="sizeIncrement"> + <size> + <width>10</width> + <height>10</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>200</width> + <height>200</height> + </size> + </property> + <property name="font"> + <font> + <pointsize>7</pointsize> + </font> + </property> + </widget> + </item> + <item row="1" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="ResetCurve"> + <property name="text"> + <string>Reset</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="PopupCurve"> + <property name="text"> + <string>Advanced...</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>MixerCurveWidget</class> + <extends>QWidget</extends> + <header location="global">uavobjectwidgetutils/mixercurvewidget.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp index 7fb8d70c7..41ddf9f05 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp @@ -843,7 +843,7 @@ void ConfigTaskWidget::connectWidgetUpdatesToSlot(QWidget * widget,const char* f } else if(MixerCurveWidget * cb=qobject_cast<MixerCurveWidget *>(widget)) { - connect(cb,SIGNAL(curveUpdated(QList<double>,double)),this,function); + connect(cb,SIGNAL(curveUpdated()),this,function); } else if(QTableWidget * cb=qobject_cast<QTableWidget *>(widget)) { @@ -886,7 +886,7 @@ void ConfigTaskWidget::disconnectWidgetUpdatesToSlot(QWidget * widget,const char } else if(MixerCurveWidget * cb=qobject_cast<MixerCurveWidget *>(widget)) { - disconnect(cb,SIGNAL(curveUpdated(QList<double>,double)),this,function); + disconnect(cb,SIGNAL(curveUpdated()),this,function); } else if(QTableWidget * cb=qobject_cast<QTableWidget *>(widget)) { diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp index 4846f62e3..e0498366c 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp @@ -83,7 +83,7 @@ void Edge::adjust() prepareGeometryChange(); if (length > qreal(20.)) { - QPointF edgeOffset((line.dx() * 10) / length, (line.dy() * 10) / length); + QPointF edgeOffset((line.dx() * 13) / length, (line.dy() * 13) / length); sourcePoint = line.p1() + edgeOffset; destPoint = line.p2() - edgeOffset; } else { diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp index 5996eb7d3..f81d283d9 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp @@ -29,6 +29,7 @@ #include <QGraphicsSceneMouseEvent> #include <QPainter> #include <QStyleOption> +#include <QColor> #include <QDebug> #include "mixercurveline.h" @@ -42,7 +43,18 @@ Node::Node(MixerCurveWidget *graphWidget) setFlag(ItemSendsGeometryChanges); setCacheMode(DeviceCoordinateCache); setZValue(-1); + cmdActive = false; vertical = false; + cmdNode = false; + cmdToggle = true; + drawNode = true; + drawText = true; + + posColor0 = "#1c870b"; //greenish? + posColor1 = "#116703"; //greenish? + negColor0 = "#aa0000"; //red + negColor1 = "#aa0000"; //red + } void Node::addEdge(Edge *edge) @@ -59,48 +71,74 @@ QList<Edge *> Node::edges() const QRectF Node::boundingRect() const { - qreal adjust = 2; - return QRectF(-12 - adjust, -12 - adjust, - 28 + adjust, 28 + adjust); + return cmdNode ? QRectF(-4, -4, 15, 10) : QRectF(-13, -13, 26, 26); } QPainterPath Node::shape() const { QPainterPath path; - path.addEllipse(-12, -12, 25, 25); + path.addEllipse(boundingRect()); return path; } void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) { - /* - painter->setPen(Qt::NoPen); - painter->setBrush(Qt::darkGray); - painter->drawEllipse(-7, -7, 20, 20); - */ + QString text = cmdNode ? cmdText : QString().sprintf("%.2f", value()); - QRadialGradient gradient(-3, -3, 10); - if (option->state & QStyle::State_Sunken) { - gradient.setCenter(3, 3); - gradient.setFocalPoint(3, 3); - gradient.setColorAt(1, QColor("#1c870b").light(120)); - gradient.setColorAt(0, QColor("#116703").light(120)); - } else { - gradient.setColorAt(0, "#1c870b"); - gradient.setColorAt(1, "#116703"); + if (drawNode) { + QRadialGradient gradient(-3, -3, 10); + if (option->state & QStyle::State_Sunken) { + gradient.setCenter(3, 3); + gradient.setFocalPoint(3, 3); + + gradient.setColorAt(1, Qt::darkBlue); + gradient.setColorAt(0, Qt::darkBlue); + } else { + if (cmdNode) { + gradient.setColorAt(0, cmdActive ? posColor0 : negColor0); + gradient.setColorAt(1, cmdActive ? posColor1 : negColor1); + } + else { + if (value() < 0) { + gradient.setColorAt(0, negColor0); + gradient.setColorAt(1, negColor1); + } + else { + gradient.setColorAt(0, posColor0); + gradient.setColorAt(1, posColor1); + } + } + } + painter->setBrush(gradient); + painter->setPen(QPen(Qt::black, 0)); + painter->drawEllipse(boundingRect()); + + if (!image.isNull()) + painter->drawImage(boundingRect().adjusted(1,1,-1,-1), image); } - painter->setBrush(gradient); - painter->setPen(QPen(Qt::black, 0)); - painter->drawEllipse(-12, -12, 25, 25); - painter->setPen(QPen(Qt::white, 0)); - painter->drawText(-10, 3, QString().sprintf("%.2f", value())); + if (drawText) { + painter->setPen(QPen(drawNode ? Qt::white : Qt::black, 0)); + if (cmdNode) { + painter->drawText(0,4,text); + } + else { + painter->drawText( (value() < 0) ? -13 : -11, 4, text); + } + } } void Node::verticalMove(bool flag){ vertical = flag; } +void Node::commandNode(bool enable){ + cmdNode = enable; +} +void Node::commandText(QString text){ + cmdText = text; +} + double Node::value() { double h = graph->sceneRect().height(); double ratio = (h - pos().y()) / h; @@ -149,6 +187,10 @@ QVariant Node::itemChange(GraphicsItemChange change, const QVariant &val) void Node::mousePressEvent(QGraphicsSceneMouseEvent *event) { + if (cmdNode) { + graph->cmdActivated(this); + //return; + } update(); QGraphicsItem::mousePressEvent(event); } diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h index eca445d32..b2298c5bb 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h @@ -29,6 +29,7 @@ #define MIXERCURVEPOINT_H #include <QGraphicsItem> +#include <QColor> #include <QList> class Edge; @@ -48,8 +49,25 @@ public: enum { Type = UserType + 1 }; int type() const { return Type; } + void setName(QString name) { cmdName = name; } + const QString& getName() { return cmdName; } void verticalMove(bool flag); + void commandNode(bool enable); + void commandText(QString text); + int getCommandIndex() { return index; } + void setCommandIndex(int idx) { index = idx; } + + bool getCommandActive() { return cmdActive; } + void setCommandActive(bool enable) { cmdActive = enable; } + void setToggle(bool enable) { cmdToggle = enable; } + bool getToggle() { return cmdToggle; } + + void setPositiveColor(QString color0 = "#00ff00", QString color1 = "#00ff00") { posColor0 = color0; posColor1 = color1; } + void setNegativeColor(QString color0 = "#ff0000", QString color1 = "#ff0000") { negColor0 = color0; negColor1 = color1; } + void setImage(QImage img) { image = img; } + void setDrawNode(bool draw) { drawNode = draw; } + void setDrawText(bool draw) { drawText = draw; } QRectF boundingRect() const; QPainterPath shape() const; @@ -57,6 +75,9 @@ public: double value(); +signals: + void commandActivated(QString text); + protected: QVariant itemChange(GraphicsItemChange change, const QVariant &val); @@ -64,11 +85,24 @@ protected: void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); private: + QList<Edge *> edgeList; + QPointF newPos; + MixerCurveWidget* graph; + QString posColor0; + QString posColor1; + QString negColor0; + QString negColor1; + QImage image; - QList<Edge *> edgeList; - QPointF newPos; - MixerCurveWidget *graph; - bool vertical; + bool vertical; + QString cmdName; + bool cmdActive; + bool cmdNode; + bool cmdToggle; + QString cmdText; + bool drawNode; + bool drawText; + int index; }; diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp index a19692ff9..90a84f490 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp @@ -29,6 +29,7 @@ #include "mixercurveline.h" #include "mixercurvepoint.h" +#include <QObject> #include <QtGui> #include <QDebug> @@ -57,7 +58,6 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent) curveMin=0.0; curveMax=1.0; - setFrameStyle(QFrame::NoFrame); setStyleSheet("background:transparent"); @@ -73,7 +73,193 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent) scene->setSceneRect(plot->boundingRect()); setScene(scene); + posColor0 = "#1c870b"; //greenish? + posColor1 = "#116703"; //greenish? + negColor0 = "#ff0000"; //red + negColor1 = "#ff0000"; //red + + // commmand nodes + // reset + Node* node = getCommandNode(0); + node->setName("Reset"); + node->setToolTip("Reset Curve to Defaults"); + node->setToggle(false); + node->setPositiveColor("#ffffff", "#ffffff"); //white + node->setNegativeColor("#ffffff", "#ffffff"); + scene->addItem(node); + + // linear + node = getCommandNode(1); + node->setName("Linear"); + node->setToolTip("Generate a Linear Curve"); + QImage img = QImage(":/core/images/curve_linear.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText("/"); + + scene->addItem(node); + + // log + node = getCommandNode(2); + node->setName("Log"); + node->setToolTip("Generate a Logarithmic Curve"); + img = QImage(":/core/images/curve_log.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText("("); + scene->addItem(node); + + // exp + node = getCommandNode(3); + node->setName("Exp"); + node->setToolTip("Generate an Exponential Curve"); + img = QImage(":/core/images/curve_exp.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText(")"); + scene->addItem(node); + + // flat + node = getCommandNode(4); + node->setName("Flat"); + node->setToolTip("Generate a Flat Curve"); + img = QImage(":/core/images/curve_flat.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText("--"); + scene->addItem(node); + + // step + node = getCommandNode(5); + node->setName("Step"); + node->setToolTip("Generate a Stepped Curve"); + img = QImage(":/core/images/curve_step.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText("z"); + scene->addItem(node); + + + // curve min/max nodes + node = getCommandNode(6); + node->setName("MinPlus"); + node->setToolTip("Increase Curve Minimum"); + img = QImage(":/core/images/curve_plus.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText("+"); + node->setToggle(false); + node->setPositiveColor("#00aa00", "#00aa00"); //green + node->setNegativeColor("#00aa00", "#00aa00"); + scene->addItem(node); + + node = getCommandNode(7); + node->setName("MinMinus"); + node->setToolTip("Decrease Curve Minimum"); + img = QImage(":/core/images/curve_minus.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText("-"); + + node->setToggle(false); + node->setPositiveColor("#aa0000", "#aa0000"); //red + node->setNegativeColor("#aa0000", "#aa0000"); + scene->addItem(node); + + node = getCommandNode(8); + node->setName("MaxPlus"); + node->setToolTip("Increase Curve Maximum"); + img = QImage(":/core/images/curve_plus.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText("+"); + + node->setToggle(false); + node->setPositiveColor("#00aa00", "#00aa00"); //green + node->setNegativeColor("#00aa00", "#00aa00"); + scene->addItem(node); + + node = getCommandNode(9); + node->setName("MaxMinus"); + node->setToolTip("Decrease Curve Maximum"); + img = QImage(":/core/images/curve_plus.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText("-"); + + node->setToggle(false); + node->setPositiveColor("#aa0000", "#aa0000"); //red + node->setNegativeColor("#aa0000", "#aa0000"); + scene->addItem(node); + + node = getCommandNode(10); + node->setName("StepPlus"); + node->setToolTip("Increase Step/Power Value"); + img = QImage(":/core/images/curve_plus.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText("+"); + node->setToggle(false); + node->setPositiveColor("#00aa00", "#00aa00"); //green + node->setNegativeColor("#00aa00", "#00aa00"); + scene->addItem(node); + + node = getCommandNode(11); + node->setName("StepMinus"); + node->setToolTip("Decrease Step/Power Value"); + img = QImage(":/core/images/curve_minus.png"); + if (!img.isNull()) + node->setImage(img); + else + node->commandText("-"); + + node->setToggle(false); + node->setPositiveColor("#aa0000", "#aa0000"); //red + node->setNegativeColor("#aa0000", "#aa0000"); + scene->addItem(node); + + node = getCommandNode(12); + node->setName("StepValue"); + node->setDrawNode(false); + node->setToolTip("Current Step/Power Value"); + node->setToggle(false); + node->setPositiveColor("#0000aa", "#0000aa"); //blue + node->setNegativeColor("#0000aa", "#0000aa"); + scene->addItem(node); + + // commands toggle + node = getCommandNode(13); + node->setName("Commands"); + node->setToolTip("Toggle Command Buttons On/Off"); + node->setToggle(true); + node->setPositiveColor("#00aa00", "#00aa00"); //greenish + node->setNegativeColor("#000000", "#000000"); + scene->addItem(node); + + // popup + node = getCommandNode(14); + node->setName("Popup"); + node->setToolTip("Advanced Mode..."); + node->commandText(""); + node->setToggle(false); + node->setPositiveColor("#ff0000", "#ff0000"); //red + node->setNegativeColor("#ff0000", "#ff0000"); + scene->addItem(node); + + resizeCommands(); + initNodes(MixerCurveWidget::NODE_NUMELEM); + } MixerCurveWidget::~MixerCurveWidget() @@ -83,6 +269,31 @@ MixerCurveWidget::~MixerCurveWidget() while (!edgePool.isEmpty()) delete edgePool.takeFirst(); + + while (!cmdNodePool.isEmpty()) + delete cmdNodePool.takeFirst(); +} + +Node* MixerCurveWidget::getCommandNode(int index) +{ + Node* node; + + if (index >= 0 && index < cmdNodePool.count()) + { + node = cmdNodePool.at(index); + } + else { + node = new Node(this); + node->commandNode(true); + node->commandText(""); + node->setCommandIndex(index); + node->setActive(false); + node->setPositiveColor("#aaaa00", "#aaaa00"); + node->setNegativeColor("#1c870b", "#116703"); + cmdNodePool.append(node); + } + return node; + } Node* MixerCurveWidget::getNode(int index) @@ -99,7 +310,6 @@ Node* MixerCurveWidget::getNode(int index) } return node; } - Edge* MixerCurveWidget::getEdge(int index, Node* sourceNode, Node* destNode) { Edge* edge; @@ -117,6 +327,26 @@ Edge* MixerCurveWidget::getEdge(int index, Node* sourceNode, Node* destNode) return edge; } +void MixerCurveWidget::setPositiveColor(QString color0, QString color1) +{ + posColor0 = color0; + posColor1 = color1; + for (int i=0; i<nodePool.count(); i++) { + Node* node = nodePool.at(i); + node->setPositiveColor(color0, color1); + } +} +void MixerCurveWidget::setNegativeColor(QString color0, QString color1) +{ + negColor0 = color0; + negColor1 = color1; + for (int i=0; i<nodePool.count(); i++) { + Node* node = nodePool.at(i); + node->setNegativeColor(color0, color1); + } +} + + /** Init curve: create a (flat) curve with a specified number of points. @@ -185,7 +415,7 @@ QList<double> MixerCurveWidget::getCurve() { */ void MixerCurveWidget::initLinearCurve(int numPoints, double maxValue, double minValue) { - double range = setRange(minValue, maxValue); + double range = maxValue - minValue; // setRange(minValue, maxValue); QList<double> points; for (double i=0; i < (double)numPoints; i++) { @@ -220,12 +450,14 @@ void MixerCurveWidget::setCurve(const QList<double>* points) Node* node = nodeList.at(i); node->setPos(w*i, h - (val*h)); node->verticalMove(true); + + node->update(); } curveUpdating = false; update(); - emit curveUpdated(points, (double)0); + emit curveUpdated(); } @@ -235,32 +467,99 @@ void MixerCurveWidget::showEvent(QShowEvent *event) // Thit fitInView method should only be called now, once the // widget is shown, otherwise it cannot compute its values and // the result is usually a ahrsbargraph that is way too small. - fitInView(plot, Qt::KeepAspectRatio); + QRectF rect = plot->boundingRect(); + resizeCommands(); + fitInView(rect.adjusted(-15,-15,15,15), Qt::KeepAspectRatio); } void MixerCurveWidget::resizeEvent(QResizeEvent* event) { Q_UNUSED(event); - fitInView(plot, Qt::KeepAspectRatio); + + QRectF rect = plot->boundingRect(); + resizeCommands(); + fitInView(rect.adjusted(-15,-15,15,15), Qt::KeepAspectRatio); +} + +void MixerCurveWidget::resizeCommands() +{ + QRectF rect = plot->boundingRect(); + + Node* node; + //popup + node = getCommandNode(14); + node->setPos((rect.left() + rect.width() / 2) - 20, rect.height() + 10); + + //reset + node = getCommandNode(0); + node->setPos((rect.left() + rect.width() / 2) + 20, rect.height() + 10); + + //commands on/off + node = getCommandNode(13); + node->setPos(rect.right() - 15, rect.bottomRight().x() - 14); + + for (int i = 1; i<6; i++) { + node = getCommandNode(i); + + //bottom right of widget + node->setPos(rect.right() - 130 + (i * 18), rect.bottomRight().x() - 14); + } + + //curveminplus + node = getCommandNode(6); + node->setPos(rect.bottomLeft().x() + 15, rect.bottomLeft().y() - 10); + + //curveminminus + node = getCommandNode(7); + node->setPos(rect.bottomLeft().x() + 15, rect.bottomLeft().y() + 5); + + //curvemaxplus + node = getCommandNode(8); + node->setPos(rect.topRight().x() - 20, rect.topRight().y() - 7); + + //curvemaxminus + node = getCommandNode(9); + node->setPos(rect.topRight().x() - 20, rect.topRight().y() + 8); + + //stepplus + node = getCommandNode(10); + node->setPos(rect.bottomRight().x() - 40, rect.bottomRight().y() + 5); + + //stepminus + node = getCommandNode(11); + node->setPos(rect.bottomRight().x() - 40, rect.bottomRight().y() + 15); + + //step + node = getCommandNode(12); + node->setPos(rect.bottomRight().x() - 22, rect.bottomRight().y() + 9); } void MixerCurveWidget::itemMoved(double itemValue) { + Q_UNUSED(itemValue); + if (!curveUpdating) { - QList<double> curve = getCurve(); - emit curveUpdated(&curve, itemValue); + emit curveUpdated(); } } void MixerCurveWidget::setMin(double value) { + if (curveMin != value) + emit curveMinChanged(value); + curveMin = value; } + void MixerCurveWidget::setMax(double value) { + if (curveMax != value) + emit curveMaxChanged(value); + curveMax = value; } + double MixerCurveWidget::getMin() { return curveMin; @@ -275,3 +574,88 @@ double MixerCurveWidget::setRange(double min, double max) curveMax = max; return curveMax - curveMin; } + +Node* MixerCurveWidget::getCmdNode(const QString& name) +{ + Node* node = 0; + for (int i=0; i<cmdNodePool.count(); i++) { + Node* n = cmdNodePool.at(i); + if (n->getName() == name) + node = n; + } + return node; +} + +void MixerCurveWidget::setCommandText(const QString& name, const QString& text) +{ + for (int i=0; i<cmdNodePool.count(); i++) { + Node* n = cmdNodePool.at(i); + if (n->getName() == name) { + n->commandText(text); + n->update(); + } + } +} +void MixerCurveWidget::activateCommand(const QString& name) +{ + for (int i=1; i<cmdNodePool.count()-2; i++) { + Node* node = cmdNodePool.at(i); + node->setCommandActive(node->getName() == name); + node->update(); + } +} + +void MixerCurveWidget::showCommand(const QString& name, bool show) +{ + Node* node = getCmdNode(name); + if (node) { + if (show) + node->show(); + else + node->hide(); + } +} +void MixerCurveWidget::showCommands(bool show) +{ + for (int i=1; i<cmdNodePool.count()-2; i++) { + Node* node = cmdNodePool.at(i); + if (show) + node->show(); + else + node->hide(); + + node->update(); + } +} +bool MixerCurveWidget::isCommandActive(const QString& name) +{ + bool active = false; + Node* node = getCmdNode(name); + if (node) { + active = node->getCommandActive(); + } + return active; +} + +void MixerCurveWidget::cmdActivated(Node* node) +{ + if (node->getToggle()) { + if (node->getName() == "Commands") { + node->setCommandActive(!node->getCommandActive()); + showCommands(node->getCommandActive()); + } + else { + for (int i=1; i<cmdNodePool.count()-2; i++) { + Node* n = cmdNodePool.at(i); + n->setCommandActive(false); + n->update(); + } + + node->setCommandActive(true); + } + + } + node->update(); + emit commandActivated(node); +} + diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h index 031a70733..f2e8226cf 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h @@ -28,6 +28,7 @@ #ifndef MIXERCURVEWIDGET_H_ #define MIXERCURVEWIDGET_H_ +#include <QObject> #include <QGraphicsView> #include <QtSvg/QSvgRenderer> #include <QtSvg/QGraphicsSvgItem> @@ -43,6 +44,9 @@ class UAVOBJECTWIDGETUTILS_EXPORT MixerCurveWidget : public QGraphicsView public: MixerCurveWidget(QWidget *parent = 0); ~MixerCurveWidget(); + + friend class MixerCurve; + void itemMoved(double itemValue); // Callback when a point is moved, to be updated void initCurve (const QList<double>* points); QList<double> getCurve(); @@ -54,10 +58,22 @@ public: double getMax(); double setRange(double min, double max); + + void cmdActivated(Node* node); + void activateCommand(const QString& name); + bool isCommandActive(const QString& name); + void showCommand(const QString& name, bool show); + void showCommands(bool show); + Node* getCmdNode(const QString& name); + void setCommandText(const QString& name, const QString& text); + static const int NODE_NUMELEM = 5; signals: - void curveUpdated(const QList<double>* points, const double value); + void curveUpdated(); + void curveMinChanged(double value); + void curveMaxChanged(double value); + void commandActivated(Node* node); private slots: @@ -65,17 +81,27 @@ private: QGraphicsSvgItem *plot; QList<Node*> nodePool; + QList<Node*> cmdNodePool; QList<Edge*> edgePool; QList<Node*> nodeList; - QList<double> points; double curveMin; double curveMax; bool curveUpdating; + QString posColor0; + QString posColor1; + QString negColor0; + QString negColor1; + void initNodes(int numPoints); Node* getNode(int index); + Node* getCommandNode(int index); Edge* getEdge(int index, Node* sourceNode, Node* destNode); + void setPositiveColor(QString color0 = "#00ff00", QString color1 = "#00ff00"); + void setNegativeColor(QString color0 = "#ff0000", QString color1 = "#ff0000"); + + void resizeCommands(); protected: void showEvent(QShowEvent *event); diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/popupwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/popupwidget.cpp new file mode 100644 index 000000000..ca1af389b --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/popupwidget.cpp @@ -0,0 +1,65 @@ +#include "popupwidget.h" + +#include <QtGui> + +PopupWidget::PopupWidget(QWidget *parent) : + QDialog(parent) +{ + m_widget = 0; + + QVBoxLayout* mainLayout = new QVBoxLayout(); + + m_layout = new QHBoxLayout(); + mainLayout->addLayout(m_layout); + + QHBoxLayout* buttonLayout = new QHBoxLayout(); + + m_closeButton = new QPushButton(tr("Close")); + buttonLayout->addWidget(m_closeButton); + + mainLayout->addLayout(buttonLayout); + + setLayout(mainLayout); + + connect(m_closeButton,SIGNAL(clicked()), this, SLOT(close())); + connect(this, SIGNAL(accepted()),this,SLOT(close())); + connect(this,SIGNAL(rejected()), this, SLOT(close())); +} + +void PopupWidget::popUp(QWidget* widget) +{ + setWidget(widget); + exec(); +} + +void PopupWidget::setWidget(QWidget* widget) +{ + m_widget = widget; + m_widgetParent = widget->parentWidget(); + + m_layout->addWidget(m_widget); +} + +bool PopupWidget::close() +{ + closePopup(); + + return QDialog::close(); +} + +void PopupWidget::done(int result) +{ + closePopup(); + + QDialog::done(result); +} + +void PopupWidget::closePopup() +{ + if (m_widget && m_widgetParent) { + if(QGroupBox * w =qobject_cast<QGroupBox *>(m_widgetParent)) + { + w->layout()->addWidget(m_widget); + } + } +} diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/popupwidget.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/popupwidget.h new file mode 100644 index 000000000..a19a6650c --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/popupwidget.h @@ -0,0 +1,42 @@ +#ifndef POPUPWIDGET_H +#define POPUPWIDGET_H + +#include <QtGui> +#include <QWidget> +#include <QDialog> + + +#include "uavobjectwidgetutils_global.h" + +namespace Ui { +class PopupWidget; +} + +class UAVOBJECTWIDGETUTILS_EXPORT PopupWidget : public QDialog +{ + Q_OBJECT +public: + explicit PopupWidget(QWidget *parent = 0); + + void popUp(QWidget* widget = 0); + void setWidget(QWidget* widget); + QWidget* getWidget() { return m_widget; } + QHBoxLayout* getLayout() { return m_layout; } + +signals: + +public slots: + bool close(); + void done(int result); + +private slots: + void closePopup(); + +private: + QHBoxLayout* m_layout; + QWidget* m_widget; + QWidget* m_widgetParent; + QPushButton* m_closeButton; +}; + +#endif // POPUPWIDGET_H diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils.pro b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils.pro index caacc1e9c..cedaed7c3 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils.pro +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils.pro @@ -10,13 +10,17 @@ HEADERS += uavobjectwidgetutils_global.h \ mixercurvewidget.h \ mixercurvepoint.h \ mixercurveline.h \ - smartsavebutton.h + smartsavebutton.h \ + popupwidget.h SOURCES += uavobjectwidgetutilsplugin.cpp \ configtaskwidget.cpp \ mixercurvewidget.cpp \ mixercurvepoint.cpp \ mixercurveline.cpp \ - smartsavebutton.cpp + smartsavebutton.cpp \ + popupwidget.cpp OTHER_FILES += UAVObjectWidgetUtils.pluginspec + +FORMS +=