Skip to content

Commit 9f191d4

Browse files
committed
GCS_MAVLink: allow handling of AP_MAVLINK_MSG_HIL_GPS_ENABLED to be compiled out
1 parent 24e54da commit 9f191d4

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

Tools/scripts/build_options.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ def __init__(self,
331331
Feature('MAVLink', 'MAVLINK_VERSION_REQUEST', 'AP_MAVLINK_AUTOPILOT_VERSION_REQUEST_ENABLED', 'Enable old AUTOPILOT_VERSION_REQUEST mesage', 0, None), # noqa
332332
Feature('MAVLink', 'REQUEST_AUTOPILOT_CAPA', 'AP_MAVLINK_MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES_ENABLED', 'Enable old REQUEST_AUTOPILOT_CAPABILITIES command', 0, None), # noqa
333333
Feature('MAVLink', 'MAV_MSG_RELAY_STATUS', 'AP_MAVLINK_MSG_RELAY_STATUS_ENABLED', 'Enable sending of RELAY_STATUS message', 0, 'RELAY'), # noqa
334+
Feature('MAVLink', 'MAV_MSG_HIL_GPS', 'AP_MAVLINK_MSG_HIL_GPS_ENABLED', 'Enable receiving of HIL_GPS messages', 0, None), # noqa
334335
Feature('MAVLink', 'MAV_MSG_MOUNT_CONTROL', 'AP_MAVLINK_MSG_MOUNT_CONTROL_ENABLED', 'Enable handling of deprecated MOUNT_CONTROL message', 0, None), # noqa
335336
Feature('MAVLink', 'MAV_MSG_MOUNT_CONFIGURE', 'AP_MAVLINK_MSG_MOUNT_CONFIGURE_ENABLED', 'Enable handling of deprecated MOUNT_CONFIGURE message', 0, None), # noqa
336337
Feature('MAVLink', 'AP_MAVLINK_BATTERY2_ENABLED', 'AP_MAVLINK_BATTERY2_ENABLED', 'Enable sending of old BATTERY2 message', 0, None), # noqa

Tools/scripts/extract_features.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"):
253253
('AP_CUSTOMROTATIONS_ENABLED', 'AP_CustomRotation::init'),
254254
('AP_OSD_LINK_STATS_EXTENSIONS_ENABLED', r'AP_OSD_Screen::draw_rc_tx_power'),
255255
('HAL_ENABLE_DRONECAN_DRIVERS', r'AP_DroneCAN::init'),
256+
('AP_MAVLINK_MSG_HIL_GPS_ENABLED', r'mavlink_msg_hil_gps_decode'),
256257
]
257258

258259
def progress(self, msg):

libraries/AP_GPS/AP_GPS_MAV.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ void AP_GPS_MAV::handle_msg(const mavlink_message_t &msg)
140140
break;
141141
}
142142

143+
#if AP_MAVLINK_MSG_HIL_GPS_ENABLED
143144
case MAVLINK_MSG_ID_HIL_GPS: {
144145
mavlink_hil_gps_t packet;
145146
mavlink_msg_hil_gps_decode(&msg, &packet);
@@ -176,6 +177,7 @@ void AP_GPS_MAV::handle_msg(const mavlink_message_t &msg)
176177
_new_data = true;
177178
break;
178179
}
180+
#endif // AP_MAVLINK_MSG_HIL_GPS_ENABLED
179181
default:
180182
// ignore all other messages
181183
break;

libraries/GCS_MAVLink/GCS_Common.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4123,7 +4123,9 @@ void GCS_MAVLINK::handle_message(const mavlink_message_t &msg)
41234123
#if AP_GPS_ENABLED
41244124
case MAVLINK_MSG_ID_GPS_RTCM_DATA:
41254125
case MAVLINK_MSG_ID_GPS_INPUT:
4126+
#if AP_MAVLINK_MSG_HIL_GPS_ENABLED
41264127
case MAVLINK_MSG_ID_HIL_GPS:
4128+
#endif
41274129
case MAVLINK_MSG_ID_GPS_INJECT_DATA:
41284130
AP::gps().handle_msg(chan, msg);
41294131
break;

libraries/GCS_MAVLink/GCS_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@
5959
#define AP_MAVLINK_RALLY_POINT_PROTOCOL_ENABLED HAL_GCS_ENABLED && HAL_RALLY_ENABLED
6060
#endif
6161

62+
// handling of HIL_GPS is slated to be removed; GPS_INPUT can be used
63+
// in its place
64+
#ifndef AP_MAVLINK_MSG_HIL_GPS_ENABLED
65+
#define AP_MAVLINK_MSG_HIL_GPS_ENABLED 1
66+
#endif
67+
6268
#ifndef AP_MAVLINK_MSG_MOUNT_CONFIGURE_ENABLED
6369
#define AP_MAVLINK_MSG_MOUNT_CONFIGURE_ENABLED HAL_GCS_ENABLED
6470
#endif

0 commit comments

Comments
 (0)