Skip to content

Commit d0af9b8

Browse files
GCS_MAVLink: Add AP_MAVLINK_MSG_FLIGHT_INFORMATION_ENABLED guard
1 parent 3ff0136 commit d0af9b8

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

libraries/GCS_MAVLink/GCS.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,14 @@ class GCS_MAVLINK
402402
void send_uavionix_adsb_out_status() const;
403403
void send_autopilot_state_for_gimbal_device() const;
404404

405+
#if AP_MAVLINK_MSG_FLIGHT_INFORMATION_ENABLED
405406
struct {
406407
MAV_LANDED_STATE last_landed_state;
407408
uint32_t takeoff_time_ms;
408409
} flight_info;
409410

410411
void send_flight_information();
412+
#endif
411413

412414
// lock a channel, preventing use by MAVLink
413415
void lock(bool _lock) {

libraries/GCS_MAVLink/GCS_Common.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5960,6 +5960,7 @@ void GCS_MAVLINK::send_autopilot_state_for_gimbal_device() const
59605960
#endif // AP_AHRS_ENABLED
59615961
}
59625962

5963+
#if AP_MAVLINK_MSG_FLIGHT_INFORMATION_ENABLED
59635964
void GCS_MAVLINK::send_flight_information()
59645965
{
59655966
const uint32_t time_boot_ms = AP_HAL::millis();
@@ -6002,6 +6003,7 @@ void GCS_MAVLINK::send_flight_information()
60026003
flight_uuid
60036004
);
60046005
}
6006+
#endif // AP_MAVLINK_MSG_FLIGHT_INFORMATION_ENABLED
60056007

60066008
void GCS_MAVLINK::send_received_message_deprecation_warning(const char * message)
60076009
{
@@ -6431,10 +6433,12 @@ bool GCS_MAVLINK::try_send_message(const enum ap_message id)
64316433
break;
64326434
#endif
64336435

6436+
#if AP_MAVLINK_MSG_FLIGHT_INFORMATION_ENABLED
64346437
case MSG_FLIGHT_INFORMATION:
64356438
CHECK_PAYLOAD_SIZE(FLIGHT_INFORMATION);
64366439
send_flight_information();
64376440
break;
6441+
#endif
64386442

64396443
default:
64406444
// try_send_message must always at some stage return true for

libraries/GCS_MAVLink/GCS_config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,7 @@
131131
#ifndef AP_MAVLINK_MAV_CMD_SET_HAGL_ENABLED
132132
#define AP_MAVLINK_MAV_CMD_SET_HAGL_ENABLED (BOARD_FLASH_SIZE > 1024)
133133
#endif
134+
135+
#ifndef AP_MAVLINK_MSG_FLIGHT_INFORMATION_ENABLED
136+
#define AP_MAVLINK_MSG_FLIGHT_INFORMATION_ENABLED 1
137+
#endif

libraries/GCS_MAVLink/ap_message.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ enum ap_message : uint8_t {
9797
#if AP_MAVLINK_MSG_HIGHRES_IMU_ENABLED
9898
MSG_HIGHRES_IMU,
9999
#endif
100+
#if AP_MAVLINK_MSG_FLIGHT_INFORMATION_ENABLED
100101
MSG_FLIGHT_INFORMATION,
102+
#endif
101103
MSG_LAST // MSG_LAST must be the last entry in this enum
102104
};

0 commit comments

Comments
 (0)