Skip to content

Commit

Permalink
Camera Gimbal: Fixes #440 Makes sure parameters are not reset and are…
Browse files Browse the repository at this point in the history
… up to date.

- Also fixes tab order in view
  • Loading branch information
billbonney committed Sep 26, 2014
1 parent e5c2cce commit 7cb7f98
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/ui/configuration/CameraGimbalConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,16 @@ void CameraGimbalConfig::addTriggerTypes(QComboBox *comboBox)
void CameraGimbalConfig::activeUASSet(UASInterface *uas)
{
AP2ConfigWidget::activeUASSet(uas);
if (!uas) return;
}

void CameraGimbalConfig::showEvent(QShowEvent *)
{
requestParameterUpdate();
}

void CameraGimbalConfig::requestParameterUpdate()
{
if (!m_uas) return;
// The List of Params we care about

for (int channelCount=5; channelCount <= 11; ++channelCount) {
Expand Down Expand Up @@ -259,10 +268,10 @@ void CameraGimbalConfig::activeUASSet(UASInterface *uas)

qDebug() << "cameraParams" << m_cameraParams;

// QGCUASParamManager *pm = m_uas->getParamManager();
// foreach(QString parameter, m_cameraParams) {
// pm->requestParameterUpdate(1, parameter);
// };
QGCUASParamManager *pm = m_uas->getParamManager();
foreach(QString parameter, m_cameraParams) {
pm->requestParameterUpdate(1, parameter);
};
}

void CameraGimbalConfig::updateRetractAngles()
Expand Down Expand Up @@ -458,7 +467,7 @@ CameraGimbalConfig::~CameraGimbalConfig()
void CameraGimbalConfig::refreshMountParameters(QString mount, QString parameterName, QVariant &value)
{
qDebug() << "refresh parameters " << mount;

disconnectSignals();
if (parameterName == "MNT_ANGMIN_TIL") //TILT
{
ui.tiltAngleMinSpinBox->setValue(value.toInt() / 100.0);
Expand Down Expand Up @@ -498,7 +507,7 @@ void CameraGimbalConfig::refreshMountParameters(QString mount, QString parameter
int index = ui.panInputChannelComboBox->findData(value.toInt());
ui.panInputChannelComboBox->setCurrentIndex(index);
}

connectSignals();
}

void CameraGimbalConfig::refreshCameraTriggerParameters(QString parameterName, QVariant value)
Expand Down
2 changes: 2 additions & 0 deletions src/ui/configuration/CameraGimbalConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class CameraGimbalConfig : public AP2ConfigWidget
public:
explicit CameraGimbalConfig(QWidget *parent = 0);
~CameraGimbalConfig();
void showEvent(QShowEvent *);

public slots:
void activeUASSet(UASInterface *uas);
Expand Down Expand Up @@ -108,6 +109,7 @@ private slots:
QComboBox *outputChCombo, QComboBox* inputChCombo,
QSpinBox* servoMin, QSpinBox* servoMax, QCheckBox* servoReverse,
QSpinBox* angleMin, QSpinBox* angleMax);
void requestParameterUpdate();

private:
Ui::CameraGimbalConfig ui;
Expand Down
43 changes: 43 additions & 0 deletions src/ui/configuration/CameraGimbalConfig.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,49 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>scrollArea</tabstop>
<tabstop>tiltChannelComboBox</tabstop>
<tabstop>tiltStabilizeCheckBox</tabstop>
<tabstop>tiltServoMinSpinBox</tabstop>
<tabstop>tiltServoMaxSpinBox</tabstop>
<tabstop>tiltReverseCheckBox</tabstop>
<tabstop>tiltAngleMinSpinBox</tabstop>
<tabstop>tiltAngleMaxSpinBox</tabstop>
<tabstop>tiltInputChannelComboBox</tabstop>
<tabstop>rollChannelComboBox</tabstop>
<tabstop>rollStabilizeCheckBox</tabstop>
<tabstop>rollServoMinSpinBox</tabstop>
<tabstop>rollServoMaxSpinBox</tabstop>
<tabstop>rollReverseCheckBox</tabstop>
<tabstop>rollAngleMinSpinBox</tabstop>
<tabstop>rollAngleMaxSpinBox</tabstop>
<tabstop>rollInputChannelComboBox</tabstop>
<tabstop>panChannelComboBox</tabstop>
<tabstop>panStabilizeCheckBox</tabstop>
<tabstop>panServoMinSpinBox</tabstop>
<tabstop>panServoMaxSpinBox</tabstop>
<tabstop>panReverseCheckBox</tabstop>
<tabstop>panAngleMinSpinBox</tabstop>
<tabstop>panAngleMaxSpinBox</tabstop>
<tabstop>panInputChannelComboBox</tabstop>
<tabstop>camTriggerOutChannelComboBox</tabstop>
<tabstop>camTriggerServoMinSpinBox</tabstop>
<tabstop>camTriggerServoMaxSpinBox</tabstop>
<tabstop>camTriggerOnPwmSpinBox</tabstop>
<tabstop>camTriggerOffPwmSpinBox</tabstop>
<tabstop>camTriggerDurationSpinBox</tabstop>
<tabstop>retractXSpinBox</tabstop>
<tabstop>retractYSpinBox</tabstop>
<tabstop>retractZSpinBox</tabstop>
<tabstop>neutralXSpinBox</tabstop>
<tabstop>neutralYSpinBox</tabstop>
<tabstop>neutralZSpinBox</tabstop>
<tabstop>controlXSpinBox</tabstop>
<tabstop>controlYSpinBox</tabstop>
<tabstop>controlZSpinBox</tabstop>
<tabstop>camTriggerTypeComboBox</tabstop>
</tabstops>
<resources>
<include location="../../../qgroundcontrol.qrc"/>
</resources>
Expand Down

0 comments on commit 7cb7f98

Please sign in to comment.