Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
cb2892bc
Commit
cb2892bc
authored
Nov 22, 2016
by
Don Gagne
Browse files
One heartbeat per-link, not per-vehicle
parent
128b8d8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Vehicle/MultiVehicleManager.cc
View file @
cb2892bc
...
...
@@ -303,20 +303,27 @@ void MultiVehicleManager::setGcsHeartbeatEnabled(bool gcsHeartBeatEnabled)
void
MultiVehicleManager
::
_sendGCSHeartbeat
(
void
)
{
for
(
int
i
=
0
;
i
<
_vehicles
.
count
();
i
++
)
{
Vehicle
*
vehicle
=
qobject_cast
<
Vehicle
*>
(
_vehicles
[
i
]);
mavlink_message_t
message
;
mavlink_msg_heartbeat_pack_chan
(
_mavlinkProtocol
->
getSystemId
(),
_mavlinkProtocol
->
getComponentId
(),
vehicle
->
priorityLink
()
->
mavlinkChannel
(),
&
message
,
MAV_TYPE_GCS
,
// MAV_TYPE
MAV_AUTOPILOT_INVALID
,
// MAV_AUTOPILOT
MAV_MODE_MANUAL_ARMED
,
// MAV_MODE
0
,
// custom mode
MAV_STATE_ACTIVE
);
// MAV_STATE
vehicle
->
sendMessageOnLink
(
vehicle
->
priorityLink
(),
message
);
// Send a heartbeat out on each link
QmlObjectListModel
*
links
=
_toolbox
->
linkManager
()
->
links
();
for
(
int
i
=
0
;
i
<
links
->
count
();
i
++
)
{
LinkInterface
*
link
=
links
->
value
<
LinkInterface
*>
(
i
);
if
(
link
->
isConnected
())
{
mavlink_message_t
message
;
mavlink_msg_heartbeat_pack_chan
(
_mavlinkProtocol
->
getSystemId
(),
_mavlinkProtocol
->
getComponentId
(),
link
->
mavlinkChannel
(),
&
message
,
MAV_TYPE_GCS
,
// MAV_TYPE
MAV_AUTOPILOT_INVALID
,
// MAV_AUTOPILOT
MAV_MODE_MANUAL_ARMED
,
// MAV_MODE
0
,
// custom mode
MAV_STATE_ACTIVE
);
// MAV_STATE
uint8_t
buffer
[
MAVLINK_MAX_PACKET_LEN
];
int
len
=
mavlink_msg_to_send_buffer
(
buffer
,
&
message
);
link
->
writeBytesSafe
((
const
char
*
)
buffer
,
len
);
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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