Commit 7b6cb5c1 authored by Don Gagne's avatar Don Gagne

Make sure spurious parameter updates don't break waiting timeouts

parent c785760e
...@@ -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 #if 0
// Handy for testing retry logic // Handy for testing retry logic
static int counter = 0; static int counter = 0;
if (counter++ & 0x3) { if (counter++ & 0x8) {
qCDebug(ParameterLoaderLog) << "Artificial discard" << counter; qCDebug(ParameterLoaderLog) << "Artificial discard" << counter;
return; 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(); _dataMutex.lock();
// Restart our waiting for param timer
_waitingParamTimeoutTimer.start();
// Update our total parameter counts // Update our total parameter counts
if (!_paramCountMap.contains(componentId)) { if (!_paramCountMap.contains(componentId)) {
_paramCountMap[componentId] = parameterCount; _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; 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 // Remove this parameter from the waiting lists
_waitingReadParamIndexMap[componentId].remove(parameterId); _waitingReadParamIndexMap[componentId].remove(parameterId);
_waitingReadParamNameMap[componentId].remove(parameterName); _waitingReadParamNameMap[componentId].remove(parameterName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment