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
594429ee
Commit
594429ee
authored
May 12, 2014
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "remove duplicate code "
This reverts commit
80f4f133
.
parent
55b29141
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
63 deletions
+112
-63
UAS.cc
src/uas/UAS.cc
+112
-63
No files found.
src/uas/UAS.cc
View file @
594429ee
...
...
@@ -2552,76 +2552,125 @@ void UAS::processParamValueMsg(mavlink_message_t& msg, const QString& paramName,
parameters
.
insert
(
compId
,
new
QMap
<
QString
,
QVariant
>
());
}
// Insert parameter into registry
if
(
parameters
.
value
(
compId
)
->
contains
(
paramName
))
{
parameters
.
value
(
compId
)
->
remove
(
paramName
);
}
QVariant
param
;
// Insert with correct type
// TODO: This is a hack for MAV_AUTOPILOT_ARDUPILOTMEGA until the new version of MAVLink and a fix for their param handling.
switch
(
rawValue
.
param_type
)
{
case
MAV_PARAM_TYPE_REAL32
:
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
(
paramValue
.
param_float
);
}
else
{
param
=
QVariant
(
paramValue
.
param_float
);
}
break
;
case
MAV_PARAM_TYPE_UINT8
:
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
(
QChar
((
unsigned
char
)
paramValue
.
param_float
));
}
else
{
param
=
QVariant
(
QChar
((
quint8
)
paramValue
.
param_float
));
}
break
;
case
MAV_PARAM_TYPE_INT8
:
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
(
QChar
((
char
)
paramValue
.
param_float
));
}
else
{
param
=
QVariant
(
QChar
((
qint8
)
paramValue
.
param_float
));
}
break
;
case
MAV_PARAM_TYPE_INT16
:
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
((
short
)
paramValue
.
param_float
);
}
else
{
param
=
QVariant
((
qint16
)
paramValue
.
param_float
);
}
break
;
case
MAV_PARAM_TYPE_UINT16
:
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
((
unsigned
short
)
paramValue
.
param_float
);
}
else
{
param
=
QVariant
((
quint16
)
paramValue
.
param_float
);
}
break
;
case
MAV_PARAM_TYPE_UINT32
:
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
((
unsigned
int
)
paramValue
.
param_float
);
}
else
{
param
=
QVariant
((
quint32
)
paramValue
.
param_float
);
}
break
;
case
MAV_PARAM_TYPE_INT32
:
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
((
int
)
paramValue
.
param_float
);
}
else
{
param
=
QVariant
((
qint32
)
paramValue
.
param_float
);
}
break
;
default:
qCritical
()
<<
"INVALID DATA TYPE USED AS PARAMETER VALUE: "
<<
rawValue
.
param_type
;
return
;
switch
(
rawValue
.
param_type
)
{
case
MAV_PARAM_TYPE_REAL32
:
{
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
(
paramValue
.
param_float
);
}
else
{
param
=
QVariant
(
paramValue
.
param_float
);
}
parameters
.
value
(
compId
)
->
insert
(
paramName
,
param
);
// Emit change
emit
parameterChanged
(
uasId
,
compId
,
paramName
,
param
);
emit
parameterChanged
(
uasId
,
compId
,
rawValue
.
param_count
,
rawValue
.
param_index
,
paramName
,
param
);
// qDebug() << "RECEIVED PARAM:" << param;
}
break
;
case
MAV_PARAM_TYPE_UINT8
:
{
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
(
QChar
((
unsigned
char
)
paramValue
.
param_float
));
}
else
{
param
=
QVariant
(
QChar
((
quint8
)
paramValue
.
param_float
));
}
parameters
.
value
(
compId
)
->
insert
(
paramName
,
param
);
// Emit change
emit
parameterChanged
(
uasId
,
compId
,
paramName
,
param
);
emit
parameterChanged
(
uasId
,
compId
,
rawValue
.
param_count
,
rawValue
.
param_index
,
paramName
,
param
);
//qDebug() << "RECEIVED PARAM:" << param;
}
break
;
case
MAV_PARAM_TYPE_INT8
:
{
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
(
QChar
((
char
)
paramValue
.
param_float
));
}
else
{
param
=
QVariant
(
QChar
((
qint8
)
paramValue
.
param_float
));
}
parameters
.
value
(
compId
)
->
insert
(
paramName
,
param
);
// Emit change
emit
parameterChanged
(
uasId
,
compId
,
paramName
,
param
);
emit
parameterChanged
(
uasId
,
compId
,
rawValue
.
param_count
,
rawValue
.
param_index
,
paramName
,
param
);
//qDebug() << "RECEIVED PARAM:" << param;
}
break
;
case
MAV_PARAM_TYPE_INT16
:
{
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
((
short
)
paramValue
.
param_float
);
}
else
{
param
=
QVariant
((
qint16
)
paramValue
.
param_float
);
}
parameters
.
value
(
compId
)
->
insert
(
paramName
,
param
);
// Emit change
emit
parameterChanged
(
uasId
,
compId
,
paramName
,
param
);
emit
parameterChanged
(
uasId
,
compId
,
rawValue
.
param_count
,
rawValue
.
param_index
,
paramName
,
param
);
//qDebug() << "RECEIVED PARAM:" << param;
}
break
;
case
MAV_PARAM_TYPE_UINT16
:
{
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
((
unsigned
short
)
paramValue
.
param_float
);
}
else
{
param
=
QVariant
((
quint16
)
paramValue
.
param_float
);
}
parameters
.
value
(
compId
)
->
insert
(
paramName
,
param
);
// Emit change
emit
parameterChanged
(
uasId
,
compId
,
paramName
,
param
);
emit
parameterChanged
(
uasId
,
compId
,
rawValue
.
param_count
,
rawValue
.
param_index
,
paramName
,
param
);
//qDebug() << "RECEIVED PARAM:" << param;
}
break
;
case
MAV_PARAM_TYPE_UINT32
:
{
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
((
unsigned
int
)
paramValue
.
param_float
);
}
else
{
param
=
QVariant
((
quint32
)
paramValue
.
param_float
);
}
parameters
.
value
(
compId
)
->
insert
(
paramName
,
param
);
// Emit change
emit
parameterChanged
(
uasId
,
compId
,
paramName
,
param
);
emit
parameterChanged
(
uasId
,
compId
,
rawValue
.
param_count
,
rawValue
.
param_index
,
paramName
,
param
);
}
break
;
case
MAV_PARAM_TYPE_INT32
:
{
if
(
getAutopilotType
()
==
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
param
=
QVariant
((
int
)
paramValue
.
param_float
);
}
else
{
param
=
QVariant
((
qint32
)
paramValue
.
param_float
);
}
parameters
.
value
(
compId
)
->
insert
(
paramName
,
param
);
// Emit change
emit
parameterChanged
(
uasId
,
compId
,
paramName
,
param
);
emit
parameterChanged
(
uasId
,
compId
,
rawValue
.
param_count
,
rawValue
.
param_index
,
paramName
,
param
);
// qDebug() << "RECEIVED PARAM:" << param;
}
break
;
default:
qCritical
()
<<
"INVALID DATA TYPE USED AS PARAMETER VALUE: "
<<
rawValue
.
param_type
;
}
//switch (value.param_type)
// We did not return a critical error, now insert parameter into registry
if
(
parameters
.
value
(
compId
)
->
contains
(
paramName
))
{
parameters
.
value
(
compId
)
->
remove
(
paramName
);
}
// add new values
parameters
.
value
(
compId
)
->
insert
(
paramName
,
param
);
// Emit change
emit
parameterChanged
(
uasId
,
compId
,
paramName
,
param
);
emit
parameterChanged
(
uasId
,
compId
,
rawValue
.
param_count
,
rawValue
.
param_index
,
paramName
,
param
);
}
/**
...
...
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