Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
a87e00e1
Commit
a87e00e1
authored
Aug 22, 2013
by
tstellanova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a real component ID when we know what it is
parent
a6fcb120
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
QGCUASParamManager.cc
src/uas/QGCUASParamManager.cc
+32
-1
QGCUASParamManager.h
src/uas/QGCUASParamManager.h
+4
-0
No files found.
src/uas/QGCUASParamManager.cc
View file @
a87e00e1
...
...
@@ -11,7 +11,8 @@ QGCUASParamManager::QGCUASParamManager(QObject *parent) :
QObject
(
parent
),
mav
(
NULL
),
paramDataModel
(
this
),
paramCommsMgr
(
NULL
)
paramCommsMgr
(
NULL
),
defaultComponentId
(
-
1
)
{
...
...
@@ -57,6 +58,27 @@ void QGCUASParamManager::clearAllPendingParams()
paramDataModel
.
clearAllPendingParams
();
}
int
QGCUASParamManager
::
getDefaultComponentId
()
{
int
result
=
0
;
if
(
-
1
!=
defaultComponentId
)
return
defaultComponentId
;
QList
<
int
>
components
=
getComponentForParam
(
"SYS_AUTOSTART"
);
//TODO is this the best way to find the right component?
// Guard against multiple components responding - this will never show in practice
if
(
1
==
components
.
count
())
{
result
=
components
.
first
();
defaultComponentId
=
result
;
}
qDebug
()
<<
"Default compId: "
<<
result
;
return
result
;
}
QList
<
int
>
QGCUASParamManager
::
getComponentForParam
(
const
QString
&
parameter
)
const
{
return
paramDataModel
.
getComponentForOnboardParam
(
parameter
);
...
...
@@ -95,6 +117,7 @@ void QGCUASParamManager::requestParameterListIfEmpty()
if
(
mav
)
{
int
totalOnboard
=
paramDataModel
.
countOnboardParams
();
if
(
totalOnboard
<
2
)
{
//TODO arbitrary constant, maybe 0 is OK?
defaultComponentId
=
-
1
;
//reset this ...we have no idea what the default component ID is
requestParameterList
();
}
}
...
...
@@ -108,6 +131,10 @@ void QGCUASParamManager::setParamDescriptions(const QMap<QString,QString>& param
void
QGCUASParamManager
::
setParameter
(
int
compId
,
QString
paramName
,
QVariant
value
)
{
if
((
0
==
compId
)
||
(
-
1
==
compId
))
{
//attempt to get an actual component ID
compId
=
getDefaultComponentId
();
}
paramDataModel
.
updatePendingParamWithValue
(
compId
,
paramName
,
value
);
}
...
...
@@ -121,6 +148,10 @@ void QGCUASParamManager::sendPendingParameters(bool persistAfterSend)
void
QGCUASParamManager
::
setPendingParam
(
int
compId
,
const
QString
&
paramName
,
const
QVariant
&
value
)
{
if
((
0
==
compId
)
||
(
-
1
==
compId
))
{
//attempt to get an actual component ID
compId
=
getDefaultComponentId
();
}
paramDataModel
.
updatePendingParamWithValue
(
compId
,
paramName
,
value
);
}
...
...
src/uas/QGCUASParamManager.h
View file @
a87e00e1
...
...
@@ -23,6 +23,9 @@ public:
/** @brief Get the known, confirmed value of a parameter */
virtual
bool
getParameterValue
(
int
component
,
const
QString
&
parameter
,
QVariant
&
value
)
const
;
/** @brief determine which component is the root component for the UAS and return its ID or 0 if unknown */
virtual
int
getDefaultComponentId
();
/**
* @brief Get a list of all component IDs using this parameter name
* @param parameter The string encoding the parameter name
...
...
@@ -122,6 +125,7 @@ protected:
UASInterface
*
mav
;
///< The MAV this manager is controlling
UASParameterDataModel
paramDataModel
;
///< Shared data model of parameters
UASParameterCommsMgr
*
paramCommsMgr
;
///< Shared comms mgr for parameters
int
defaultComponentId
;
///< Cached default component ID
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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