1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Implemented UI code for new ccpm options checkboxes and sliders

This commit is contained in:
Andrew Thoms 2011-06-12 00:17:32 -04:00
parent 86f5d63045
commit 6ad60a7971
3 changed files with 70 additions and 10 deletions

View File

@ -843,7 +843,7 @@
<number>3</number> <number>3</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QCheckBox" name="ccmpCollectivePassthrough"> <widget class="QCheckBox" name="ccpmCollectivePassthrough">
<property name="text"> <property name="text">
<string>Collective Pass through</string> <string>Collective Pass through</string>
</property> </property>
@ -870,12 +870,12 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_13"> <layout class="QHBoxLayout" name="ccpmCollectiveChannelBox">
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum> <enum>QLayout::SetMinimumSize</enum>
</property> </property>
<item> <item>
<widget class="QLabel" name="ccpmEngineLabel_2"> <widget class="QLabel" name="ccpmCollectiveChLabel">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -900,12 +900,15 @@
<property name="text"> <property name="text">
<string>Collective Ch</string> <string>Collective Ch</string>
</property> </property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="ccpmCollectiveChannel"> <widget class="QComboBox" name="ccpmCollectiveChannel">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -1003,7 +1006,7 @@
<item> <item>
<widget class="QSlider" name="ccpmRevoSlider"> <widget class="QSlider" name="ccpmRevoSlider">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"> <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
@ -1430,7 +1433,7 @@
<item> <item>
<widget class="QSlider" name="ccpmCyclicScale"> <widget class="QSlider" name="ccpmCyclicScale">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"> <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
@ -1548,7 +1551,7 @@
<item> <item>
<widget class="QSlider" name="ccpmRollScale"> <widget class="QSlider" name="ccpmRollScale">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"> <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
@ -1666,7 +1669,7 @@
<item> <item>
<widget class="QSlider" name="ccpmCollectiveScale"> <widget class="QSlider" name="ccpmCollectiveScale">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"> <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
@ -1784,7 +1787,7 @@
<item> <item>
<widget class="QSlider" name="ccpmPitchScale"> <widget class="QSlider" name="ccpmPitchScale">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"> <sizepolicy hsizetype="Fixed" vsizetype="Expanding">

View File

@ -185,6 +185,8 @@ ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : ConfigTaskWidget(parent)
m_ccpm->ccpmServoYChannel->setCurrentIndex(8); m_ccpm->ccpmServoYChannel->setCurrentIndex(8);
m_ccpm->ccpmServoZChannel->addItems(channels); m_ccpm->ccpmServoZChannel->addItems(channels);
m_ccpm->ccpmServoZChannel->setCurrentIndex(8); m_ccpm->ccpmServoZChannel->setCurrentIndex(8);
m_ccpm->ccpmCollectiveChannel->addItems(channels);
m_ccpm->ccpmCollectiveChannel->setCurrentIndex(8);
QStringList Types; QStringList Types;
Types << "CCPM 2 Servo 90º" << "CCPM 3 Servo 120º" << "CCPM 3 Servo 140º" << "FP 2 Servo 90º" << "Custom - User Angles" << "Custom - Advanced Settings" ; Types << "CCPM 2 Servo 90º" << "CCPM 3 Servo 120º" << "CCPM 3 Servo 140º" << "FP 2 Servo 90º" << "Custom - User Angles" << "Custom - Advanced Settings" ;
@ -197,6 +199,8 @@ ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : ConfigTaskWidget(parent)
//disable changing number of points in curves until UAVObjects have more than 5 //disable changing number of points in curves until UAVObjects have more than 5
m_ccpm->NumCurvePoints->setEnabled(0); m_ccpm->NumCurvePoints->setEnabled(0);
UpdateType(); UpdateType();
//connect(m_ccpm->saveccpmToSD, SIGNAL(clicked()), this, SLOT(saveccpmUpdate())); //connect(m_ccpm->saveccpmToSD, SIGNAL(clicked()), this, SLOT(saveccpmUpdate()));
@ -237,6 +241,12 @@ ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : ConfigTaskWidget(parent)
connect(m_ccpm->SwashLvlCancelButton, SIGNAL(clicked()), this, SLOT(SwashLvlCancelButtonPressed())); connect(m_ccpm->SwashLvlCancelButton, SIGNAL(clicked()), this, SLOT(SwashLvlCancelButtonPressed()));
connect(m_ccpm->SwashLvlFinishButton, SIGNAL(clicked()), this, SLOT(SwashLvlFinishButtonPressed())); connect(m_ccpm->SwashLvlFinishButton, SIGNAL(clicked()), this, SLOT(SwashLvlFinishButtonPressed()));
connect(m_ccpm->ccpmCollectivePassthrough, SIGNAL(clicked()), this, SLOT(UpdatCCPMUIOptions()));
connect(m_ccpm->ccpmLinkCyclic, SIGNAL(clicked()), this, SLOT(UpdatCCPMUIOptions()));
connect(m_ccpm->ccpmLinkRoll, SIGNAL(clicked()), this, SLOT(UpdatCCPMUIOptions()));
// connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestccpmUpdate())); // connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestccpmUpdate()));
@ -253,6 +263,7 @@ void ConfigccpmWidget::UpdateType()
QString TypeText; QString TypeText;
double AdjustmentAngle=0; double AdjustmentAngle=0;
UpdatCCPMUIOptions();
TypeInt = m_ccpm->ccpmType->count() - m_ccpm->ccpmType->currentIndex()-1; TypeInt = m_ccpm->ccpmType->count() - m_ccpm->ccpmType->currentIndex()-1;
TypeText = m_ccpm->ccpmType->currentText(); TypeText = m_ccpm->ccpmType->currentText();
@ -362,6 +373,9 @@ void ConfigccpmWidget::UpdateType()
m_ccpm->ccpmAdvancedSettingsTable->verticalHeader()->width())/6); m_ccpm->ccpmAdvancedSettingsTable->verticalHeader()->width())/6);
} }
//update UI //update UI
ccpmSwashplateUpdate(); ccpmSwashplateUpdate();
@ -827,6 +841,47 @@ void ConfigccpmWidget::UpdateMixer()
/************************** /**************************
* ccpm settings * ccpm settings
**************************/ **************************/
/*
Get the state of the UI check boxes and change the visibility of sliders
*/
void ConfigccpmWidget::UpdatCCPMUIOptions()
{
int ccpmCollectivePassthroughState;
int ccpmLinkCyclicState;
int ccpmLinkRollState;
//get the user options
ccpmCollectivePassthroughState=m_ccpm->ccpmCollectivePassthrough->isChecked();
ccpmLinkCyclicState=m_ccpm->ccpmLinkCyclic->isChecked();
ccpmLinkRollState=m_ccpm->ccpmLinkRoll->isChecked();
//set which sliders are user...
m_ccpm->ccpmRevoMixingBox->setVisible(0);
m_ccpm->ccpmPitchMixingBox->setVisible(!ccpmCollectivePassthroughState&&ccpmLinkCyclicState);
m_ccpm->ccpmCollectiveScalingBox->setVisible(ccpmCollectivePassthroughState||!ccpmLinkCyclicState);
m_ccpm->ccpmCollectiveChLabel->setVisible(ccpmCollectivePassthroughState);
m_ccpm->ccpmCollectiveChannel->setVisible(ccpmCollectivePassthroughState);
m_ccpm->ccpmCyclicScalingBox->setVisible((ccpmCollectivePassthroughState||!ccpmLinkCyclicState)&&ccpmLinkRollState);
if (ccpmLinkCyclicState)
{
m_ccpm->ccpmPitchScalingBox->setVisible(0);
m_ccpm->ccpmRollScalingBox->setVisible(0);
m_ccpm->ccpmLinkRoll->setVisible(0);
}
else
{
m_ccpm->ccpmPitchScalingBox->setVisible(!ccpmLinkRollState);
m_ccpm->ccpmRollScalingBox->setVisible(!ccpmLinkRollState);
m_ccpm->ccpmLinkRoll->setVisible(1);
}
}
/** /**
Request the current value of the SystemSettings which holds the ccpm type Request the current value of the SystemSettings which holds the ccpm type
*/ */

View File

@ -103,6 +103,8 @@ private:
void SwashLvlCancelButtonPressed(); void SwashLvlCancelButtonPressed();
void SwashLvlFinishButtonPressed(); void SwashLvlFinishButtonPressed();
void UpdatCCPMUIOptions();
void enableSwashplateLevellingControl(bool state); void enableSwashplateLevellingControl(bool state);
void setSwashplateLevel(int percent); void setSwashplateLevel(int percent);
void SwashLvlSpinBoxChanged(int value); void SwashLvlSpinBoxChanged(int value);