From 6ad60a79716621542df9313bc524d56a7fb05f9d Mon Sep 17 00:00:00 2001 From: Andrew Thoms Date: Sun, 12 Jun 2011 00:17:32 -0400 Subject: [PATCH] Implemented UI code for new ccpm options checkboxes and sliders --- .../openpilotgcs/src/plugins/config/ccpm.ui | 21 ++++--- .../src/plugins/config/configccpmwidget.cpp | 57 ++++++++++++++++++- .../src/plugins/config/configccpmwidget.h | 2 + 3 files changed, 70 insertions(+), 10 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/ccpm.ui b/ground/openpilotgcs/src/plugins/config/ccpm.ui index 2048c95fb..4242e1ff8 100644 --- a/ground/openpilotgcs/src/plugins/config/ccpm.ui +++ b/ground/openpilotgcs/src/plugins/config/ccpm.ui @@ -843,7 +843,7 @@ 3 - + Collective Pass through @@ -870,12 +870,12 @@ - + QLayout::SetMinimumSize - + false @@ -900,12 +900,15 @@ Collective Ch + + true + - false + true @@ -1003,7 +1006,7 @@ - false + true @@ -1430,7 +1433,7 @@ - false + true @@ -1548,7 +1551,7 @@ - false + true @@ -1666,7 +1669,7 @@ - false + true @@ -1784,7 +1787,7 @@ - false + true diff --git a/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp b/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp index ea4078b52..b3c77bf73 100644 --- a/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp @@ -185,6 +185,8 @@ ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : ConfigTaskWidget(parent) m_ccpm->ccpmServoYChannel->setCurrentIndex(8); m_ccpm->ccpmServoZChannel->addItems(channels); m_ccpm->ccpmServoZChannel->setCurrentIndex(8); + m_ccpm->ccpmCollectiveChannel->addItems(channels); + m_ccpm->ccpmCollectiveChannel->setCurrentIndex(8); 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" ; @@ -196,6 +198,8 @@ ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : ConfigTaskWidget(parent) //disable changing number of points in curves until UAVObjects have more than 5 m_ccpm->NumCurvePoints->setEnabled(0); + + UpdateType(); @@ -237,7 +241,13 @@ ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : ConfigTaskWidget(parent) connect(m_ccpm->SwashLvlCancelButton, SIGNAL(clicked()), this, SLOT(SwashLvlCancelButtonPressed())); 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())); } @@ -253,7 +263,8 @@ void ConfigccpmWidget::UpdateType() QString TypeText; double AdjustmentAngle=0; - + UpdatCCPMUIOptions(); + TypeInt = m_ccpm->ccpmType->count() - m_ccpm->ccpmType->currentIndex()-1; TypeText = m_ccpm->ccpmType->currentText(); SingleServoIndex = m_ccpm->ccpmSingleServo->currentIndex(); @@ -362,6 +373,9 @@ void ConfigccpmWidget::UpdateType() m_ccpm->ccpmAdvancedSettingsTable->verticalHeader()->width())/6); } + + + //update UI ccpmSwashplateUpdate(); @@ -827,6 +841,47 @@ void ConfigccpmWidget::UpdateMixer() /************************** * 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 */ diff --git a/ground/openpilotgcs/src/plugins/config/configccpmwidget.h b/ground/openpilotgcs/src/plugins/config/configccpmwidget.h index 21b4e1b38..7eb95a5f1 100644 --- a/ground/openpilotgcs/src/plugins/config/configccpmwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configccpmwidget.h @@ -103,6 +103,8 @@ private: void SwashLvlCancelButtonPressed(); void SwashLvlFinishButtonPressed(); + void UpdatCCPMUIOptions(); + void enableSwashplateLevellingControl(bool state); void setSwashplateLevel(int percent); void SwashLvlSpinBoxChanged(int value);