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
0be24ebc
Commit
0be24ebc
authored
Aug 05, 2013
by
tstellanova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename parameters
parent
13279555
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
26 deletions
+25
-26
QGCUASParamManager.h
src/uas/QGCUASParamManager.h
+7
-8
QGCParamWidget.cc
src/ui/QGCParamWidget.cc
+18
-18
No files found.
src/uas/QGCUASParamManager.h
View file @
0be24ebc
...
@@ -16,23 +16,23 @@ public:
...
@@ -16,23 +16,23 @@ public:
QGCUASParamManager
(
UASInterface
*
uas
,
QWidget
*
parent
=
0
);
QGCUASParamManager
(
UASInterface
*
uas
,
QWidget
*
parent
=
0
);
QList
<
QString
>
getParameterNames
(
int
component
)
const
{
QList
<
QString
>
getParameterNames
(
int
component
)
const
{
return
p
arameters
.
value
(
component
)
->
keys
();
return
onboardP
arameters
.
value
(
component
)
->
keys
();
}
}
QList
<
QVariant
>
getParameterValues
(
int
component
)
const
{
QList
<
QVariant
>
getParameterValues
(
int
component
)
const
{
return
p
arameters
.
value
(
component
)
->
values
();
return
onboardP
arameters
.
value
(
component
)
->
values
();
}
}
bool
getParameterValue
(
int
component
,
const
QString
&
parameter
,
QVariant
&
value
)
const
{
bool
getParameterValue
(
int
component
,
const
QString
&
parameter
,
QVariant
&
value
)
const
{
if
(
!
p
arameters
.
contains
(
component
))
if
(
!
onboardP
arameters
.
contains
(
component
))
{
{
return
false
;
return
false
;
}
}
if
(
!
p
arameters
.
value
(
component
)
->
contains
(
parameter
))
if
(
!
onboardP
arameters
.
value
(
component
)
->
contains
(
parameter
))
{
{
return
false
;
return
false
;
}
}
value
=
p
arameters
.
value
(
component
)
->
value
(
parameter
);
value
=
onboardP
arameters
.
value
(
component
)
->
value
(
parameter
);
return
true
;
return
true
;
}
}
...
@@ -64,10 +64,9 @@ public slots:
...
@@ -64,10 +64,9 @@ public slots:
protected:
protected:
//Parameter data model
//
Parameter data model
UASInterface
*
mav
;
///< The MAV this widget is controlling
UASInterface
*
mav
;
///< The MAV this widget is controlling
// QMap<int, QMap<QString, QVariant>* > changedValues; ///< Changed values
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
onboardParameters
;
///< All parameters
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
parameters
;
///< All parameters
UASParameterDataModel
*
paramDataModel
;
///< Shared data model of parameters
UASParameterDataModel
*
paramDataModel
;
///< Shared data model of parameters
// Communications management
// Communications management
...
...
src/ui/QGCParamWidget.cc
View file @
0be24ebc
...
@@ -332,8 +332,8 @@ void QGCParamWidget::addComponent(int uas, int component, QString componentName)
...
@@ -332,8 +332,8 @@ void QGCParamWidget::addComponent(int uas, int component, QString componentName)
tree
->
addTopLevelItem
(
comp
);
tree
->
addTopLevelItem
(
comp
);
tree
->
update
();
tree
->
update
();
// Create map in parameters
// Create map in parameters
if
(
!
p
arameters
.
contains
(
component
))
{
if
(
!
onboardP
arameters
.
contains
(
component
))
{
p
arameters
.
insert
(
component
,
new
QMap
<
QString
,
QVariant
>
());
onboardP
arameters
.
insert
(
component
,
new
QMap
<
QString
,
QVariant
>
());
}
}
// // Create map in changed parameters
// // Create map in changed parameters
// if (!changedValues.contains(component)) {
// if (!changedValues.contains(component)) {
...
@@ -524,8 +524,8 @@ void QGCParamWidget::receivedParameterUpdate(int uas, int component, QString par
...
@@ -524,8 +524,8 @@ void QGCParamWidget::receivedParameterUpdate(int uas, int component, QString par
// Replace value in map
// Replace value in map
// FIXME
// FIXME
if
(
parameters
.
value
(
component
)
->
contains
(
parameterName
))
p
arameters
.
value
(
component
)
->
remove
(
parameterName
);
if
(
onboardParameters
.
value
(
component
)
->
contains
(
parameterName
))
onboardP
arameters
.
value
(
component
)
->
remove
(
parameterName
);
p
arameters
.
value
(
component
)
->
insert
(
parameterName
,
value
);
onboardP
arameters
.
value
(
component
)
->
insert
(
parameterName
,
value
);
QString
splitToken
=
"_"
;
QString
splitToken
=
"_"
;
...
@@ -666,7 +666,7 @@ void QGCParamWidget::requestParameterList()
...
@@ -666,7 +666,7 @@ void QGCParamWidget::requestParameterList()
// Clear view and request param list
// Clear view and request param list
clear
();
clear
();
p
arameters
.
clear
();
onboardP
arameters
.
clear
();
received
.
clear
();
received
.
clear
();
// Clear transmission state
// Clear transmission state
transmissionListMode
=
true
;
transmissionListMode
=
true
;
...
@@ -715,35 +715,35 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column)
...
@@ -715,35 +715,35 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column)
map
->
insert
(
str
,
value
);
map
->
insert
(
str
,
value
);
// Check if the value was numerically changed
// Check if the value was numerically changed
if
(
!
parameters
.
value
(
key
)
->
contains
(
str
)
||
p
arameters
.
value
(
key
)
->
value
(
str
,
value
.
toDouble
()
-
1
)
!=
value
)
{
if
(
!
onboardParameters
.
value
(
key
)
->
contains
(
str
)
||
onboardP
arameters
.
value
(
key
)
->
value
(
str
,
value
.
toDouble
()
-
1
)
!=
value
)
{
current
->
setBackground
(
0
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
current
->
setBackground
(
0
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
current
->
setBackground
(
1
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
current
->
setBackground
(
1
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
}
}
switch
((
int
)
p
arameters
.
value
(
key
)
->
value
(
str
).
type
())
switch
((
int
)
onboardP
arameters
.
value
(
key
)
->
value
(
str
).
type
())
{
{
case
QVariant
:
:
Int
:
case
QVariant
:
:
Int
:
{
{
QVariant
fixedValue
(
value
.
toInt
());
QVariant
fixedValue
(
value
.
toInt
());
p
arameters
.
value
(
key
)
->
insert
(
str
,
fixedValue
);
onboardP
arameters
.
value
(
key
)
->
insert
(
str
,
fixedValue
);
}
}
break
;
break
;
case
QVariant
:
:
UInt
:
case
QVariant
:
:
UInt
:
{
{
QVariant
fixedValue
(
value
.
toUInt
());
QVariant
fixedValue
(
value
.
toUInt
());
p
arameters
.
value
(
key
)
->
insert
(
str
,
fixedValue
);
onboardP
arameters
.
value
(
key
)
->
insert
(
str
,
fixedValue
);
}
}
break
;
break
;
case
QMetaType
:
:
Float
:
case
QMetaType
:
:
Float
:
{
{
QVariant
fixedValue
(
value
.
toFloat
());
QVariant
fixedValue
(
value
.
toFloat
());
p
arameters
.
value
(
key
)
->
insert
(
str
,
fixedValue
);
onboardP
arameters
.
value
(
key
)
->
insert
(
str
,
fixedValue
);
}
}
break
;
break
;
case
QMetaType
:
:
QChar
:
case
QMetaType
:
:
QChar
:
{
{
QVariant
fixedValue
(
QChar
((
unsigned
char
)
value
.
toUInt
()));
QVariant
fixedValue
(
QChar
((
unsigned
char
)
value
.
toUInt
()));
p
arameters
.
value
(
key
)
->
insert
(
str
,
fixedValue
);
onboardP
arameters
.
value
(
key
)
->
insert
(
str
,
fixedValue
);
}
}
break
;
break
;
default:
default:
...
@@ -771,7 +771,7 @@ void QGCParamWidget::saveParametersToFile()
...
@@ -771,7 +771,7 @@ void QGCParamWidget::saveParametersToFile()
// Iterate through all components, through all parameters and emit them
// Iterate through all components, through all parameters and emit them
QMap
<
int
,
QMap
<
QString
,
QVariant
>*>::
iterator
i
;
QMap
<
int
,
QMap
<
QString
,
QVariant
>*>::
iterator
i
;
for
(
i
=
parameters
.
begin
();
i
!=
p
arameters
.
end
();
++
i
)
{
for
(
i
=
onboardParameters
.
begin
();
i
!=
onboardP
arameters
.
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
>*
comp
=
i
.
value
();
...
@@ -874,8 +874,8 @@ void QGCParamWidget::loadParametersFromFile()
...
@@ -874,8 +874,8 @@ void QGCParamWidget::loadParametersFromFile()
bool
changed
=
false
;
bool
changed
=
false
;
int
componentId
=
wpParams
.
at
(
1
).
toInt
();
int
componentId
=
wpParams
.
at
(
1
).
toInt
();
QString
parameterName
=
wpParams
.
at
(
2
);
QString
parameterName
=
wpParams
.
at
(
2
);
if
(
!
p
arameters
.
contains
(
componentId
)
||
if
(
!
onboardP
arameters
.
contains
(
componentId
)
||
fabs
((
static_cast
<
float
>
(
p
arameters
.
value
(
componentId
)
->
value
(
parameterName
,
wpParams
.
at
(
3
).
toDouble
()).
toDouble
()))
-
(
wpParams
.
at
(
3
).
toDouble
()))
>
2.0
f
*
FLT_EPSILON
)
{
fabs
((
static_cast
<
float
>
(
onboardP
arameters
.
value
(
componentId
)
->
value
(
parameterName
,
wpParams
.
at
(
3
).
toDouble
()).
toDouble
()))
-
(
wpParams
.
at
(
3
).
toDouble
()))
>
2.0
f
*
FLT_EPSILON
)
{
changed
=
true
;
changed
=
true
;
qDebug
()
<<
"Changed"
<<
parameterName
<<
"VAL"
<<
wpParams
.
at
(
3
).
toDouble
();
qDebug
()
<<
"Changed"
<<
parameterName
<<
"VAL"
<<
wpParams
.
at
(
3
).
toDouble
();
}
}
...
@@ -940,7 +940,7 @@ void QGCParamWidget::retransmissionGuardTick()
...
@@ -940,7 +940,7 @@ void QGCParamWidget::retransmissionGuardTick()
// Re-request at maximum retransmissionBurstRequestSize parameters at once
// Re-request at maximum retransmissionBurstRequestSize parameters at once
// to prevent link flooding
// to prevent link flooding
QMap
<
int
,
QMap
<
QString
,
QVariant
>*>::
iterator
i
;
QMap
<
int
,
QMap
<
QString
,
QVariant
>*>::
iterator
i
;
for
(
i
=
parameters
.
begin
();
i
!=
p
arameters
.
end
();
++
i
)
{
for
(
i
=
onboardParameters
.
begin
();
i
!=
onboardP
arameters
.
end
();
++
i
)
{
// Iterate through the parameters of the component
// Iterate through the parameters of the component
int
component
=
i
.
key
();
int
component
=
i
.
key
();
// Request n parameters from this component (at maximum)
// Request n parameters from this component (at maximum)
...
@@ -971,7 +971,7 @@ void QGCParamWidget::retransmissionGuardTick()
...
@@ -971,7 +971,7 @@ void QGCParamWidget::retransmissionGuardTick()
if
(
count
<
retransmissionBurstRequestSize
)
{
if
(
count
<
retransmissionBurstRequestSize
)
{
// Re-request write operation
// Re-request write operation
QVariant
value
=
missingParams
->
value
(
key
);
QVariant
value
=
missingParams
->
value
(
key
);
switch
((
int
)
p
arameters
.
value
(
component
)
->
value
(
key
).
type
())
switch
((
int
)
onboardP
arameters
.
value
(
component
)
->
value
(
key
).
type
())
{
{
case
QVariant
:
:
Int
:
case
QVariant
:
:
Int
:
{
{
...
@@ -1035,13 +1035,13 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant
...
@@ -1035,13 +1035,13 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant
statusLabel
->
setText
(
tr
(
"REJ. %1 > max"
).
arg
(
value
.
toDouble
()));
statusLabel
->
setText
(
tr
(
"REJ. %1 > max"
).
arg
(
value
.
toDouble
()));
return
;
return
;
}
}
if
(
p
arameters
.
value
(
component
)
->
value
(
parameterName
)
==
value
)
if
(
onboardP
arameters
.
value
(
component
)
->
value
(
parameterName
)
==
value
)
{
{
statusLabel
->
setText
(
tr
(
"REJ. %1 > max"
).
arg
(
value
.
toDouble
()));
statusLabel
->
setText
(
tr
(
"REJ. %1 > max"
).
arg
(
value
.
toDouble
()));
return
;
return
;
}
}
switch
((
int
)
p
arameters
.
value
(
component
)
->
value
(
parameterName
).
type
())
switch
((
int
)
onboardP
arameters
.
value
(
component
)
->
value
(
parameterName
).
type
())
{
{
case
QVariant
:
:
Char
:
case
QVariant
:
:
Char
:
{
{
...
...
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