diff --git a/Tools/scripts/build_options.py b/Tools/scripts/build_options.py index 102c1958204f2..2e978abf4be8e 100644 --- a/Tools/scripts/build_options.py +++ b/Tools/scripts/build_options.py @@ -331,6 +331,7 @@ def __init__(self, Feature('MAVLink', 'MAVLINK_VERSION_REQUEST', 'AP_MAVLINK_AUTOPILOT_VERSION_REQUEST_ENABLED', 'Enable old AUTOPILOT_VERSION_REQUEST mesage', 0, None), # noqa Feature('MAVLink', 'REQUEST_AUTOPILOT_CAPA', 'AP_MAVLINK_MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES_ENABLED', 'Enable old REQUEST_AUTOPILOT_CAPABILITIES command', 0, None), # noqa Feature('MAVLink', 'MAV_MSG_RELAY_STATUS', 'AP_MAVLINK_MSG_RELAY_STATUS_ENABLED', 'Enable sending of RELAY_STATUS message', 0, 'RELAY'), # noqa + Feature('MAVLink', 'MAV_MSG_HIL_GPS', 'AP_MAVLINK_MSG_HIL_GPS_ENABLED', 'Enable receiving of HIL_GPS messages', 0, None), # noqa Feature('MAVLink', 'MAV_MSG_MOUNT_CONTROL', 'AP_MAVLINK_MSG_MOUNT_CONTROL_ENABLED', 'Enable handling of deprecated MOUNT_CONTROL message', 0, None), # noqa Feature('MAVLink', 'MAV_MSG_MOUNT_CONFIGURE', 'AP_MAVLINK_MSG_MOUNT_CONFIGURE_ENABLED', 'Enable handling of deprecated MOUNT_CONFIGURE message', 0, None), # noqa Feature('MAVLink', 'AP_MAVLINK_BATTERY2_ENABLED', 'AP_MAVLINK_BATTERY2_ENABLED', 'Enable sending of old BATTERY2 message', 0, None), # noqa diff --git a/Tools/scripts/extract_features.py b/Tools/scripts/extract_features.py index cc9274955df70..659b2a1a9468b 100755 --- a/Tools/scripts/extract_features.py +++ b/Tools/scripts/extract_features.py @@ -253,6 +253,7 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"): ('AP_CUSTOMROTATIONS_ENABLED', 'AP_CustomRotation::init'), ('AP_OSD_LINK_STATS_EXTENSIONS_ENABLED', r'AP_OSD_Screen::draw_rc_tx_power'), ('HAL_ENABLE_DRONECAN_DRIVERS', r'AP_DroneCAN::init'), + ('AP_MAVLINK_MSG_HIL_GPS_ENABLED', r'mavlink_msg_hil_gps_decode'), ] def progress(self, msg): diff --git a/libraries/AP_GPS/AP_GPS_MAV.cpp b/libraries/AP_GPS/AP_GPS_MAV.cpp index d5c3f4925ea88..68f0ef957666f 100644 --- a/libraries/AP_GPS/AP_GPS_MAV.cpp +++ b/libraries/AP_GPS/AP_GPS_MAV.cpp @@ -140,6 +140,7 @@ void AP_GPS_MAV::handle_msg(const mavlink_message_t &msg) break; } +#if AP_MAVLINK_MSG_HIL_GPS_ENABLED case MAVLINK_MSG_ID_HIL_GPS: { mavlink_hil_gps_t packet; mavlink_msg_hil_gps_decode(&msg, &packet); @@ -176,6 +177,7 @@ void AP_GPS_MAV::handle_msg(const mavlink_message_t &msg) _new_data = true; break; } +#endif // AP_MAVLINK_MSG_HIL_GPS_ENABLED default: // ignore all other messages break; diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index fadf622bdc21e..1f5ec42104cbe 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -4121,9 +4121,13 @@ void GCS_MAVLINK::handle_message(const mavlink_message_t &msg) #endif #if AP_GPS_ENABLED +#if AP_MAVLINK_MSG_HIL_GPS_ENABLED + case MAVLINK_MSG_ID_HIL_GPS: + send_received_message_deprecation_warning("HIL_GPS"); + FALLTHROUGH; +#endif case MAVLINK_MSG_ID_GPS_RTCM_DATA: case MAVLINK_MSG_ID_GPS_INPUT: - case MAVLINK_MSG_ID_HIL_GPS: case MAVLINK_MSG_ID_GPS_INJECT_DATA: AP::gps().handle_msg(chan, msg); break; diff --git a/libraries/GCS_MAVLink/GCS_config.h b/libraries/GCS_MAVLink/GCS_config.h index 64877c10649dd..ceb24e5c75660 100644 --- a/libraries/GCS_MAVLink/GCS_config.h +++ b/libraries/GCS_MAVLink/GCS_config.h @@ -59,6 +59,12 @@ #define AP_MAVLINK_RALLY_POINT_PROTOCOL_ENABLED HAL_GCS_ENABLED && HAL_RALLY_ENABLED #endif +// handling of HIL_GPS is slated to be removed in 4.7; GPS_INPUT can be used +// in its place +#ifndef AP_MAVLINK_MSG_HIL_GPS_ENABLED +#define AP_MAVLINK_MSG_HIL_GPS_ENABLED 0 +#endif + #ifndef AP_MAVLINK_MSG_MOUNT_CONFIGURE_ENABLED #define AP_MAVLINK_MSG_MOUNT_CONFIGURE_ENABLED HAL_GCS_ENABLED #endif