diff --git a/src/uas/QGCMAVLinkUASFactory.cc b/src/uas/QGCMAVLinkUASFactory.cc index 190b7ce16ce733003af384249010891d7c570539..39df612c3ec3cfc0c3cb0a74a75577439c7bb550 100644 --- a/src/uas/QGCMAVLinkUASFactory.cc +++ b/src/uas/QGCMAVLinkUASFactory.cc @@ -78,8 +78,11 @@ UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInte // Make UAS aware that this link can be used to communicate with the actual robot uas->addLink(link); + // First thing we do with a new UAS is get the parameters + uas->requestParameters(); + // Now add UAS to "official" list, which makes the whole application aware of it UASManager::instance()->addUAS(uas); - + return uas; } diff --git a/src/ui/QGCBaseParamWidget.cc b/src/ui/QGCBaseParamWidget.cc index eda71c278c98a0e86f26c5265bdcde93d3e39dee..35e868518a6f5beb120a698da2dca0865a19a7b0 100644 --- a/src/ui/QGCBaseParamWidget.cc +++ b/src/ui/QGCBaseParamWidget.cc @@ -40,8 +40,6 @@ void QGCBaseParamWidget::setUAS(UASInterface* uas) connectToParamManager(); connectViewSignalsAndSlots(); layoutWidget(); - - paramMgr->requestParameterListIfEmpty(); } } @@ -62,6 +60,9 @@ void QGCBaseParamWidget::connectToParamManager() // Listen for param list reload finished connect(paramMgr, SIGNAL(parameterListUpToDate()), this, SLOT(handleOnboardParameterListUpToDate())); + if (paramMgr->parametersReady()) { + handleOnboardParameterListUpToDate(); + } // Listen to communications status messages so we can display them connect(paramMgr, SIGNAL(parameterStatusMsgUpdated(QString,int)), diff --git a/src/ui/QGCParamWidget.cc b/src/ui/QGCParamWidget.cc index a995726506457e9a095ee7d6c1f8510e84471f4d..d0ab5349acf92332ad6710125c1020d53f1e868a 100644 --- a/src/ui/QGCParamWidget.cc +++ b/src/ui/QGCParamWidget.cc @@ -51,7 +51,8 @@ QGCParamWidget::QGCParamWidget(QWidget *parent) : QGCBaseParamWidget(parent), componentItems(new QMap()), statusLabel(new QLabel(this)), - tree(new QTreeWidget(this)) + tree(new QTreeWidget(this)), + _fullParamListLoaded(false) { @@ -236,9 +237,15 @@ void QGCParamWidget::handleOnboardParamUpdate(int compId, const QString& paramNa void QGCParamWidget::handleOnboardParameterListUpToDate() { + // Don't load full param list more than once + if (_fullParamListLoaded) { + return; + } + + _fullParamListLoaded = true; + //turn off updates while we refresh the entire list tree->setUpdatesEnabled(false); - qDebug() << "WARN: LIST UPDATE"; //rewrite the component item tree after receiving the full list QMap*>::iterator i; diff --git a/src/ui/QGCParamWidget.h b/src/ui/QGCParamWidget.h index 5581c5f2c8c4a66cc4c7f69c47c6b2e3d685669f..5db5a6fd3ed76f372456bcafbbc4bb8b2fbf7dd0 100644 --- a/src/ui/QGCParamWidget.h +++ b/src/ui/QGCParamWidget.h @@ -104,7 +104,9 @@ protected: QLabel* statusLabel; ///< User-facing parameter status label QTreeWidget* tree; ///< The parameter tree QStringList _filterList; - + +private: + bool _fullParamListLoaded; }; #endif // QGCPARAMWIDGET_H