Commit e59f0045 authored by Don Gagne's avatar Don Gagne

Try initial request 5 times max

Also don’t pop errors for initial request failure on generic vehicle.
parent 727c55fe
......@@ -47,6 +47,7 @@ ParameterLoader::ParameterLoader(Vehicle* vehicle)
, _defaultComponentId(MAV_COMP_ID_ALL)
, _parameterSetMajorVersion(-1)
, _parameterMetaData(NULL)
, _initialRequestRetryCount(0)
, _totalParamCount(0)
{
Q_ASSERT(_vehicle);
......@@ -490,7 +491,7 @@ void ParameterLoader::_waitingParamTimeout(void)
foreach(int componentId, _waitingReadParamIndexMap.keys()) {
foreach(int paramIndex, _waitingReadParamIndexMap[componentId].keys()) {
_waitingReadParamIndexMap[componentId][paramIndex]++; // Bump retry count
if (_waitingReadParamIndexMap[componentId][paramIndex] > _maxInitialLoadRetry) {
if (_waitingReadParamIndexMap[componentId][paramIndex] > _maxInitialLoadRetrySingleParam) {
// Give up on this index
_failedReadParamIndexMap[componentId] << paramIndex;
qCDebug(ParameterLoaderLog) << "Giving up on (componentId:" << componentId << "paramIndex:" << paramIndex << "retryCount:" << _waitingReadParamIndexMap[componentId][paramIndex] << ")";
......@@ -978,9 +979,14 @@ void ParameterLoader::_checkInitialLoadComplete(bool failIfNoDefaultComponent)
void ParameterLoader::_initialRequestTimeout(void)
{
qgcApp()->showMessage("Vehicle did not respond to request for parameters, retrying");
refreshAllParameters();
_initialRequestTimeoutTimer.start();
if (!_vehicle->genericFirmware()) {
// Generic vehicles (like BeBop) may not have any parameters, so don't annoy the user
qgcApp()->showMessage("Vehicle did not respond to request for parameters, retrying");
}
if (++_initialRequestRetryCount <= _maxInitialRequestListRetry) {
refreshAllParameters();
_initialRequestTimeoutTimer.start();
}
}
QString ParameterLoader::parameterMetaDataFile(MAV_AUTOPILOT firmwareType, int wantedMajorVersion, int& majorVersion, int& minorVersion)
......
......@@ -151,8 +151,10 @@ private:
int _parameterSetMajorVersion; ///< Version for parameter set, -1 if not known
QObject* _parameterMetaData; ///< Opaque data from FirmwarePlugin::loadParameterMetaDataCall
static const int _maxInitialLoadRetry = 10; ///< Maximum retries for initial index based load
static const int _maxReadWriteRetry = 5; ///< Maximum retries read/write
static const int _maxInitialRequestListRetry = 5; ///< Maximum retries for request list
int _initialRequestRetryCount; ///< Current retry count for request list
static const int _maxInitialLoadRetrySingleParam = 10; ///< Maximum retries for initial index based load of a single param
static const int _maxReadWriteRetry = 5; ///< Maximum retries read/write
QMap<int, int> _paramCountMap; ///< Key: Component id, Value: count of parameters in this component
QMap<int, QMap<int, int> > _waitingReadParamIndexMap; ///< Key: Component id, Value: Map { Key: parameter index still waiting for, Value: retry count }
......
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