Skip to content

Commit

Permalink
Scripts: add heartbeat to example19 multiforward ArduPilot#3394
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Aug 21, 2024
1 parent d2d2c0c commit 276dd5d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Plugins/example19-multiforward.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ public override bool Loop()
return;
mAVLinkInterfaces.Add(comport);

comport.SubscribeToPacketType(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, (m) =>
{
try
{
MainV2.Comports.ForEach<MAVLinkInterface>(comport1 =>
{
if (comport != comport1)
comport1.Write(m.buffer);
});
return true;
}
catch (Exception e)
{
return true;
}
}, 0, 0);

comport.SubscribeToPacketType(MAVLink.MAVLINK_MSG_ID.GLOBAL_POSITION_INT, (m) =>
{
try
Expand Down

0 comments on commit 276dd5d

Please sign in to comment.