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
3319dc65
Commit
3319dc65
authored
Aug 09, 2013
by
tstellanova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move sendPendingParams
parent
4c79a3f2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
50 deletions
+56
-50
QGCUASParamManager.cc
src/uas/QGCUASParamManager.cc
+6
-0
QGCUASParamManager.h
src/uas/QGCUASParamManager.h
+3
-0
UASParameterCommsMgr.cc
src/uas/UASParameterCommsMgr.cc
+20
-16
UASParameterCommsMgr.h
src/uas/UASParameterCommsMgr.h
+1
-1
QGCParamWidget.cc
src/ui/QGCParamWidget.cc
+25
-28
QGCParamWidget.h
src/ui/QGCParamWidget.h
+1
-5
No files found.
src/uas/QGCUASParamManager.cc
View file @
3319dc65
...
@@ -70,6 +70,12 @@ void QGCUASParamManager::setParameter(int component, QString parameterName, QVar
...
@@ -70,6 +70,12 @@ void QGCUASParamManager::setParameter(int component, QString parameterName, QVar
paramCommsMgr
->
setParameter
(
component
,
parameterName
,
value
);
paramCommsMgr
->
setParameter
(
component
,
parameterName
,
value
);
}
}
void
QGCUASParamManager
::
sendPendingParameters
()
{
paramCommsMgr
->
sendPendingParameters
();
}
void
QGCUASParamManager
::
loadParamMetaInfoCSV
()
void
QGCUASParamManager
::
loadParamMetaInfoCSV
()
{
{
...
...
src/uas/QGCUASParamManager.h
View file @
3319dc65
...
@@ -46,6 +46,9 @@ public slots:
...
@@ -46,6 +46,9 @@ public slots:
/** @brief Send one parameter to the MAV: changes value in transient memory of MAV */
/** @brief Send one parameter to the MAV: changes value in transient memory of MAV */
virtual
void
setParameter
(
int
component
,
QString
parameterName
,
QVariant
value
);
virtual
void
setParameter
(
int
component
,
QString
parameterName
,
QVariant
value
);
/** @brief Send all pending parameters to the MAV, for storage in transient (RAM) memory */
virtual
void
sendPendingParameters
();
/** @brief Request list of parameters from MAV */
/** @brief Request list of parameters from MAV */
virtual
void
requestParameterList
();
virtual
void
requestParameterList
();
...
...
src/uas/UASParameterCommsMgr.cc
View file @
3319dc65
...
@@ -100,25 +100,23 @@ void UASParameterCommsMgr::requestParameterList()
...
@@ -100,25 +100,23 @@ void UASParameterCommsMgr::requestParameterList()
Empty read retransmission list
Empty read retransmission list
Empty write retransmission list
Empty write retransmission list
*/
*/
void
UASParameterCommsMgr
::
clearRetransmissionLists
()
void
UASParameterCommsMgr
::
clearRetransmissionLists
(
int
&
missingReadCount
,
int
&
missingWriteCount
)
{
{
qDebug
()
<<
__FILE__
<<
__LINE__
<<
"clearRetransmissionLists"
;
qDebug
()
<<
__FILE__
<<
__LINE__
<<
"clearRetransmissionLists"
;
int
missingReadCount
=
0
;
missingReadCount
=
0
;
QList
<
int
>
readKeys
=
transmissionMissingPackets
.
keys
();
QList
<
int
>
readKeys
=
transmissionMissingPackets
.
keys
();
foreach
(
int
component
,
readKeys
)
{
foreach
(
int
component
,
readKeys
)
{
missingReadCount
+=
transmissionMissingPackets
.
value
(
component
)
->
count
();
missingReadCount
+=
transmissionMissingPackets
.
value
(
component
)
->
count
();
transmissionMissingPackets
.
value
(
component
)
->
clear
();
transmissionMissingPackets
.
value
(
component
)
->
clear
();
}
}
int
missingWriteCount
=
0
;
missingWriteCount
=
0
;
QList
<
int
>
writeKeys
=
transmissionMissingWriteAckPackets
.
keys
();
QList
<
int
>
writeKeys
=
transmissionMissingWriteAckPackets
.
keys
();
foreach
(
int
component
,
writeKeys
)
{
foreach
(
int
component
,
writeKeys
)
{
missingWriteCount
+=
transmissionMissingWriteAckPackets
.
value
(
component
)
->
count
();
missingWriteCount
+=
transmissionMissingWriteAckPackets
.
value
(
component
)
->
count
();
transmissionMissingWriteAckPackets
.
value
(
component
)
->
clear
();
transmissionMissingWriteAckPackets
.
value
(
component
)
->
clear
();
}
}
setParameterStatusMsg
(
tr
(
"TIMEOUT! MISSING: %1 read, %2 write."
).
arg
(
missingReadCount
).
arg
(
missingWriteCount
),
ParamCommsStatusLevel_Warning
);
}
}
...
@@ -230,7 +228,6 @@ void UASParameterCommsMgr::retransmissionGuardTick()
...
@@ -230,7 +228,6 @@ void UASParameterCommsMgr::retransmissionGuardTick()
return
;
return
;
}
}
qDebug
()
<<
__FILE__
<<
__LINE__
<<
"RETRANSMISSION GUARD ACTIVE, CHECKING FOR DROPS.."
;
// Check for timeout
// Check for timeout
// stop retransmission attempts on timeout
// stop retransmission attempts on timeout
...
@@ -238,10 +235,17 @@ void UASParameterCommsMgr::retransmissionGuardTick()
...
@@ -238,10 +235,17 @@ void UASParameterCommsMgr::retransmissionGuardTick()
setRetransmissionGuardEnabled
(
false
);
setRetransmissionGuardEnabled
(
false
);
transmissionActive
=
false
;
transmissionActive
=
false
;
transmissionListMode
=
false
;
transmissionListMode
=
false
;
clearRetransmissionLists
();
int
missingReadCount
,
missingWriteCount
;
clearRetransmissionLists
(
missingReadCount
,
missingWriteCount
);
if
((
missingReadCount
>
0
)
||
(
missingWriteCount
>
0
))
{
setParameterStatusMsg
(
tr
(
"TIMEOUT! MISSING: %1 read, %2 write."
).
arg
(
missingReadCount
).
arg
(
missingWriteCount
),
ParamCommsStatusLevel_Warning
);
}
return
;
return
;
}
}
qDebug
()
<<
__FILE__
<<
__LINE__
<<
"RETRANSMISSION GUARD ACTIVE, CHECKING FOR DROPS.."
;
resendReadWriteRequests
();
resendReadWriteRequests
();
}
}
else
{
else
{
...
@@ -544,17 +548,17 @@ void UASParameterCommsMgr::sendPendingParameters()
...
@@ -544,17 +548,17 @@ void UASParameterCommsMgr::sendPendingParameters()
QMap
<
int
,
QMap
<
QString
,
QVariant
>*>::
iterator
i
;
QMap
<
int
,
QMap
<
QString
,
QVariant
>*>::
iterator
i
;
for
(
i
=
changedValues
->
begin
();
i
!=
changedValues
->
end
();
++
i
)
{
for
(
i
=
changedValues
->
begin
();
i
!=
changedValues
->
end
();
++
i
)
{
// Iterate through the parameters of the component
// Iterate through the parameters of the component
int
compid
=
i
.
key
();
int
compId
=
i
.
key
();
QMap
<
QString
,
QVariant
>*
comp
=
i
.
value
();
QMap
<
QString
,
QVariant
>*
paramList
=
i
.
value
();
{
QMap
<
QString
,
QVariant
>::
iterator
j
;
QMap
<
QString
,
QVariant
>::
iterator
j
;
for
(
j
=
comp
->
begin
();
j
!=
comp
->
end
();
++
j
)
{
setParameterStatusMsg
(
tr
(
"%1 pending params for component %2"
).
arg
(
paramList
->
count
()).
arg
(
compId
));
for
(
j
=
paramList
->
begin
();
j
!=
paramList
->
end
();
++
j
)
{
//TODO mavlink command for "set parameter list" ?
//TODO mavlink command for "set parameter list" ?
setParameter
(
compi
d
,
j
.
key
(),
j
.
value
());
setParameter
(
compI
d
,
j
.
key
(),
j
.
value
());
parametersSent
++
;
parametersSent
++
;
}
}
}
}
}
// Change transmission status if necessary
// Change transmission status if necessary
if
(
parametersSent
==
0
)
{
if
(
parametersSent
==
0
)
{
...
...
src/uas/UASParameterCommsMgr.h
View file @
3319dc65
...
@@ -39,7 +39,7 @@ protected:
...
@@ -39,7 +39,7 @@ protected:
void
loadParamCommsSettings
();
void
loadParamCommsSettings
();
/** @brief clear transmissionMissingPackets and transmissionMissingWriteAckPackets */
/** @brief clear transmissionMissingPackets and transmissionMissingWriteAckPackets */
void
clearRetransmissionLists
();
void
clearRetransmissionLists
(
int
&
missingReadCount
,
int
&
missingWriteCount
);
void
resendReadWriteRequests
();
void
resendReadWriteRequests
();
...
...
src/ui/QGCParamWidget.cc
View file @
3319dc65
...
@@ -88,7 +88,6 @@ void QGCParamWidget::layoutWidget()
...
@@ -88,7 +88,6 @@ void QGCParamWidget::layoutWidget()
tree
=
new
QTreeWidget
(
this
);
tree
=
new
QTreeWidget
(
this
);
statusLabel
=
new
QLabel
();
statusLabel
=
new
QLabel
();
statusLabel
->
setAutoFillBackground
(
true
);
statusLabel
->
setAutoFillBackground
(
true
);
tree
->
setColumnWidth
(
70
,
30
);
// Set tree widget as widget onto this component
// Set tree widget as widget onto this component
QGridLayout
*
horizontalLayout
;
QGridLayout
*
horizontalLayout
;
...
@@ -117,7 +116,8 @@ void QGCParamWidget::layoutWidget()
...
@@ -117,7 +116,8 @@ void QGCParamWidget::layoutWidget()
QPushButton
*
setButton
=
new
QPushButton
(
tr
(
"Set"
));
QPushButton
*
setButton
=
new
QPushButton
(
tr
(
"Set"
));
setButton
->
setToolTip
(
tr
(
"Set current parameters in non-permanent onboard memory"
));
setButton
->
setToolTip
(
tr
(
"Set current parameters in non-permanent onboard memory"
));
setButton
->
setWhatsThis
(
tr
(
"Set current parameters in non-permanent onboard memory"
));
setButton
->
setWhatsThis
(
tr
(
"Set current parameters in non-permanent onboard memory"
));
connect
(
setButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setParameters
()));
connect
(
setButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
sendPendingParameters
()));
horizontalLayout
->
addWidget
(
setButton
,
2
,
1
);
horizontalLayout
->
addWidget
(
setButton
,
2
,
1
);
QPushButton
*
writeButton
=
new
QPushButton
(
tr
(
"Write (ROM)"
));
QPushButton
*
writeButton
=
new
QPushButton
(
tr
(
"Write (ROM)"
));
...
@@ -159,7 +159,7 @@ void QGCParamWidget::layoutWidget()
...
@@ -159,7 +159,7 @@ void QGCParamWidget::layoutWidget()
headerItems
.
append
(
"Value"
);
headerItems
.
append
(
"Value"
);
tree
->
setHeaderLabels
(
headerItems
);
tree
->
setHeaderLabels
(
headerItems
);
tree
->
setColumnCount
(
2
);
tree
->
setColumnCount
(
2
);
tree
->
setColumnWidth
(
0
,
12
0
);
tree
->
setColumnWidth
(
0
,
20
0
);
tree
->
setColumnWidth
(
1
,
120
);
tree
->
setColumnWidth
(
1
,
120
);
tree
->
setExpandsOnDoubleClick
(
true
);
tree
->
setExpandsOnDoubleClick
(
true
);
...
@@ -167,8 +167,9 @@ void QGCParamWidget::layoutWidget()
...
@@ -167,8 +167,9 @@ void QGCParamWidget::layoutWidget()
}
}
void
QGCParamWidget
::
addComponentItem
(
int
compId
,
QString
compName
)
void
QGCParamWidget
::
addComponentItem
(
int
compId
,
QString
compName
)
{
{
QString
compLine
=
QString
(
"%1 (#%2)"
).
arg
(
compName
).
arg
(
compId
);
QString
compLine
=
QString
(
"%1 (#%2)"
).
arg
(
compName
).
arg
(
compId
);
QString
ptrStr
=
QString
().
sprintf
(
"%8p"
,
this
);
QString
ptrStr
=
QString
().
sprintf
(
"%8p"
,
this
);
...
@@ -231,37 +232,41 @@ void QGCParamWidget::handleParameterListUpToDate()
...
@@ -231,37 +232,41 @@ void QGCParamWidget::handleParameterListUpToDate()
}
}
void
QGCParamWidget
::
updateParameterDisplay
(
int
comp
onent
Id
,
QString
parameterName
,
QVariant
value
)
void
QGCParamWidget
::
updateParameterDisplay
(
int
compId
,
QString
parameterName
,
QVariant
value
)
{
{
// qDebug() << "QGCParamWidget::updateParameterDisplay" << parameterName;
// qDebug() << "QGCParamWidget::updateParameterDisplay" << parameterName;
// Reference to item in tree
// Reference to item in tree
QTreeWidgetItem
*
parameterItem
=
NULL
;
QTreeWidgetItem
*
parameterItem
=
NULL
;
// Add component item if necessary
// Add component item if necessary
if
(
!
componentItems
->
contains
(
comp
onent
Id
))
{
if
(
!
componentItems
->
contains
(
compId
))
{
QString
componentName
=
tr
(
"Component #%1"
).
arg
(
comp
onent
Id
);
QString
componentName
=
tr
(
"Component #%1"
).
arg
(
compId
);
addComponentItem
(
comp
onent
Id
,
componentName
);
addComponentItem
(
compId
,
componentName
);
}
}
QString
splitToken
=
"_"
;
QString
splitToken
=
"_"
;
// Check if auto-grouping can work
// Check if auto-grouping can work
if
(
parameterName
.
contains
(
splitToken
))
{
if
(
parameterName
.
contains
(
splitToken
))
{
QString
parent
=
parameterName
.
section
(
splitToken
,
0
,
0
,
QString
::
SectionSkipEmpty
);
QString
parent
Str
=
parameterName
.
section
(
splitToken
,
0
,
0
,
QString
::
SectionSkipEmpty
);
QMap
<
QString
,
QTreeWidgetItem
*>*
compParamGroups
=
paramGroups
.
value
(
comp
onent
Id
);
QMap
<
QString
,
QTreeWidgetItem
*>*
compParamGroups
=
paramGroups
.
value
(
compId
);
if
(
!
compParamGroups
->
contains
(
parent
))
{
if
(
!
compParamGroups
->
contains
(
parent
Str
))
{
// Insert group item
// Insert group item
QStringList
glist
;
QStringList
glist
;
glist
.
append
(
parent
);
glist
.
append
(
parent
Str
);
QTreeWidgetItem
*
groupItem
=
new
QTreeWidgetItem
(
glist
);
QTreeWidgetItem
*
groupItem
=
new
QTreeWidgetItem
(
glist
);
compParamGroups
->
insert
(
parent
,
groupItem
);
componentItems
->
value
(
componentId
)
->
addChild
(
groupItem
);
compParamGroups
->
insert
(
parentStr
,
groupItem
);
// insert new group alphabetized
QList
<
QString
>
groupKeys
=
compParamGroups
->
uniqueKeys
();
int
insertIdx
=
groupKeys
.
indexOf
(
parentStr
);
componentItems
->
value
(
compId
)
->
insertChild
(
insertIdx
,
groupItem
);
}
}
// Append child to group
// Append child to group
bool
found
=
false
;
bool
found
=
false
;
QTreeWidgetItem
*
parentItem
=
compParamGroups
->
value
(
parent
);
QTreeWidgetItem
*
parentItem
=
compParamGroups
->
value
(
parent
Str
);
for
(
int
i
=
0
;
i
<
parentItem
->
childCount
();
i
++
)
{
for
(
int
i
=
0
;
i
<
parentItem
->
childCount
();
i
++
)
{
QTreeWidgetItem
*
child
=
parentItem
->
child
(
i
);
QTreeWidgetItem
*
child
=
parentItem
->
child
(
i
);
QString
key
=
child
->
data
(
0
,
Qt
::
DisplayRole
).
toString
();
QString
key
=
child
->
data
(
0
,
Qt
::
DisplayRole
).
toString
();
...
@@ -292,13 +297,13 @@ void QGCParamWidget::updateParameterDisplay(int componentId, QString parameterNa
...
@@ -292,13 +297,13 @@ void QGCParamWidget::updateParameterDisplay(int componentId, QString parameterNa
parameterItem
->
setData
(
1
,
Qt
::
DisplayRole
,
value
);
parameterItem
->
setData
(
1
,
Qt
::
DisplayRole
,
value
);
}
}
compParamGroups
->
value
(
parent
)
->
addChild
(
parameterItem
);
compParamGroups
->
value
(
parent
Str
)
->
addChild
(
parameterItem
);
parameterItem
->
setFlags
(
parameterItem
->
flags
()
|
Qt
::
ItemIsEditable
);
parameterItem
->
setFlags
(
parameterItem
->
flags
()
|
Qt
::
ItemIsEditable
);
}
}
}
}
else
{
else
{
bool
found
=
false
;
bool
found
=
false
;
QTreeWidgetItem
*
parent
=
componentItems
->
value
(
comp
onent
Id
);
QTreeWidgetItem
*
parent
=
componentItems
->
value
(
compId
);
for
(
int
i
=
0
;
i
<
parent
->
childCount
();
i
++
)
{
for
(
int
i
=
0
;
i
<
parent
->
childCount
();
i
++
)
{
QTreeWidgetItem
*
child
=
parent
->
child
(
i
);
QTreeWidgetItem
*
child
=
parent
->
child
(
i
);
QString
key
=
child
->
data
(
0
,
Qt
::
DisplayRole
).
toString
();
QString
key
=
child
->
data
(
0
,
Qt
::
DisplayRole
).
toString
();
...
@@ -319,7 +324,7 @@ void QGCParamWidget::updateParameterDisplay(int componentId, QString parameterNa
...
@@ -319,7 +324,7 @@ void QGCParamWidget::updateParameterDisplay(int componentId, QString parameterNa
// CONFIGURE PARAMETER ITEM
// CONFIGURE PARAMETER ITEM
parameterItem
->
setData
(
1
,
Qt
::
DisplayRole
,
value
);
parameterItem
->
setData
(
1
,
Qt
::
DisplayRole
,
value
);
componentItems
->
value
(
comp
onent
Id
)
->
addChild
(
parameterItem
);
componentItems
->
value
(
compId
)
->
addChild
(
parameterItem
);
parameterItem
->
setFlags
(
parameterItem
->
flags
()
|
Qt
::
ItemIsEditable
);
parameterItem
->
setFlags
(
parameterItem
->
flags
()
|
Qt
::
ItemIsEditable
);
}
}
}
}
...
@@ -434,14 +439,6 @@ void QGCParamWidget::requestAllParamsUpdate()
...
@@ -434,14 +439,6 @@ void QGCParamWidget::requestAllParamsUpdate()
/**
* Set all parameter in the parameter tree on the MAV
*/
void
QGCParamWidget
::
setParameters
()
{
paramCommsMgr
->
sendPendingParameters
();
}
/**
/**
* Write the current onboard parameters from RAM into
* Write the current onboard parameters from RAM into
* permanent storage, e.g. EEPROM or harddisk
* permanent storage, e.g. EEPROM or harddisk
...
@@ -454,7 +451,7 @@ void QGCParamWidget::writeParameters()
...
@@ -454,7 +451,7 @@ void QGCParamWidget::writeParameters()
QMap
<
int
,
QMap
<
QString
,
QVariant
>*>*
changedValues
=
paramDataModel
->
getPendingParameters
();
QMap
<
int
,
QMap
<
QString
,
QVariant
>*>*
changedValues
=
paramDataModel
->
getPendingParameters
();
for
(
i
=
changedValues
->
begin
();
(
i
!=
changedValues
->
end
())
&&
(
0
==
changedParamCount
);
++
i
)
{
for
(
i
=
changedValues
->
begin
();
(
i
!=
changedValues
->
end
())
&&
(
0
==
changedParamCount
);
++
i
)
{
// Iterate through the p
arameters of the component
// Iterate through the p
ending parameters of the component, break on the first changed parameter
QMap
<
QString
,
QVariant
>*
compPending
=
i
.
value
();
QMap
<
QString
,
QVariant
>*
compPending
=
i
.
value
();
changedParamCount
+=
compPending
->
count
();
changedParamCount
+=
compPending
->
count
();
}
}
...
...
src/ui/QGCParamWidget.h
View file @
3319dc65
...
@@ -77,10 +77,7 @@ public slots:
...
@@ -77,10 +77,7 @@ public slots:
void
updateParameterDisplay
(
int
component
,
QString
parameterName
,
QVariant
value
);
void
updateParameterDisplay
(
int
component
,
QString
parameterName
,
QVariant
value
);
/** @brief Request list of parameters from MAV */
/** @brief Request list of parameters from MAV */
void
requestAllParamsUpdate
();
void
requestAllParamsUpdate
();
/** @brief Set one parameter, changes value in RAM of MAV */
// virtual void setParameter(int component, QString parameterName, QVariant value);
/** @brief Set all parameters, changes the value in RAM of MAV */
void
setParameters
();
/** @brief Write the current parameters to permanent storage (EEPROM/HDD) */
/** @brief Write the current parameters to permanent storage (EEPROM/HDD) */
void
writeParameters
();
void
writeParameters
();
/** @brief Read the parameters from permanent storage to RAM */
/** @brief Read the parameters from permanent storage to RAM */
...
@@ -103,7 +100,6 @@ protected:
...
@@ -103,7 +100,6 @@ protected:
QMap
<
int
,
QTreeWidgetItem
*>*
componentItems
;
///< The tree of component items, stored by component ID
QMap
<
int
,
QTreeWidgetItem
*>*
componentItems
;
///< The tree of component items, stored by component ID
QMap
<
int
,
QMap
<
QString
,
QTreeWidgetItem
*>*
>
paramGroups
;
///< Parameter groups to organize component items
QMap
<
int
,
QMap
<
QString
,
QTreeWidgetItem
*>*
>
paramGroups
;
///< Parameter groups to organize component items
};
};
#endif // QGCPARAMWIDGET_H
#endif // QGCPARAMWIDGET_H
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