From dec4ee1f1b40159274aa17e23b91c374af2d273b Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Thu, 10 Aug 2017 12:52:21 -0400 Subject: [PATCH] Postpone parameter updates for a bit. --- src/Camera/QGCCameraControl.cc | 17 ++++++++++++++++- src/Camera/QGCCameraControl.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Camera/QGCCameraControl.cc b/src/Camera/QGCCameraControl.cc index 11b25c3a0..17c3b55b0 100644 --- a/src/Camera/QGCCameraControl.cc +++ b/src/Camera/QGCCameraControl.cc @@ -984,9 +984,24 @@ QGCCameraControl::_updateRanges(Fact* pFact) //-- Parameter update requests if(_requestUpdates.contains(pFact->name())) { foreach(QString param, _requestUpdates[pFact->name()]) { - _paramIO[param]->paramRequest(); + if(!_updatesToRequest.contains(param)) { + _updatesToRequest << param; + } } } + if(_updatesToRequest.size()) { + QTimer::singleShot(500, this, &QGCCameraControl::_requestParamUpdates); + } +} + +//----------------------------------------------------------------------------- +void +QGCCameraControl::_requestParamUpdates() +{ + foreach(QString param, _updatesToRequest) { + _paramIO[param]->paramRequest(); + } + _updatesToRequest.clear(); } //----------------------------------------------------------------------------- diff --git a/src/Camera/QGCCameraControl.h b/src/Camera/QGCCameraControl.h index b5ebb54ea..2881601f6 100644 --- a/src/Camera/QGCCameraControl.h +++ b/src/Camera/QGCCameraControl.h @@ -166,6 +166,7 @@ private slots: void _initWhenReady (); void _requestCameraSettings (); void _requestAllParameters (); + void _requestParamUpdates (); void _requestCaptureStatus (); void _requestStorageInfo (); void _downloadFinished (); @@ -219,4 +220,5 @@ protected: int _captureInfoRetries; //-- Parameters that require a full update QMap _requestUpdates; + QStringList _updatesToRequest; }; -- 2.22.0