Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
e59f0045
Commit
e59f0045
authored
Jun 13, 2016
by
Don Gagne
Browse files
Try initial request 5 times max
Also don’t pop errors for initial request failure on generic vehicle.
parent
727c55fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/FactSystem/ParameterLoader.cc
View file @
e59f0045
...
...
@@ -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
]
>
_maxInitialLoadRetry
SingleParam
)
{
// 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
)
...
...
src/FactSystem/ParameterLoader.h
View file @
e59f0045
...
...
@@ -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 }
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment