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
64eca014
Commit
64eca014
authored
Sep 25, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix APM adjustMavlinkMessage
Previous code was horribly wrong.
parent
09f33f6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
APMFirmwarePlugin.cc
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
+5
-1
Vehicle.cc
src/Vehicle/Vehicle.cc
+4
-8
No files found.
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
View file @
64eca014
...
...
@@ -117,7 +117,7 @@ void APMFirmwarePlugin::adjustMavlinkMessage(mavlink_message_t* message)
paramUnion
.
param_int32
=
(
int32_t
)
paramValue
.
param_value
;
break
;
case
MAV_PARAM_TYPE_REAL32
:
// Already in param_float
paramUnion
.
param_float
=
paramValue
.
param_value
;
break
;
default:
qCritical
()
<<
"Invalid/Unsupported data type used in parameter:"
<<
paramValue
.
param_type
;
...
...
@@ -125,6 +125,8 @@ void APMFirmwarePlugin::adjustMavlinkMessage(mavlink_message_t* message)
paramValue
.
param_value
=
paramUnion
.
param_float
;
mavlink_msg_param_value_encode
(
message
->
sysid
,
message
->
compid
,
message
,
&
paramValue
);
}
else
if
(
message
->
msgid
==
MAVLINK_MSG_ID_PARAM_SET
)
{
mavlink_param_set_t
paramSet
;
mavlink_param_union_t
paramUnion
;
...
...
@@ -161,6 +163,8 @@ void APMFirmwarePlugin::adjustMavlinkMessage(mavlink_message_t* message)
default:
qCritical
()
<<
"Invalid/Unsupported data type used in parameter:"
<<
paramSet
.
param_type
;
}
mavlink_msg_param_set_encode
(
message
->
sysid
,
message
->
compid
,
message
,
&
paramSet
);
}
// FIXME: Need to implement mavlink message severity adjustment
...
...
src/Vehicle/Vehicle.cc
View file @
64eca014
...
...
@@ -260,20 +260,16 @@ void Vehicle::_sendMessage(mavlink_message_t message)
if
(
link
->
isConnected
())
{
MAVLinkProtocol
*
mavlink
=
MAVLinkProtocol
::
instance
();
// Give the plugin a chance to adjust
_firmwarePlugin
->
adjustMavlinkMessage
(
&
message
);
// Write message into buffer, prepending start sign
uint8_t
buffer
[
MAVLINK_MAX_PACKET_LEN
];
int
len
=
mavlink_msg_to_send_buffer
(
buffer
,
&
message
);
static
uint8_t
messageKeys
[
256
]
=
MAVLINK_MESSAGE_CRCS
;
mavlink_finalize_message_chan
(
&
message
,
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
link
->
getMavlinkChannel
(),
message
.
len
,
messageKeys
[
message
.
msgid
]);
// Give the plugin a chance to adjust
_firmwarePlugin
->
adjustMavlinkMessage
(
&
message
);
if
(
link
->
isConnected
())
{
link
->
writeBytes
((
const
char
*
)
buffer
,
len
);
}
else
{
qWarning
()
<<
"Link not connected"
;
}
link
->
writeBytes
((
const
char
*
)
buffer
,
len
);
}
}
}
...
...
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