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
#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
}
_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
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);
......
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