Browse Source

Make sure spurious parameter updates don't break waiting timeouts

QGC4.4
Don Gagne 9 years ago
parent
commit
7b6cb5c1da
  1. 13
      src/FactSystem/ParameterLoader.cc

13
src/FactSystem/ParameterLoader.cc

@ -112,7 +112,7 @@ void ParameterLoader::_parameterUpdate(int uasId, int componentId, QString param @@ -112,7 +112,7 @@ void ParameterLoader::_parameterUpdate(int uasId, int componentId, QString param
#if 0
// Handy for testing retry logic
static int counter = 0;
if (counter++ & 0x3) {
if (counter++ & 0x8) {
qCDebug(ParameterLoaderLog) << "Artificial discard" << counter;
return;
}
@ -132,9 +132,6 @@ void ParameterLoader::_parameterUpdate(int uasId, int componentId, QString param @@ -132,9 +132,6 @@ void ParameterLoader::_parameterUpdate(int uasId, int componentId, QString param
}
_dataMutex.lock();
// Restart our waiting for param timer
_waitingParamTimeoutTimer.start();
// Update our total parameter counts
if (!_paramCountMap.contains(componentId)) {
_paramCountMap[componentId] = parameterCount;
@ -170,6 +167,14 @@ void ParameterLoader::_parameterUpdate(int uasId, int componentId, QString param @@ -170,6 +167,14 @@ void ParameterLoader::_parameterUpdate(int uasId, int componentId, QString param
componentParamsComplete = true;
}
if (_waitingReadParamIndexMap[componentId].contains(parameterId) ||
_waitingReadParamNameMap[componentId].contains(parameterName) ||
_waitingWriteParamNameMap[componentId].contains(parameterName)) {
// We were waiting for this parameter, restart wait timer. Otherwise it is a spurious parameter update which
// means we should not reset the wait timer.
_waitingParamTimeoutTimer.start();
}
// Remove this parameter from the waiting lists
_waitingReadParamIndexMap[componentId].remove(parameterId);
_waitingReadParamNameMap[componentId].remove(parameterName);

Loading…
Cancel
Save