Skip to content

Commit

Permalink
Allow to configure the MAVLINK autopilot type to drive e.g. DJI camer…
Browse files Browse the repository at this point in the history
…a's but do not change the default behaviour
  • Loading branch information
dewagter committed Dec 7, 2023
1 parent 2b0424a commit d624dae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions conf/airframes/tudelft/rot_wing_v3b.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<!-- <module name="mavlink">
<configure name="MAVLINK_BAUD" value="B115200"/>
<configure name="MAVLINK_PORT" value="UART8"/>
<define name="MAV_AUTOPILOT_ID" value="MAV_AUTOPILOT_ARDUPILOTMEGA"/>
</module> -->

<!-- Log in high speed (Remove for outdoor flights) -->
Expand Down
1 change: 1 addition & 0 deletions conf/modules/mavlink.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<description>Basic MAVLink implementation</description>
<configure name="MAVLINK_PORT" value="UARTx|UDPx|UsbS" description="The port device to use for mavlink (default: UART1)"/>
<configure name="MAVLINK_BAUD" value="B57600" description="Baud rate if MAVLINK_PORT is a UART"/>
<define name="MAV_AUTOPILOT_ID" value="MAV_AUTOPILOT_PPZ|MAV_AUTOPILOT_ARDUPILOTMEGA" description="Some MAVLink GCS/Devices require specific ID's to work. Default is to identify as MAV_AUTOPILOT_PPZ."/>
</doc>
<header>
<file name="mavlink.h"/>
Expand Down
7 changes: 6 additions & 1 deletion sw/airborne/modules/datalink/mavlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
#include "modules/radio_control/radio_control.h"
#endif

// Change the autopilot identification code: by default identify as PPZ autopilot: alternatively as MAV_AUTOPILOT_ARDUPILOTMEGA
#ifndef MAV_AUTOPILOT_ID
#define MAV_AUTOPILOT_ID MAV_AUTOPILOT_PPZ
#endif

#include "modules/datalink/missionlib/mission_manager.h"

// for UINT16_MAX
Expand Down Expand Up @@ -500,7 +505,7 @@ static void mavlink_send_heartbeat(struct transport_tx *trans, struct link_devic
}
mavlink_msg_heartbeat_send(MAVLINK_COMM_0,
mav_type,
MAV_AUTOPILOT_ARDUPILOTMEGA,
MAV_AUTOPILOT_ID,
mav_mode,
0, // custom_mode
mav_state);
Expand Down

0 comments on commit d624dae

Please sign in to comment.