From d6801ac6bb9aab27bab0703fda75a8e4a1dfc17f Mon Sep 17 00:00:00 2001 From: tstellanova Date: Thu, 15 Aug 2013 20:50:20 -0700 Subject: [PATCH] fix rendering of advanced parameters editors --- src/ui/QGCBaseParamWidget.cc | 34 ++++++++++++++++++---------------- src/ui/QGCPX4VehicleConfig.cc | 18 ++++++++++-------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/ui/QGCBaseParamWidget.cc b/src/ui/QGCBaseParamWidget.cc index baaa080..d80e536 100644 --- a/src/ui/QGCBaseParamWidget.cc +++ b/src/ui/QGCBaseParamWidget.cc @@ -25,22 +25,24 @@ QGCBaseParamWidget* QGCBaseParamWidget::initWithUAS(UASInterface *uas) void QGCBaseParamWidget::setUAS(UASInterface* uas) { - if (mav) { - //TODO disconnect any connections as needed - disconnectViewSignalsAndSlots(); - disconnectFromParamManager(); - clearOnboardParamDisplay(); - clearPendingParamDisplay(); - } - - mav = uas; - - if (mav) { - connectToParamManager(); - connectViewSignalsAndSlots(); - layoutWidget(); - - paramMgr->requestParameterListIfEmpty(); + if (uas != mav) { + if (mav) { + //TODO disconnect any connections as needed + disconnectViewSignalsAndSlots(); + disconnectFromParamManager(); + clearOnboardParamDisplay(); + clearPendingParamDisplay(); + } + + mav = uas; + + if (mav) { + connectToParamManager(); + connectViewSignalsAndSlots(); + layoutWidget(); + + paramMgr->requestParameterListIfEmpty(); + } } } diff --git a/src/ui/QGCPX4VehicleConfig.cc b/src/ui/QGCPX4VehicleConfig.cc index 1c9b768..2a5772a 100644 --- a/src/ui/QGCPX4VehicleConfig.cc +++ b/src/ui/QGCPX4VehicleConfig.cc @@ -84,15 +84,16 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : //connect(ui->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions())); //TODO connect buttons here to save/clear actions? - mav = UASManager::instance()->getActiveUAS(); - if (!mav) { - qWarning() << "No active mav! "; - } - else { - ui->pendingCommitsWidget->initWithUAS(mav); + UASInterface* tmpMav = UASManager::instance()->getActiveUAS(); + if (tmpMav) { + ui->pendingCommitsWidget->initWithUAS(tmpMav); ui->pendingCommitsWidget->update(); + setActiveUAS(tmpMav); } + connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), + this, SLOT(setActiveUAS(UASInterface*))); + //TODO the following methods are not yet implemented // Connect RC mapping assignments @@ -115,9 +116,9 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : // connect(ui->invertCheckBox_7, SIGNAL(clicked(bool)), this, SLOT(setAux2Inverted(bool))); // connect(ui->invertCheckBox_8, SIGNAL(clicked(bool)), this, SLOT(setAux3Inverted(bool))); - connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); - setActiveUAS(UASManager::instance()->getActiveUAS()); + + for (unsigned int i = 0; i < chanMax; i++) { rcValue[i] = UINT16_MAX; @@ -1248,6 +1249,7 @@ void QGCPX4VehicleConfig::parameterChanged(int uas, int component, QString param return; } + //TODO this may introduce a bug with param editor widgets not receiving param updates if (parameterName.startsWith("RC")) { handleRcParameterChange(parameterName,value); return;