mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-13 16:01:36 +08:00
MAVLink app: Enable protocol version handshaking
This allows the ground control station or any other communication partner to query the supported versions. The key aspect is to send the response in MAVLink 2 framing to test the link with a MAVLink 2 framed message.
This commit is contained in:
@@ -362,6 +362,9 @@ MavlinkReceiver::evaluate_target_ok(int command, int target_system, int target_c
|
||||
switch (command) {
|
||||
|
||||
case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES:
|
||||
|
||||
/* fallthrough */
|
||||
case MAV_CMD_REQUEST_PROTOCOL_VERSION:
|
||||
/* broadcast and ignore component */
|
||||
target_ok = (target_system == 0) || (target_system == mavlink_system.sysid);
|
||||
break;
|
||||
@@ -406,6 +409,10 @@ MavlinkReceiver::handle_message_command_long(mavlink_message_t *msg)
|
||||
/* send autopilot version message */
|
||||
_mavlink->send_autopilot_capabilites();
|
||||
|
||||
} else if (cmd_mavlink.command == MAV_CMD_REQUEST_PROTOCOL_VERSION) {
|
||||
/* send protocol version message */
|
||||
_mavlink->send_protocol_version();
|
||||
|
||||
} else if (cmd_mavlink.command == MAV_CMD_GET_HOME_POSITION) {
|
||||
_mavlink->configure_stream_threadsafe("HOME_POSITION", 0.5f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user